Home » SQL & PL/SQL » SQL & PL/SQL » v8.0: doing a MENU how to stop Oracle on the input value ?
v8.0: doing a MENU how to stop Oracle on the input value ? [message #8924] Fri, 03 October 2003 08:43 Go to next message
Gerald
Messages: 54
Registered: January 2001
Member
Dears,

I'm doing a menu with PL/SQL.
I want someting like that

Administration's toy :
----------------------
1- Analyse all the Tables.
2- Defragment the Tablespaces.
3- Drop all the CLONES.

Enter your Choice ? :

i've "set pause on" in order to stop the beast on its run ...
i've try this, because CASE do not exists for 8.0:

set pause on
undef choix1;
begiN
If &&choix1=1 THEN
[[DECLARE
BEGIN {Statement for Analyse}
END;]]
end IF;
IF &&choix1=2 THEN

[[DECLARE
BEGIN {Statement for Defragmentation}
END;]]
end IF;
IF &&choix1=3 THEN

[[DECLARE
BEGIN {Statement for Drop}
END;]]
end IF;
PAUSE
end;
/

prompt TEST FOR the following of the script
prompt Script will do some selects
prompt will launch some other scripts

But it failed
Re: my solution ... who is the mad who wrote ELSIF instead of ELSEIF ? [message #8992 is a reply to message #8924] Thu, 09 October 2003 08:54 Go to previous message
Gerald
Messages: 54
Registered: January 2001
Member
undef choix;
set serveroutput on
set feed on
set term on

declare
temp number;

Begin

temp := &&choix;
IF temp = 1 then
DBMS_OUTPUT.PUT_LINE('choix 1');
ELSIF temp = 2 then
DBMS_OUTPUT.PUT_LINE('choix 2');
ELSIF temp = 3 then
DBMS_OUTPUT.PUT_LINE('choix 3');
END IF;
END;
/
Previous Topic: Problem when function Return Datatype is Boolean
Next Topic: divide the values of 2 sql statements
Goto Forum:
  


Current Time: Thu Apr 25 12:29:52 CDT 2024