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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL PLUS question

Re: SQL PLUS question

From: eandrews <eandrews_at_usa.net>
Date: Thu, 8 Mar 2001 23:05:18 -0500
Message-ID: <tagljm4prflffb@corp.supernews.com>

You are correct about returning a single value but it MUST return a value or it will cause an error.

"Brian Tkatch" <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK> wrote in message news:3a9bb8d8.343933234_at_news.alt.net...
> On 27 Feb 2001 07:34:46 GMT, "jAnO!" <j.j.groot_at_kpn.com> wrote:
>
> >
> >Brian Tkatch <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK> schreef
 in
> >artikel <3a9a88cf.266100765_at_news.alt.net>...
> >> You can declare a variable in SQLPLUS with the variable command. The
> >> PRINT command will show you what the variable equals.
> >>
> >> VARIABLE MyVar VARCHAR2
> >> PRINT MyVar
> >>
> >> And do not use ERROR as a variable. It won't work. I found out the
> >> hard way. :-(
> >
> >Thank you, but i want to know how to fill that parameter with the result
 of
> >a query....
>
> By using the EXECUTE command.
>
> VAR MyVar NUMBER
> EXECUTE SELECT Id INTO :MyVar WHERE <whereclause>;
> PRINT MyVar
>
> I believe the query can only return one result to not cause an error.
> Otherwise, you'd have to usen a cursor.
>
> The docs are also on the CDs. If you have them, you, may want to look
> for them.
>
> Brian
Received on Thu Mar 08 2001 - 22:05:18 CST

Original text of this message

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