Re: user interaction in pl/sql
Date: Fri, 9 Apr 2004 16:38:49 -0400
Message-ID: <2_ydnZXJvah5lOrdRVn-hA_at_comcast.com>
"niranjan v sathe" <satheniranjan_at_yahoo.com> wrote in message
news:c3fae289.0404090915.3ac8e1c4_at_posting.google.com...
| Hans Forbrich <forbrich_at_yahoo.net> wrote in message
news:<pKndc.23709$J56.18035_at_edtnps89>...
| > DottingTheNet wrote:
| >
| > > hi!!
| > > just wanna know how to accept user input??
| > > if i prompt a question "Are u happy today?(Y/N)"
| > > how do i receive user's answer?
| > > thnx
| >
| > Counter-question - if the database is on a server, and the pl/sql is run
in
| > the database, where is the answer coming from?
| >
| > You might want to give some hint of the environment you are running.
Are
| > you displaying in a browser or in SQL Plus?
|
| you can try with colon (:variablename) in pl-sql. This should prompt for a
value.
not exactly... if you're submitting anonymous pl/sql blocks, some tools may notice the bind variable and prompt for it, but SQL*Plus will not automatically prompt for bind variable
SQL> begin
2 dbms_output.put_line('A bind variable... ' || : x );
3 end;
4 /
SP2-0552: Bind variable "X" not declared.
additionally, stored PL/SQL program units will not compile with bind variables
SQL> create or replace procedure bindx
2 is
3 begin
4 dbms_output.put_line('A bind variable... ' || : x );
5 end;
6 /
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE BINDX:
...
LINE/COL ERROR
-------- ----------------------------------------------------------------- 4/50 PLS-00103: Encountered the symbol ":" when expecting one of the following: ( - + mod null <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg count current max min prior sql stddev sum variance execute forall time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> The symbol ":" was ignored.
;-{ mcs Received on Fri Apr 09 2004 - 22:38:49 CEST