Save sql command to files and run the sql command

cms technology web page configuration drupal web site

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:

sql script comment

 

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>

 


Custom Search