The DEFINE_COLUMN procedure is used to define the columns to be selected from the specified cursor, and it can only be used with SELECT cursors.
The defined columns are identified by their relative positions in the SELECT list of the declared cursor. The type of the COLUMN value determines the type of the defined column.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_SQL.DEFINE_COLUMN (c IN INTEGER,
position IN INTEGER,
column IN NUMBER);
DBMS_SQL.DEFINE_COLUMN (c IN INTEGER,
position IN INTEGER,
column IN VARCHAR2);
DBMS_SQL.DEFINE_COLUMN (c IN INTEGER,
position IN INTEGER,
column IN VARCHAR2,
column_size IN INTEGER);
DBMS_SQL.DEFINE_COLUMN(c in integer,
position in integer,
column in date);
DBMS_SQL.DEFINE_COLUMN(c in integer,
position in integer,
column in binary_float);
DBMS_SQL.DEFINE_COLUMN(c in integer,
position in integer,
column in binary_double);
DBMS_SQL.DEFINE_COLUMN(c in integer,
position in integer,
column in blob);
DBMS_SQL.DEFINE_COLUMN(c in integer,
position in integer,
column in raw,
column_size IN INTEGER);
Parameters
| Parameter | Description |
|---|---|
| c | The cursor ID for the rows to be selected. |
| position | The relative position of the column in the defined row. The first column in the declaration has a position of 1. |
| column | The value of the defined column. The type of this value determines the type of the defined column. |
| column_size | The maximum value of the column in bytes. |
Considerations
When using character length semantics, the maximum number of bytes that can be returned for a VARCHAR2 column value is calculated as: column_size * the maximum number of bytes per character in the current character set.
For example, if column_size is specified as 10, it means that when using character length semantics with the UTF8 character set, a maximum of 30 bytes (10*3) can be returned, regardless of the number of characters it represents.
