input argument in function use in select statement [message #617341] |
Fri, 27 June 2014 10:17 |
|
Anjas_DA
Messages: 4 Registered: June 2014
|
Junior Member |
|
|
Hi community,
i have this code and i think it should work but i always get an bad bind variable exception
create or replace FUNCTION GET_NAMES(TABLENAME IN VARCHAR2) RETURN TERM_ID_TABLE
PIPELINED AS
v_idx NUMBER;
v_name VARCHAR2(200);
BEGIN
FOR msg IN (SELECT * from :TABLENAME)
....
Do i need to bind the input argument first or am i not allowed to do anything like that at all?
I really appreciate any help!
Best regards
Anja
|
|
|
|
|
Re: input argument in function use in select statement [message #617344 is a reply to message #617341] |
Fri, 27 June 2014 10:34 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
In your case, lets say using SQL*Plus, bind variable only exists in the client. Once you exist, Its lost. Server side won't be able to know about it as object resides in DB not locally. Execute immediate is one option.
Else, and quite obvious reason as I explained about client side, you can have it in a local variable and give it a try.
And select * inside a code is just...whatever...you should know what results you want, isn't it?
[Updated on: Fri, 27 June 2014 10:37] Report message to a moderator
|
|
|
|
|
|
|
|
|
|