Pseudocolumn: A pseudo-column behaves like a table column but is not actually stored in the table. You can select from pseudo-columns, but you cannot insert, update, or delete their values. A pseudo-column is also similar to a function without arguments. This section describes these pseudo-columns:
- CURRVAL and NEXTVAL
- CURRVAL and NEXTVAL: A sequence is a schema object that can generate unique sequential values. These values are often used for primary and unique keys. You can refer to sequence values in SQL statements with these pseudocolumns:
- CURRVAL : Returns the current value of a sequence.
- NEXTVAL : Increments the sequence and returns the next value.
SELECT STUDENTSEQ.currval FROM DUAL;
INSERT INTO STUDENT VALUES (STUDENTSEQ.nextval, ‘BISHAL’, ‘JAVA’, 7902);
- LEVEL:For each row returned by a hierarchical query, the LEVEL pseudocolumn returns 1 for a root node, 2 for a child of a root, and so on.
ROWNUM: Oracle engine maintains the number of each record inserted by users in table. By the help of ROWNUM clause we can access the data according to the record inserted.
SELECT * FROM EMP WHERE ROWNUM <= 3;
ROWID:For each row in the database, the ROWID pseudocolumn returns a row\’s address. The ROWID contains 3 information about row address:
- FileNo : FileNo means Table Number.
- DataBlockNo : DataBlockNo means the space assigned by the oracle sql engine to save the record.
- RecordNo : Oracle engine mantains the record number for each record.
SELECT ROWID, ename FROM emp WHERE deptno = 20;
- Comparisons between Oracle vs SQL Server
- Check if Table, View, Trigger, etc present in Oracle
- SELECT INTO statement in SQL
- Pivot and Unpivot in SQL
- Common error in Group By
- Categories of SQL Functions
- Query to find 2nd largest value in a column in Table
- SQL vs NoSQL: Which one is better to use?
- What are the Best Ways to Write a SQL Query?
- Mathematical functions in MySQL
- MySQL | Ranking Functions
- MySQL | DEFAULT() Function
- MySQL | Recursive CTE (Common Table Expressions)
- MySQL | Group_CONCAT() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.