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: simple questions

Re: simple questions

From: aquabubble <aquabubble_at_geocities.com>
Date: Mon, 15 Nov 1999 16:38:38 GMT
Message-ID: <80pcud$8ci$1@nnrp1.deja.com>


In article <80p5jc$2ek$1_at_nnrp1.deja.com>,   aquabubble <aquabubble_at_geocities.com> wrote:
> In article <80ouoo$6p8$1_at_news.hk.linkage.net>,
> "Alan Sze" <alan_at_icon.com.hk> wrote:
> >
> > The SELECT .... FROM dual doesn't work for me...
> > How to declare a variable in sqlplus so that I can use var_a :=
> > package_a.function_a(....) ???
>
> You can use DEFINE var_a = <value> at the SQL*Plus prompt, where
> <value> can be a character string (enclosed by single quotes), or a
> number.
>
> You can then reference this in your SELECT ... FROM dual as a bind
> variable :var_a (I think this is right, but I'm away from machine at
> the moment).
>
> Alternatively, you could try using an anonymous block.

I see Thomas has shown the anonymous block method, although you need dbms_output.enable d before the put_line if it hasn't been done already. If you are unhappy with the anonymous block, you can use my method above, but to correct myself you should use:

SELECT pkg.prc('&var_a', ...) FROM dual;

You can't select into a DEFINEd variable in SQL*Plus, so if you really need to do this the only option is anonymous blocks.

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Nov 15 1999 - 10:38:38 CST

Original text of this message

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