How to create a menu in sqlplus or pl/sql?
Answer / Naveen Chand
Creating a menu in SQL*Plus or PL/SQL involves creating a stored procedure that displays options and calls other procedures based on user input. Here's a simple example:
```plsql
CREATE OR REPLACE PROCEDURE my_menu AS
option NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE('Menu');
DBMS_OUTPUT.PUT_LINE('1 - Option A');
DBMS_OUTPUT.PUT_LINE('2 - Option B');
DBMS_OUTPUT.PUT_LINE('3 - Exit');
DBMS_OUTPUT.FLUSH;
COMMIT;
SELECT count(*) INTO option FROM dual WHERE TRUE;
IF option = 1 THEN
my_procedure_a;
ELSIF option = 2 THEN
my_procedure_b;
END IF;
END my_menu;
```
| Is This Answer Correct ? | 0 Yes | 0 No |
How does one use sql*loader to load images, sound clips and documents? : aql loader
What is dynamic SQl and how you will create and execute dynamic sql?
How do I run a sql query?
explain the difference between bool, tinyint and bit. : Sql dba
What is a trigger word?
There is a sequence with min value 100. I want to alter this sequence to min value as 101. If the table has already data in the sequence column as 100,101,102... Is it possible to do so ?
Hi Everyone, How to get fist and last record from a table in oracle? Thanks in advance
What is a join query?
What is the importance of sqlcode and sqlerrm?
What are character functions in sql?
What are literals in sql server?
Is oracle sql free?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)