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: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 14 Jun 1999 18:34:24 GMT
Message-ID: <37724af3.23121426@newshost.us.oracle.com>


A copy of this was sent to "Terry Sharp" <tsharp_at_witsys.com> (if that email address didn't require changing) On Mon, 14 Jun 1999 13:53:13 -0400, you wrote:

>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
>

SQL> variable returnnum number
SQL> exec :returnnum := sp_test( testnum1, testchar2, testchar3, testnum4 )
SQL> print returnnum

is one way, another is:

SQL> set serveroutput on
SQL> exec dbms_output.put_line( sp_test( testnum1, testchar2, testchar3, testnum4 ) );

>Thanks in advance,
>Terry
>
>Terry Sharp, Data Architect
>tsharp_at_witsys.com
>

See http://www.oracle.com/ideveloper/ for my column 'Digging-in to Oracle8i'... Mirrored (and more current) at http://govt.us.oracle.com/~tkyte/

Current article is "Fine Grained Access Control", added June 8'th  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA
--
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Jun 14 1999 - 13:34:24 CDT

Original text of this message

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