How to use previously executed commands in SQL Plus.?
Is there any i can save my SQL Plus executed commands to use them later.
Posted Answers
You cannot evoke statements once they have been submitted to SQL*Plus. To solve this, you can use default SQL Plus command i.e. ED, this command will allow you to edit buffered SQL Plus command in your computer’s default editor. After you saved your changes, you can resubmit the statement with “/”.
Please note that only the last used SQL Plus command may be edited. A good practical approach is not to inadvertently lose your SQL work is to use command files.
1. Open your default editor and type your SQL statement in it.
2. Then save the file with the extension (.sql) in your home directory. You have to make sure that you saved file with the .sql extension as some editors attempt to append .txt extension after .sql.
3. After saving your file open SQL Plus, and type “@yourfile” at the SQL Plus command prompt to execute your SQL statement. Please don’t remember to replace “yourfile” with your saved file name.
This way you can save your executed commands in SQL for later use.
Answer by: Anonymous
