Skip to Main Content
  • Questions
  • conditional logic and keyboard input with sql*plus and pl/sql

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Rick.

Asked: April 14, 2008 - 12:31 pm UTC

Last updated: April 16, 2008 - 7:10 am UTC

Version: 10.1.0

Viewed 1000+ times

You Asked

I need to create an application to offer a main menu, accept an option from the keyboard, and then offer submenus as needed until I can perform dml on any of 5 tables. The available tools are sql*plus and pl/sql. I know how to use accept/prompt in sqlplus and how to use conditional logic in pl/sql. What I don¿t know is how to put them together. Once I invoke pl/sql to act on the response to the first menu, I haven¿t been able to get back into sqlplus to offer submenus, etc.

Is there a way to do this?

and Tom said...

You will never be successful here.


First of all - PLSQL runs *in the server*, when you submit a plsql block - it goes off to the server and stays there until it is complete. PLSQL (in the database - not talking about forms here at all) cannot in any way shape or form interact with an end user


SQL*Plus is a very very very simple command line tool for running very very simple interactive queries. It is what it is - nothing more, nothing less. It is NOT an application development environment - not even a little bit. It is good for running a script. It stinks for interacting with end users.

To attempt to do DML (modify data! modify data!) in this fashion is nothing you want to even consider pursuing - this will not be successful. At best you'll get a bunch of unmaintainable scripts that corrupt your data (because tying this all together is not really possible or practical)

Please - look at any of the thousands of real application tools. for example, you have access to APEX (application express) and everyone has a web browser.

http://apex.oracle.com/

for a 'demo' and to play with it.

Is this answer out of date? If it is, please let us know via a Comment