| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> Re: user interaction in pl/sql
Hans Forbrich <forbrich_at_yahoo.net> wrote in message news:<PXDdc.26544$J56.21293_at_edtnps89>...
> niranjan v sathe wrote:
>
> > Hans Forbrich <forbrich_at_yahoo.net> wrote in message
> >
> > you can try with colon (:variablename) in pl-sql. This should prompt for a
> > value.
>
> Not unless you are in SQL*Plus (or iSQLPlus). And even then, you must set
> it up right.
Try an Ampersand "&" ... it's about the closest you can get to prompting while in PL/SQL ... but as Jim pointed out, you can't do the "prompt" in pl/sql ..
Here's the difference (both run on Unix O/S):
SQL*Plus:
accept happy prompt "Are You Happy Today? (Y/N) "
select something
from somewhere
where some_column = '&happy'
/
declare
lv_happy varchar2(1) := upper(ltrim(substr(nvl('&happy', 'N'), 1,
1)));
begin
declare
lv_happy varchar2(1) := upper(ltrim(substr(nvl('&areyouhappy',
'N'), 1, 1)));
begin
The Elementalist Received on Tue Apr 13 2004 - 16:12:33 CDT
![]() |
![]() |