Home » SQL & PL/SQL » SQL & PL/SQL » return value of a function by using execute immediate
return value of a function by using execute immediate [message #41133] Thu, 28 November 2002 04:32 Go to next message
Jens Vogelgesang
Messages: 23
Registered: January 2002
Junior Member
I need to call a function with execute immediate.
How can I retrieve the value of the function??
Re: return value of a function by using execute immediate [message #41136 is a reply to message #41133] Fri, 29 November 2002 00:06 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
SQL> declare
  2    v_funval number;
  3  begin
  4    execute immediate 'SELECT FUN$PERSONNE_AGENT(180) X FROM DUAL' INTO v_funval;
  5    dbms_output.put_line('Return is: '||v_funval);
  6* end;
  7  /
Return is: 1


HTH,
MHE
Re: return value of a function by using execute immediate [message #41152 is a reply to message #41133] Mon, 02 December 2002 11:12 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
And without a SELECT from DUAL:

declare
  v_value  varchar2(32);
begin
  execute immediate 'begin :val := to_char(12345); end;' using out v_value;
end;
/
Re: return value of a function by using execute immediate [message #41694 is a reply to message #41133] Thu, 23 January 2003 10:20 Go to previous messageGo to next message
William
Messages: 17
Registered: September 2000
Junior Member
Hello I am running:

Oracle8 Enterprise Edition VLM Release 8.0.5.0.0 - Production
With the Partitioning option
PL/SQL Release 8.0.5.0.0 - Production

When I try this I get an error:
Why am I getting this error????

SQL> SET SERVEROUTPUT ON
SQL> declare
2 v_funval number;
3 begin
4 execute immediate 'SELECT FUN$PERSONNE_AGENT(180) X FROM DUAL' INTO v_funval;
5 dbms_output.put_line('Return is: '||v_funval);
6 end;
7 /
execute immediate 'SELECT FUN$PERSONNE_AGENT(180) X FROM DUAL' INTO v_funval;
*
ERROR at line 4:
ORA-06550: line 4, column 10:
PLS-00103: Encountered the symbol "IMMEDIATE" when expecting one of the following:
:= . ( @ % ;
Re: return value of a function by using execute immediate [message #41705 is a reply to message #41133] Sat, 25 January 2003 00:15 Go to previous message
Barbara Boehmer
Messages: 9106
Registered: November 2002
Location: California, USA
Senior Member
Execute immediate was not available in 8.0. It was first available in 8i (8.1).
Previous Topic: maximum value!!!!!!
Next Topic: sql text summary
Goto Forum:
  


Current Time: Thu Jan 15 07:31:41 CST 2026