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: How to refer to a session variable in a PLSQL- Package

Re: How to refer to a session variable in a PLSQL- Package

From: Ed prochak <ed.prochak_at_alltel.com>
Date: 8 Nov 2001 07:17:11 -0800
Message-ID: <e51b160.0111080717.443a8256@posting.google.com>


sc2ch_at_yahoo.de (chollet) wrote in message news:<f3d44148.0111080319.7396a322_at_posting.google.com>...
> Hi everybody
>
> The following Script is running perfectly:
>
> set verify on
> set serveroutput on size 500000
> define foo = upper
>
> declare
> c_nr number(08);
> c_value varchar2(50);
> cursor c1 is
> select nr, name
> from client
> where &foo(name) = &foo('Name_Sample');
> begin
> open c1;
> loop
> fetch c1 into c_nr, c_value;
> exit when c1%notfound;
> dbms_output.put_line('Name: '||c_nr||'/'||c_value);
> end loop;
> close c1;
> end;
>
> ---
> But how is it possible to refer to the session-variable 'foo' within a
> plsql package on the db?
>
> Any tips or tricks are highly appriciated.
>
> Thanks Steve

In a package you have procedures and functions, so just pass it into perhaps an open procedure. That procedure stores the value in a package variable for the rest of the package to use. So to use the package, you call that open procedure. from SQLplus it looks like this:

set verify on
set serveroutput on size 500000
define foo = upper

exec packagename.my_open( &foo );

< call other package procedures here > Received on Thu Nov 08 2001 - 09:17:11 CST

Original text of this message

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