Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Wednesday, 6 August 2014

Pseudo Columns in Oracle

Pseudo columns:-

Pseudo columns are the system defined columns of oracle which we can access at a run time.
There are different types of pseudo column, out of which we will see top 10 mostly use pseudo columns:-
 
SYSDATE:-

1)    SELECT SYSDATE FROM DUAL;

SYSTIMESTAMP:-

2)    SELECT SYSTIMESTAMP FROM DUAL;

ROWNUM:-

3)    SELECT ROWNUM FROM EMPLOYEE WHERE ROWNUM <=5;

ROWID:-

4)    SELECT ROWID FROM EMPLOYEE WHERE ROWNUM<5;

NEXTVAL:-

CREATE SEQUENCE SEC_TEST;

5)    SELECT SEC_TEST.NEXTVAL FROM DUAL;
6)    SELECT SEC_TEST.CURRVAL FROM DUAL;

USER:-

7)    SHOW USER

UID:-

8)    SELECT UID FROM DUAL;

ORA_ROWSCN:-

9)    SELECT ORA_ROWSCN FROM EMPLOYEE WHERE EMPNO=1;

10) In triggers we can call :OLD and :NEW as a pseudo column



Read Also:- 

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.