Difference between revisions of "PSEUDO COLUMNS"

From Lianjapedia
Jump to: navigation, search
 
Line 8: Line 8:
 
A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated.  They provide extra information about a row set.
 
A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated.  They provide extra information about a row set.
  
{| class="wikitable" width=100%
+
{| class="wikitable" width="100%"
!width=15%|Pseudo Columns||Description
+
!width="15%"|Pseudo Columns||Description
 
|-
 
|-
|valign=top|[[CURRVAL]]||The CURRVAL Pseudo Column will return the current sequence number from the specified table.  Sequence numbers can be used for primary and unique index keys.
+
|valign="top"|[[CURRVAL]]||The CURRVAL Pseudo Column will return the current sequence number from the specified table.  Sequence numbers can be used for primary and unique index keys.
 
|-
 
|-
|valign=top|[[NEXTVAL]]||The NEXTVAL Pseudo Column will return the next unique sequence number from the specified table.  Sequence numbers can be used for primary and unique index keys.
+
|valign="top"|[[NEXTVAL]]||The NEXTVAL Pseudo Column will return the next unique sequence number from the specified table.  Sequence numbers can be used for primary and unique index keys.
 
|-
 
|-
|valign=top|[[ROWID]]||The ROWID Pseudo Column will return a number identifying the row’s physical stored position in the table.  The ROWID Pseudo Column can be used to perform singleton selects, or optimize updates of a known ROWID.
+
|valign="top"|[[ROWID]]||The ROWID Pseudo Column will return a number identifying the row’s physical stored position in the table.  The ROWID Pseudo Column can be used to perform singleton selects, or optimize updates of a known ROWID.
 
|-
 
|-
|valign=top|[[SQLCNT]]||The SQLCNT Pseudo Column will return the number of rows affected by the last SQL statement.  For example, after a SELECT statement, SQLCNT will contain the number of rows selected.
+
|valign="top"|[[SQLCNT]]||The SQLCNT Pseudo Column will return the number of rows affected by the last SQL statement.  For example, after a SELECT statement, SQLCNT will contain the number of rows selected.
 
|-
 
|-
|valign=top|[[SQLCODE]]||The SQLCODE Pseudo Column will return a number indicating the result of the last SQL statement.
+
|valign="top"|[[SQLCODE]]||The SQLCODE Pseudo Column will return a number indicating the result of the last SQL statement.
 
|-
 
|-
 
|}
 
|}

Latest revision as of 09:04, 5 February 2013

Purpose

Provide extra information about a SELECT row set

See Also

INSERT, SELECT, UPDATE

Description

A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated. They provide extra information about a row set.

Pseudo Columns Description
CURRVAL The CURRVAL Pseudo Column will return the current sequence number from the specified table. Sequence numbers can be used for primary and unique index keys.
NEXTVAL The NEXTVAL Pseudo Column will return the next unique sequence number from the specified table. Sequence numbers can be used for primary and unique index keys.
ROWID The ROWID Pseudo Column will return a number identifying the row’s physical stored position in the table. The ROWID Pseudo Column can be used to perform singleton selects, or optimize updates of a known ROWID.
SQLCNT The SQLCNT Pseudo Column will return the number of rows affected by the last SQL statement. For example, after a SELECT statement, SQLCNT will contain the number of rows selected.
SQLCODE The SQLCODE Pseudo Column will return a number indicating the result of the last SQL statement.