Save sql command to files and run the sql command

SAVE TO TEMP LOCATION
SQL> select deptno as "DEPartmet", loc as "LOCation" from dept where deptno = 30
2
[Press ENter key two time without executing the sql command]
then list the last command execute...
SQL> list
1* select deptno as "DEPartmet", loc as "LOCation" from dept where deptno = 30
To save the sql command to files use save command and follow with the filename to store your command.
SQL> save departmentlocation.sql
SP2-0540: File "departmentlocation.sql" already exists.
Use "SAVE filename[.ext] REPLACE".
SQL> save departmentlocation.sql replace
Wrote file departmentlocation.sql
SQL> edit departmentlocation.sql
SQL> run departmentlocation.sql
1* select deptno as "DEPartmet", loc as "LOCation" from dept where deptno = 30
DEPartmet LOCation
---------- -------------
30 CHICAGO
SQL>
We can use single line or multi-line comment for your code or sql script:
example:

AFTER SQL RESTARTED YOU NEED TO USE THE:
 To reload and run
SQL> start departmentlocation.sql
1* select deptno as "DEPartmet", loc as "LOCation" from dept where deptno = 30
DEPartmet LOCation
---------- -------------
30 CHICAGO
SQL>
- sql_command's blog
- Add new comment
- 1139 reads

Recent comments
15 hours 35 min ago
1 day 17 hours ago
2 days 21 hours ago
3 days 35 min ago
3 days 13 hours ago
4 days 18 hours ago
2 weeks 2 days ago
2 weeks 3 days ago
2 weeks 3 days ago
2 weeks 3 days ago