Common Oracle commands
1. Connect to the database
Connect user name/Password
Example: connect Scott/tiger; equivalent to conn Scott/tiger;
2. Disconnect
Disconnect is equivalent to disconn;
3. Change the user's password
Password is used to change the password of a user. If you want to change the password of another user, you need to use sys or system to log on;
Example:
① Change the password of the Login User Name
Password press ENTER
Enter the old password and press enter as prompted;
② Change the password of another user name
Password username press ENTER
Enter the old user password and press enter as prompted;
4. display the Login User Name
Show user;
5. Exit Oracle SQL * Plus
Exit;
Vi. File Operation commands
① Execute the SQL statement in the file
In the root directory of drive D, there is an AA. SQL file with the content select * from EMP;
Example: Start D: \ AA. SQL Press enter. The output result is displayed.
Equivalent to @ D: \ AA. SQL carriage return;
② Editing files
Edit D: \ AA. SQL enter; you can edit it in the text editor.
③ Save the content on the screen to a file
Example: requirement: Select * from EMP; Save the output result to the BB. SQL file in the root directory of drive D;
Spool D:, BB. SQL;
Select * from EMP;
Spool off;
You can open the BB. SQL file on disk D, and the output results on the screen will be saved in this file;
7. input parameters on the keyboard to obtain the output result.
Example: Select * from EMP where ename = & name;
Press enter to jump out of the dialog box and enter the condition value to get the query result;
8. Set and display environment variables
① Display the row width. The default value is 80 characters.
Show linesize;
② Set the row width
Set linesize 120;
③ Number of display pages
Show pagesize;
④ Set the number of pages
Set pagesize 4;
Welcome to my website: www.yehuchina.org