Basic Oracle Tutorial: SQLPLUS Environment command. Commonly Used commands of sqlplus when an SQL statement is entered, SQL is cached in SQLPLUS. This cache is small and only one SQL statement can be allowed.
Basic Oracle Tutorial: SQLPLUS Environment command. Commonly Used commands of sqlplus when an SQL statement is entered, SQL is cached in SQLPLUS. This cache is small and only one SQL statement can be allowed.
Common sqlplus commands
When an SQL statement is entered, the SQL statement is in the cache of SQLPLUS. The cache is small and only one SQL statement is allowed. When the next SQL statement is entered, the previous SQL statement is overwritten.
To more effectively input and edit SQL statements, SQLPLUS provides some common commands. Compared with SQL statements, the commands in SQLPLUS can be abbreviated.
View All commands in sqlplus
Help index
View the help of a command in sqlplus
Help cmd
Show all lists all current parameter values
Set line [size] {80 | n}
Set the display width. The default value is 80 n, which can be customized.
Set line 100
L list the content of the Current Buffer
N integer. The specified row number in the buffer.
C/OLD/NEW Replace the NEW part. If it is not written, it means deletion.
/Or r run
A. The Append content is generally equal to n.
Del n deletes the entire row of row n
1. input error correction method 1:
Seker> select ename, sal
2 from emq
3 where sal <= 1000;
From emq
*
ERROR at line 2:
ORA-00942: table or view does not exist
Input error found after execution
Seker> l
1 select ename, sal
2 from emq
3 * where sal <= 1000
L list the command list and find that 2nd lines of emp are written as emq.
Seker> 2
2 * from emq
N command to extract the specified line
Seker> c/q/p
2 * from emp
C/OLD/NEW replacement
Seker> l
1 select ename, sal
2 from emp
3 * where sal <= 1000
View the Current Buffer list
Seker>/
ENAME SAL
--------------------
The SMITH 800
JAMES 950
Seker>
/Execute the command of the Current Buffer
2. input error correction method 2:
Seker> select ename, sal
2 from emq
3 where sal <= 1000;
From emq
*
ERROR at line 2:
ORA-00942: table or view does not exist
Input error found after execution
Seker> l
1 select ename, sal
2 from emq
3 * where sal <= 1000
L list the command list and find that 2nd lines of emp are written as emq.
Seker> 2 from emp
N text command to modify the content of a specified line
Seker> r
1 select ename, sal
2 from emp
3 * where sal <= 1000
ENAME SAL
--------------------
The SMITH 800
JAMES 950
Seker>
R: Execute the Current Buffer command
A append operation
Seker> l
1 select ename, sal
2 from emp
3 * where sal <= 1000
Seker> 1
1 * select ename, sal
Seker> a, job, deptno
1 * select ename, sal, job, deptno
Seker> l
1 select ename, sal, job, deptno
2 from emp
3 * where sal <= 1000
Seker>/
ENAME SAL JOB DEPTNO
---------------------------------------
SMITH 800 CLERK 20
JAMES 950 cler30
Seker>
The del n command cannot be abbreviated as d.
Idle> l
1 select ename, sal, job, deptno
2 from emp
3 * where sal <= 1000
Idle> d 3
SP2-0042: unknown command "d 3"-rest of line ignored.
Idle> del 3
Idle> l
1 select ename, sal, job, deptno
2 * from emp
Idle>
Save the content of the current buffer to another file
Idle> l
1 select ename, sal, job, deptno
2 * from emp
Idle> save abc. SQL
Created file abc. SQL
Idle> host ls
Abc. SQL afiedt. buf Oracle sqlnet. log
Idle>! Cat abc. SQL
Select ename, sal, job, deptno
From emp
/
Idle>
Load the statements in the file to the buffer
Idle> l
1 * select * from emp
Idle> get abc. SQL
1 select ename, sal, job, deptno
2 * from emp
Idle> l
1 select ename, sal, job, deptno
2 * from emp
Idle>
,