Collections:
Revise and Rerun the Last SQL Command in Oracle
How To Revise and Re-Run the Last SQL Command in Oracle?
✍: FYIcenter.com
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.
⇒ SQL*Plus Commands Stored in a File in Oracle
⇐ Input Buffer in SQL*Plus in Oracle
2020-07-15, 2500🔥, 0💬
Popular Posts:
How To Create a Dynamic Cursor with the DYNAMIC Option in SQL Server Transact-SQL? If the underlying...
How to continue to the next iteration of a WHILE loop in SQL Server Transact-SQL? How to use CONTINU...
How To Get Year, Month and Day Out of DATETIME Values in SQL Server Transact-SQL? You can use DATEPA...
How To Provide Default Values to Function Parameters in SQL Server Transact-SQL? If you add a parame...
How to continue to the next iteration of a WHILE loop in SQL Server Transact-SQL? How to use CONTINU...