Sqlplus is a common development tool for Oracle databases. Common commands in sqlplus are as follows.
1. Connection command
(1). Conn [ect]
Usage: conn username/password @ network service name [as sysdba/sysoper]. When connecting with a privileged user identity, you must include as sysdba or as sysoper.
(2). Disc [onnect]
Note: This command is used to disconnect from the current database.
(3). psssw [ord]
Note: This command is used to modify the password of a user. If you want to change the password of another user, You need to log on to the system using sys/system.
(4). Show user
Description: displays the current user name.
(5). Exit
Note: This command will disconnect the database and exit SQL * Plus.
2. File Operation commands
(1). Start and @
Run the SQL script.
Case: SQL> @ D:/a. SQL or SQL> Start D:/a. SQL.
(2). Edit
Note: You can edit the specified SQL script.
Case: SQL> edit D:/a. SQL. This will open the file D:/a. SQL.
(3). Spool
Note: This command can output the content on the SQL * Plus screen to a specified file.
Case: SQL> spool D:/B. SQL and enter SQL> spool off.
3. Interactive commands
(1 ).&
Note: This variable can be used as an alternative, and must be input during execution.
Select * from EMP where job = '& job ';
4. Display and set Environment Variables
Overview: Set show can be used to control various output formats. If you want to permanently save related settings, you can modify the glogin. SQL script.
(1). linesize
Description: sets the display line width. The default value is 80 characters.
Show linesize
Set linesize 90
(2). pagesize
Note: set the number of rows displayed on each page. The default value is 14.
The usage is the same as linesize.
The usage of other environment parameters is similar.