Oracle Dual table

Source: Internet
Author: User

Oracle is still quite common, So I studied the Oracle Dual table and shared it with you here. I hope it will be useful to you. Character functions include conversion functions and character operation functions.

Conversion functions include LOWER, UPPER, and INITCAP (uppercase)

Character operation function: CONCAT, SUBSTR, LENGTH, INSTR (position of a string in this string), IPAD string is displayed in a certain format );
For example:

 
 
  1. Select initcap (ename) from emp;
  2. // Return all the names and upper-case letters.
  3. Select concat (ename, job) from emp;
  4. // Return a column consisting of ename and job.
  5. Select initcap (substr (ename, 1, 3) from emp;
  6. // Return a column, which is a string of a column.
  7. Select length ('I love you') from dual;
  8. // 3 is returned. both letters and Chinese characters are stored in two bytes.
  9. Select lpad (ename, 10, '*') from emp;
  10. // The returned name. If there are less than 10 names, use * to complete the query.

2: Internal Oracle storage is in the upper-write format.
For example:

 
 
  1. Select * from emp whereEname='King';
  2. // No results found
  3. Select * from emp whereEname=Upper('King ');
  4. // Check and find the matching results.

3: Oracle Dual table
The Oracle Dual table is special. It is a system table with only one Dummy Varchar2 (1) field, and Oracle tries its best to ensure that it returns only one record. When querying system values such as sysdate or sequence. currval in Oracle, you must write Dual in the Select statement. For example, select sysdate from dual. Use the Dual table to query data that does not have a specific user table.

In fact, each table has a hidden rowid, which is available in all tables except dual ).

Dual can be inserted and deleted. It is recommended that you do not delete the table, which may cause the database to fail to start. If you delete the file by mistake, set replication_dependency_tracking to FALSE ).

Dual should be a virtual table in the system memory, while the dual table in the system is only used to maintain the data dictionary and the system's operation permissions on dual. In the following experiment, insert several records to the Oracle Dual table and query them:

 
 
  1. SQL> select * from dual;  
  2. D  
  3. -  
  4. X  
  5. SQL> select rowid ,dummy from dual;  
  6. ROWID              D  
  7. ------------------ -  
  8. AAAM1CAABAAAAgiAAA X  
  9. SQL> select rowid ,dummy from dual order by dummy;  
  10. ROWID              D  
  11. ------------------ -  
  12. AAAM1CAABAAAAgiAAA X  
  13. AAAM1CAABAAAAgiAAB Y  
  14. AAAM1CAABAAAAgiAAC Y  
  15. AAAM1CAABAAAAgiAAD Z 
  1. Redo Oracle log files
  2. High theory of Oracle Buffer Optimization
  3. Oracle CPU usage Optimization
  4. Overview operating system Oracle Optimization
  5. How Oracle reduces Shared Server Processes

Related Article

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.