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

Home -> Community -> Usenet -> c.d.o.misc -> Re: returning the value of a variable...?

Re: returning the value of a variable...?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Wed, 12 May 1999 15:01:26 GMT
Message-ID: <3739976f.1760301@192.86.155.100>


A copy of this was sent to "Jason K McCann" <jkm_at_reclaimtech.com> (if that email address didn't require changing) On Tue, 11 May 1999 11:37:53 -0400, you wrote:

>In Oracle8 I simply need to return the value of a variable - how do I do
>that in a test run of my code? I'm coming from T-SQL where, if I had
>declared a variable named @v_somenumber, I could issue a 'select
>@v_somenumber' and I would have its value returned. How do I do that in
>PL/SQL?
>
>TIA
>Jason K McCann
>jkm_at_reclaimtech.com
>
>

create or replace procedure my_procedure( p_somenumber OUT number ) as
begin

   ...
   p_somenumber := 5;
end;

or

create or replace function my_function return number as
  l_somenumber number;
begin

   ....

  return l_somenumber;
end;

or, if you want to return it as a result set, you would use a REF CURSOR and return it after opening the query "open your_ref_cursor as select l_somenumber from dual;"

See http://www.oracle.com/ideveloper/ for my column 'Digging-in to Oracle8i'...  

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 Wed May 12 1999 - 10:01:26 CDT

Original text of this message

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