Home » SQL & PL/SQL » SQL & PL/SQL » Issue with Pipeline table function (Oracle 11g, Win7)
Issue with Pipeline table function [message #560891] |
Tue, 17 July 2012 13:10  |
 |
mikay1814
Messages: 3 Registered: July 2012 Location: United States
|
Junior Member |
|
|
Hi,
I'm trying to use a pipeline function so that I can cast the collection that is returned by the procedure I call as table. The problem is I get this "PLS-00049: Bad bind variable 'P'" error that I'm not sure is even related. I've searched and looked through many examples but can't figure it out. Any help would be appreciated.
I've posted the package below, I'm fairly new to pl/sql so bear with me.
create or replace
Package pkg1
IS
TYPE OUTREC_TYPE IS RECORD
(
ID VARCHAR2(5)
,BLD_YR VARCHAR2(4)
,SP_CD VARCHAR2(5)
);
type OUTRECSET is table OF OUTREC_TYPE;
FUNCTION GET_REC
( param1 IN VARCHAR
,param2 IN VARCHAR
,param3 IN VARCHAR
,param4 IN VARCHAR
,param5 IN VARCHAR
)
RETURN OUTRECSET
PIPELINED
is
OUT_REC OUTREC_TYPE;
P REFCURSOR;
IN_REC REFCURSOR;
begin
exec SP_BRS_MAINT_AREA('0', '5', '@', '0', '9999',:P); //here is where I'm getting the error
--exec SP_BRS_MAINT_AREA(param1, param2, param3, param4, param5,:P);
LOOP
Fetch p into in_rec;
EXIT WHEN p%NOTFOUND;
out_rec.ID := IN_REC.ID;
OUT_REC.BLD_YR := IN_REC.BLD_YR;
OUT_REC.SP_CD := IN_REC.SP_CD;
PIPE ROW(OUT_REC);
END LOOP;
return;
END GET_REC;
end pkg1;
[Updated on: Tue, 17 July 2012 13:17] Report message to a moderator
|
|
|
|
Re: Issue with Pipeline table function [message #560896 is a reply to message #560891] |
Tue, 17 July 2012 13:27   |
John Watson
Messages: 8984 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I think your error message is misleading: the problem could be "exec", which is not a pl/sql command. It is a SQL*Plus command. Are you trying to invoke a procedure? If so, just get rid of the exec.
|
|
|
|
|
Re: Issue with Pipeline table function [message #560906 is a reply to message #560902] |
Tue, 17 July 2012 13:50   |
 |
mikay1814
Messages: 3 Registered: July 2012 Location: United States
|
Junior Member |
|
|
Thanks for the responses
Unfortunately, after I made those changes... it gave me several more completely different errors.
Error(30,11): PLS-00201: identifier 'REFCURSOR' must be declared
Error(30,11): PL/SQL: Item ignored
Error(31,6): PLS-00201: identifier 'REFCURSOR' must be declared
Error(31,6): PL/SQL: Item ignored
Error(35,2): PL/SQL: Statement ignored
Error(35,138): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(38,1): PL/SQL: SQL Statement ignored
Error(38,7): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(39,3): PL/SQL: Statement ignored
Error(39,13): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(40,7): PL/SQL: Statement ignored
Error(40,24): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(41,6): PL/SQL: Statement ignored
Error(41,24): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(42,6): PL/SQL: Statement ignored
Error(42,28): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(43,6): PL/SQL: Statement ignored
Error(43,26): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Error(44,6): PL/SQL: Statement ignored
Error(44,23): PLS-00320: the declaration of the type of this expression is incomplete or malformed
Warning(1,1): Only first 20 issues are reported
[Updated on: Tue, 17 July 2012 13:51] Report message to a moderator
|
|
|
Re: Issue with Pipeline table function [message #560914 is a reply to message #560906] |
Tue, 17 July 2012 14:36   |
Solomon Yakobson
Messages: 3305 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
create or replace
Package pkg1
IS
TYPE OUTREC_TYPE IS RECORD
(
ID VARCHAR2(5)
,BLD_YR VARCHAR2(4)
,SP_CD VARCHAR2(5)
);
type OUTRECSET is table OF OUTREC_TYPE;
FUNCTION GET_REC
( param1 IN VARCHAR
,param2 IN VARCHAR
,param3 IN VARCHAR
,param4 IN VARCHAR
,param5 IN VARCHAR
)
RETURN OUTRECSET
PIPELINED
is
OUT_REC OUTREC_TYPE;
P SYS_REFCURSOR;
begin
exec SP_BRS_MAINT_AREA(param1, param2, param3, param4, param5,P);
LOOP
Fetch p
into OUT_REC.ID,
OUT_REC.BLD_YR,
OUT_REC.SP_CD;
EXIT WHEN p%NOTFOUND;
PIPE ROW(OUT_REC);
END LOOP;
return;
END GET_REC;
end pkg1;
/
SY.
|
|
|
|
|
Goto Forum:
Current Time: Fri Aug 15 16:00:44 CDT 2025
|