Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: exec function?

Re: exec function?

From: shailaja <saila_at_irmac.com>
Date: Tue, 15 Jun 1999 17:02:15 -0500
Message-ID: <929484044.215.18@news.remarQ.com>


Let us say i wrote a function to accept two parameters which are numbers and resultant should be the sum of those numbers then i could write the function as

create or replace function test(a number,b number) return number is begin
return a+b;
end;

The above function can be executed from sqlplus or from plsql Execution from sqlplus


sql >  variable k number(where k will be a bind variable)
sql > exec :c:=test(10,20);
sql > print c

Execution from plsql


declare
c number;
begin
c:=test(10,20);
dbms_output.put_line(c);
end;

Let me know whether it was useful for u. My email id is mailto:saila_at_irmac.com.

shailaja

Terry Sharp <tsharp_at_witsys.com> wrote in message news:7k3fi7$m63$1_at_ffx2nh4.news.uu.net...
> I'm new to the Oracle world and have a question regarding how do I test my
> functions & stored procedures in PL/SQL?
> Here's the situation:
> I have a function called sp_test that accepts input parameters
> testnum1,testchar2,testchar3,testnum4 and returns a number returnnum.
>
> how do I declare my variables and call this function in PL/SQL so I get my
> returnnum back into my local variable?
>
> In Sybase I'd do something like this
>
> declare testnum1 integer;
> declare testchar2 varchar(20);
> declare testchar3 varchar(40);
> declare testnum4 integer;
> declare returnnum integer;
>
> select testnum1=1;
> select testchar2='test';
> select testchar3=test test';
> select testnum4=4;
>
> exec returnnum=sp_test(testnum1,testchar2,testchar3,testnum4);
> select returnnum; - this would display my returnnum value
>
> Thanks in advance,
> Terry
>
> Terry Sharp, Data Architect
> tsharp_at_witsys.com
>
>
Received on Tue Jun 15 1999 - 17:02:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US