Oracle entry command

Source: Internet
Author: User

Oracle entry command
Basic commands:
1. the spool command is used to screen recording in sqlplus.
Spool c: \ 1.txt automatically creates 1.txt, screen recording

Spool c: \ 1.txt append
Add to 1.txt

2. conn system/orcl switch user connection
3. -- meaning of the comment
4. exit
5. Clear screen: host cls;
6. Change the password:
// Change the password of the system user to system
Alter user system identified by system;
Alter user identified by is a keyword.

You can use
Sqlplus sys/aaa as sysdba; -- Log On as the database administrator.
You can enter the password at will.

7. Modify the SQL statement:
(1) run the c command
C/alert/alter (incorrect statement/pair Statement)
>/----/Run the previous command
User modified
(2) Modify through ed --- professional modification method
> Ed
Pop up Notepad to modify
8. Unlock: hr is the user name
Alter user hr account unlock;
9. show all display all commands
10. distinct is an important part of repeated rows.
11. set timing on; set the execution time
12. set timing off; time when the execution is canceled
13. set feedback off. When you cancel execution, the number of rows selected is displayed.
14. set feedback on; displays the number of rows selected during execution.
15. set heading off; cancel the header information of the field
16. set heading on; displays the header information of the field.
17. set trimout on;
18. set trimout off;

Ii. query table:
1. select * from tabs; query system table
2. select table_name from user_tables; Name of the table under the current user
3. desc table name query table structure
4. set linesize 120 to set the Row Height
5. col name for 9999 characters --- set the length of the stack bit
--- Col sal for 9999 (stack bit length)
6. The default length of set pagesize is 14.
7. set pagesize 0 indicates that there is no limit on the current display. pagination is prohibited.
8. show all to view some default oracle configurations
9. select * from tab to query all tables
10. select ename, job from emp; select the specified row
11. select sal * 12 from emp; operator operation
12. select sal * 12 + nvl (comm, 0) from emp; replace null with 0
13. filter conditions
-The use of the where clause, coupled with filtering conditions, must be followed by the from Table Name
SQL> -- where syntax select * | {distinct | express | clomn} from table name where filter Condition
Select * from emp where deptno = 20;
Select empno from emp where Deton = 20
Select * from emp where job = 'cler ';
Select * from emp where hiredate = '17-August-80'

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.