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:
| 1935 | CLER670 | 100 | 1 | 1 | Y | 37654 | |
| 1936 | CLER670 | 100 | 1 | 2 | N | 37653 | |
| 1937 | CLER670 | 100 | 1 | 3 | N | 37655 | |
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