Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute immediate - function

Status
Not open for further replies.

mike778

Programmer
Jul 30, 2003
12
SE
Is there a way to get a value out of an execue imediate statement?
like this:

execute immediate 'declare x varchar2;begin x:=function(2) end;'

i want to get x out of that statement.

any ideas?
thanks a lot,

mike
 
Yes. Use into and/or using clauses. For your specific case:

declare
x varchar2(10);
begin
execute immediate 'begin :1:=function(2) end;' using out x;
end;

Regards, Dima
 
It works the way dima wrote, but the problem I got now is, that my function returns a table. tried it like this, but didnt work :-(.


declare
i_tbl pa_preval.t_Chartbl;
begin
execute immediate 'begin :1:=testei2; end;' using out i_tbl;
dbms_output.put_line(i_tbl(1));
end;

do you have any ideas?

greetings, michael
 
No chanses,I suppose. You may use some "global" (package) variable as buffer, I did it, should work.

Regards, Dima
 
can't you just use:
Code:
 declare
 i_tbl pa_preval.t_Chartbl;
 begin
   i_tbl :=testei2;
 dbms_output.put_line(i_tbl(1));
 end;
? :)
 
Jad: it's pretty easy, if you know the name of procedure to call during design time :)

Regards, Dima
 
the example you gave had it hard coded ;-)
 
jep, problem is, that i don't know the name before runtime.
i get it from a database table.
will try the global variable thing, but would have prefered to return the value directly...

greetings, mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top