The DEFINE_COLUMN stored procedure defines the column to be selected from a specified cursor. This procedure is only used with SELECT cursors.
The column to define is identified by its relative position in the SELECT list of the statement in the specified cursor. The type of the column parameter determines the type of the column to define.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
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 ID of the cursor for the row that is being defined to be selected. |
| position | The relative position of the column in the row that is being defined. This first column in a statement has position 1. |
| column | The value of the column to define. The type of this value determines the type of the column to define. |
| column_size | The maximum size of the column value in bytes. |
Considerations
When you use character length semantics, the maximum number of bytes that can be returned for a column value of the VARCHAR2 type is calculated as: column_size × maximum character byte size of the current character set.
For example, if column_size is set to 10, a maximum of 10 × 3 = 30 bytes can be returned when you use the character length semantics with a UTF-8 character set, regardless of the number of characters this represents.