Oracle SQL Pseudo-Columns Explained: Types, Uses, and Key Limitations
Oracle SQL pseudo-columns behave like table columns but are not physically stored on disk, meaning they can be queried with SELECT but cannot be modified via INSERT, UPDATE, or DELETE. Built-in pseudo-columns include ROWID for unique physical row addressing, ROWNUM for sequential row numbering, NEXTVAL and CURRVAL for sequence management, and ORA_ROWSCN for tracking data changes via System Change Numbers. For hierarchical queries using CONNECT BY, Oracle provides additional pseudo-columns such as LEVEL, CONNECT_BY_ISLEAF, CONNECT_BY_ISCYCLE, and SYS_CONNECT_BY_PATH to navigate and inspect tree structures. A common pitfall involves ROWNUM, which is assigned after the WHERE clause but before ORDER BY, making direct filters like ROWNUM > 1 unreliable without using a subquery. Unlike ROWNUM, ROWID is a permanent physical address that persists across transactions, and while ROWID cannot be indexed directly, ROWNUM cannot be indexed at all; custom pseudo-columns are not supported, though Oracle 11g introduced virtual columns as a logical alternative.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in