Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using a Table function in a cursor in Forms Builder 11.1.1.7.0 returns "...SQL must return value of

Phil McDermottJan 28 2016 — edited Jan 29 2016

I've got a package that contains the following:

Package

  TYPE rbc_ref_cursor IS REF CURSOR RETURN medstu.rubric_banner_crn%rowtype;

  TYPE rbc_table IS TABLE OF medstu.rubric_banner_crn%rowtype;

  FUNCTION GET_CRN(RUBRIC           IN MEDSTU.RUBRIC_BANNER_CRN.COM_RUBRIC%type,

                                         SITE             IN MEDSTU.RUBRIC_BANNER_CRN.COM_SITE%type,

                                       TERM             IN MEDSTU.RUBRIC_BANNER_CRN.BANNER_TERM%type,

                                          UIN             IN COM.M14_DEMOG.MD_UNIV_ID%type default null,

                         FULL_BANNER_TERM IN MEDSTU.UI2_COURSE_REG.TERM_CD%type default null,

                                START_DATE       IN COM.ROTATION_SLOT.RS_START_DATE%type default null)

       RETURN rbc_table pipelined;

In both SQL Developer and SQLPlus, I can do the following:

--

declare

  cursor c1 is select * from TABLE(medstu.regaudit.get_crn('CLER670',100,1,'673467871','220161'));

begin

  FOR c1rec in c1 loop

    dbms_output.put_line(c1rec.banner_crn);

  END LOOP;

end;

--

Which returns:

37654

37653

37655

I can also successfully just run the select:

select * from table (medstu.regaudit.get_crn(:rot_slot_c_rubric, :block_00_student_site,

                                                             to_number(substr(:rot_slot_rs_banner_term,6,1)),

                                                             :block_00_md_univ_id, :rot_slot_rs_banner_term)

                                    );

Using the parameters as shown in the cursor above, I get the following successfully returned:

1935CLER67010011Y37654
1936CLER67010012N37653
1937CLER67010013N37655

In the forms builder, in a Program Unit procedure body, I have

PROCEDURE populate_regaudit_data IS

  hold_rubric    medstu.rubric_banner_crn.com_rubric%type  := :rot_slot.c_rubric;

  hold_site      medstu.rubric_banner_crn.com_site%type    := :block_00.student_site;

  hold_term      medstu.rubric_banner_crn.banner_term%type := to_number(substr(:rot_slot.rs_banner_term,6,1));

  hold_uin       medstu.ui2_course_reg.uin%type            := :block_00.md_univ_id;

  hold_full_term medstu.ui2_course_reg.term_cd%type        := :rot_slot.rs_banner_term;

 

  cursor crn is select * from table(medstu.regaudit.get_crn(hold_rubric, hold_site, hold_term, hold_uin, hold_full_term));

BEGIN

  :rot_slot.rs_banner_term := regaudit.get_banner_term(:rot_slot.rs_start_date);

  BEGIN

   null;

  EXCEPTION

   WHEN NO_DATA_FOUND THEN

     null;

  END;

END;

When I try to compile, I get:

Error 513 at line 8, column 37

  PL/SQL function called from SQL must return value of legal SQL type

Seemingly the same table function with types defined in the package works fine in both SQL Developer and SQL PLUS.  Why not forms?

Me? I would just call the table from forms, but my manager wants as much as possible of the business logic on the database.

Thanks in advance.

Phil

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 26 2016
Added on Jan 28 2016
5 comments
1,445 views