CREATE OR REPLACE FUNCTION x (pvar t_rec) RETURN pak.CURSOR AS pkddetails pak.CURSOR; mempid VARCHAR2 (1000); BEGIN memp := 'select * from emp where empid IN (';
FOR i IN 1 .. pvar.COUNT LOOP mempid := mempid || '''' || pvar (i) || '''' || ','; END LOOP; mempid := SUBSTR (mempid, 1, (LENGTH (mempid) - 1)); mempid := mempid || ')'; OPEN pkddetails FOR mempid; RETURN pkddetail; END; / Above is a spelling corrected version of what you were trying to say. However you are over complicating the problem. Try something like CREATE OR REPLACE FUNCTION x (pvar t_rec) RETURN pak.CURSOR AS pkddetails pak.CURSOR; mempid VARCHAR2 (1000); BEGIN memp := 'select * from emp where empid IN (select * from table(pvar))'; OPEN pkddetails FOR mempid; RETURN pkddetail; END; / t_rec needs to be a table of objects. I am not giving a working example here, but look up TABLE functions in any PL/SQL book and if you still have questions, let us know. Mike On Wed, Oct 22, 2008 at 11:30 PM, somy <[EMAIL PROTECTED]> wrote: > > > Sorry guys ,will not make that mistake again. > > thanks > . > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---