Home >> FAQs/Tutorials >> Oracle Tutorials

Oracle Tutorials - Revise and Rerun the Last SQL Command

By: FYIcenter.com

(Continued from previous topic...)

How To Revise and Re-Run the Last SQL Command?

If executed a long SQL statement, found a mistake in the statement, and you don't want enter that long statement again, you can use the input buffer commands to the correct last statement and re-run it. The following tutorial exercise gives you a good example:

SQL> connect HR/retneciyf

SQL> SELECT FIRST_NAME, LAST_NAME, HIRE_DATE
  2  FROM EMPLOYEE WHERE FIRST_NAME LIKE 'Joh%';
FROM EMPLOYEE WHERE FIRST_NAME LIKE 'Joh%'
     *
ERROR at line 2:
ORA-00942: table or view does not exist

SQL> LIST
  1  SELECT FIRST_NAME, LAST_NAME, HIRE_DATE
  2* FROM EMPLOYEES WHERE FIRST_NAME LIKE 'Joh%'

SQL> CHANGE /EMPLOYEE/EMPLOYEES/
  2* FROM EMPLOYEES WHERE FIRST_NAME LIKE 'Joh%'

SQL> RUN
(Query output)

SQL> INPUT ORDER BY FIRE_DATE
SQL> LIST
  1  SELECT FIRST_NAME, LAST_NAME, HIRE_DATE
  2  FROM EMPLOYEE WHERE FIRST_NAME LIKE 'Joh%'
  3* ORDER BY HIRE_DATE

SQL> RUN
(Query output)

SQL> CLEAR BUFFER
buffer cleared

SQL> LIST
SP2-0223: No lines in SQL buffer.

(Continued on next topic...)

  1. What Is SQL*Plus?
  2. How To Start the Command-Line SQL*Plus?
  3. How To Get Help at the SQL Prompt?
  4. What Information Is Needed to Connect SQL*Plus an Oracle Server?
  5. What Is a Connect Identifier?
  6. How To Connect a SQL*Plus Session to an Oracle Server?
  7. What Happens If You Use a Wrong Connect Identifier?
  8. What To Do If DBA Lost the SYSTEM Password?
  9. What Types of Commands Can Be Executed in SQL*Plus?
  10. How To Run SQL Commands in SQL*Plus?
  11. How To Run PL/SQL Statements in SQL*Plus?
  12. How To Change SQL*Plus System Settings?
  13. How To Look at the Current SQL*Plus System Settings?
  14. What Are SQL*Plus Environment Variables?
  15. How To Generate Query Output in HTML Format?
  16. What Is Output Spooling in SQL*Plus?
  17. How To Save Query Output to a Local File?
  18. What Is Input Buffer in SQL*Plus?
  19. How To Revise and Re-Run the Last SQL Command?
  20. How Run SQL*Plus Commands That Are Stored in a Local File?
  21. How To Use SQL*Plus Built-in Timers?
  22. What Is Oracle Server Autotrace?
  23. How To Set Up Autotrace for a User Account?
  24. How To Get Execution Path Reports on Query Statements?
  25. How To Get Execution Statistics Reports on Query Statements?

Oracle Tutorials:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...