Editing commands at the SQL> prompt

When executing commands at the SQL prompt, do you ever find (either before or after typing the SQL in) that you entered something wrong?  If you thought the only way two ways to fix the problem was to [1] retype the the SQL statement or [2] edit the command using the EDIT command, then you are mistaken.  Here's an example of the way I often fix problems.
 
Wrong SQL Right SQL
select decode(to_char(sysdate,'YYYY'),'1998') select decode(to_char(sysdate,'YYYY'),'1998',1)
from dual; from dual;

See what's wrong  on the Wrong SQL side?  The action that's done if the Year does match '1998' is not specified!  Executing this would result in a run-time error.  The Right SQL side shows the addition of an action.  So if the year did match '1998', then a '1' would be the result of executing this SQL statement.  Here are the steps that I would take to fix this problem:
 
Since the problem is on line 1, at the SQL> prompt, enter the command 1 and then press 
The line '1* select decode(to_char(sysdate,'YYYY'),'1998')' will appear and you will be back at a SQL> prompt
Type c/1998')/1998',1 and then press .  At the SQL> prompt, enter a '/' to run your command correctly

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Application
Oracle Application Hints and Tips

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.