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: Newbie Question about USER Input

Re: Newbie Question about USER Input

From: Sybrand Bakker <gooiditweg_at_sybrandb.demon.nl>
Date: Sat, 19 Oct 2002 18:51:17 +0200
Message-ID: <a733rustdruahtrtqjd79kpddbsm7ct80k@4ax.com>


On Sat, 19 Oct 2002 16:00:19 GMT, "news.verizon.net" <never_at_nope.com> wrote:

>To all,
> I would like to create a procedure that gets a value from the user and
>uses that value in an IF-THEN-ELSE statement.
>
>set serveroutput on;
>
>declare
> user_x char(1);
>begin
> &user_x;
> Upper('user_x');
>
> if user_x = 'A' then
> dbms_output.put_line('A');
> elsif user_x = 'B' then
> dbms_output.put_line('B');
> else
> dbms_output.put_line('Bad selection');
>End;
>/
>

You are not creating a procedure but an anonymous block (which is something completely different.

Your code needs to read

set serveroutput on;
>

declare

    user_y char(1);
begin

      select upper('&user_x')
      into user_y
      from dual;

    if user_y = 'A' then
      dbms_output.put_line('A');
    elsif user_y = 'B' then
      dbms_output.put_line('B');
    else
      dbms_output.put_line('Bad selection');
End;
/

Regards

Sybrand Bakker, Senior Oracle DBA

To reply remove -verwijderdit from my e-mail address Received on Sat Oct 19 2002 - 11:51:17 CDT

Original text of this message

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