Hi, I need to collecting data from a tables into a pl/sql object using BULK COLLECT, and then querying that object for further processing.
I have created an object and a package wich uses the object.
CREATE OR REPLACE TYPE OBJ_typ AS OBJECT
( C1 VARCHAR2(255),
c2 number(5),
c3 varchar2(200)
)/
CREATE OR REPLACE TYPE Obj_typ_tbl AS table OF OBJ_typ;/
CREATE OR REPLACE PACKAGE BODY PKG_using_obj AS
FUNCTION FN_using_obj
(P_nbr in number
) return Obj_typ_tbl is
V_emp Obj_typ_tbl := Obj_typ_tbl();
begin
select OBJ_typ (emp.c1,emp.c2,emp,c3)
bulk collect into V_emp from
table(cast( V_emp as Obj_typ_tbl )) tbl,
emp_tbl emp where emp.c1 = p_nbr ;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END FN_using_obj;
END PKG_using_obj ;
/
There error I get is "PL/SQL: ORA-02315: incorrect number of arguments for default constructor".
Can someone let me know where I am going wrong with my code.
Start Free Trial