diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/001_bind_array.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/001_bind_array.mdx index a2231fa08b8..2e3326c61cf 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/001_bind_array.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/001_bind_array.mdx @@ -6,8 +6,8 @@ The `BIND_ARRAY` procedure binds a value or set of values to a variable in a cur ```sql BIND_ARRAY ( IN NUMBER, IN VARCHAR2, - IN { FLOAT | BLOB | |CLOB | VARCHAR2 | NUMBER | TIMESTAMP } - [, IN NUMBER, IN NUMBER)]); + IN { FLOAT_TABLE | BLOB_TABLE | CLOB_TABLE | VARCHAR2_TABLE | NUMBER_TABLE | TIMESTAMP_TABLE | + INTEGER_TABLE | ROWID_TABLE | TEXT_TABLE } [, IN NUMBER, IN NUMBER]); ``` ## Parameters @@ -24,7 +24,7 @@ BIND_ARRAY ( IN NUMBER, IN VARCHAR2, A local variable that is declared to be one of the following datatypes: -| Datatype | Description | +| Datatype | Description | | ---------- | --------------- | | | FLOAT_TABLE | | | BLOB_TABLE | @@ -32,15 +32,18 @@ BIND_ARRAY ( IN NUMBER, IN VARCHAR2, | | VARCHAR2_TABLE | | | NUMBER_TABLE | | | TIMESTAMP_TABLE | +| | INTEGER_TABLE | +| | ROWID_TABLE | +| | TEXT_TABLE | `index1` -Index for the table element that marks the lower bound of the range if you're binding a range. This value must be less than or equal to the value of `index2`. All elements between `index1` and `index2` are used in the bind. +Index for the table element that marks the lower bound of the range if you are binding a range. This value must be less than or equal to the value of `index2`. All elements between `index1` and `index2` are used in the bind. This is an optional parameter that can be used with three parameters or five parameters but not four. `index2` -Index for the table element that marks the upper bound of the range. +Index for the table element that marks the upper bound of the range. This is an optional parameter that can be used with three parameters or five parameters but not four. ## Notes @@ -77,12 +80,15 @@ BEGIN END; / --- this will INSERT 3 rows in the table. +-- this inserts three rows using bind_array so verify them in the table. SELECT * FROM tab_test; col_int | col_charactervarying ---------+---------------------- 10 | edb_user 11 | edb_user 12 | edb_user +-- For col_int we are passing bind_array with the size of 3 elements, and as col_charactervarying we are +-- passing bind_variable. So for all the insertions, we are using same bind_variable (edb_user). + (3 rows) ``` diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/01_bind_variable.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/01_bind_variable.mdx index 6eef0b16031..623fd3dd0b2 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/01_bind_variable.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/01_bind_variable.mdx @@ -8,7 +8,7 @@ The `BIND_VARIABLE` procedure associates a value with an `IN` or `IN OUT` bind v ```sql BIND_VARIABLE( NUMBER, VARCHAR2, - { BLOB | CLOB | DATE | FLOAT | INTEGER | NUMBER | TIMESTAMP | VARCHAR2 } + { BLOB | CLOB | FLOAT | INTEGER | NUMBER | ROWID | TIMESTAMP | VARCHAR2 } [, NUMBER ]) ``` diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07a_column_value_long.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07a_column_value_long.mdx index fc96ac91c1f..a48907c3bda 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07a_column_value_long.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07a_column_value_long.mdx @@ -67,6 +67,13 @@ BEGIN DBMS_SQL.CLOSE_CURSOR(cur_id); END; +Output: +col_long: Testing +value_length: 7 + +EDB-SPL Procedure successfully completed + + -- Use positive offset DECLARE cur_id INTEGER; @@ -86,4 +93,11 @@ BEGIN DBMS_OUTPUT.PUT_LINE('value_length: ' || length); DBMS_SQL.CLOSE_CURSOR(cur_id); END; + +Output: +col_long: DefineColumn +value_length: 12 + +EDB-SPL Procedure successfully completed + ``` \ No newline at end of file diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07c_define_array.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07c_define_array.mdx index e41c02c7242..11510bfd62b 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07c_define_array.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/07c_define_array.mdx @@ -8,9 +8,8 @@ When you fetch rows, they are copied into DBMS_SQL buffers until you run a COLUM ```sql DEFINE_ARRAY( IN NUMBER, IN NUMBER, - UN { CLOB | FLOAT | BLOB | NUMBER | VARCHAR2 | TIMESTAMP }, - IN NUMBER, IN NUMBER) - ); + IN { FLOAT_TABLE | BLOB_TABLE | CLOB_TABLE | VARCHAR2_TABLE | NUMBER_TABLE | TIMESTAMP_TABLE | + INTEGER_TABLE | ROWID_TABLE | TEXT_TABLE }, IN NUMBER, IN NUMBER); ``` ## Parameters @@ -27,14 +26,18 @@ Relative position of the column in the array being defined. The first column is A datatype that can be any one of the following matching pairs: -| Datatype | Description | +| Datatype | Description | | ---------- | --------------- | -| | CLOB_TABLE | | | FLOAT_TABLE | | | BLOB_TABLE | -| | NUMBER_TABLE | +| | CLOB_TABLE | | | VARCHAR2_TABLE | +| | NUMBER_TABLE | | | TIMESTAMP_TABLE | +| | INTEGER_TABLE | +| | ROWID_TABLE | +| | TEXT_TABLE | + `cnt` diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/10a_define_column_long.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/10a_define_column_long.mdx index de56a48a2cf..6844b87ee15 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/10a_define_column_long.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/10a_define_column_long.mdx @@ -52,6 +52,12 @@ BEGIN DBMS_SQL.CLOSE_CURSOR(cur_id); END; +Output: +col_long: Testing +value_length: 7 + +EDB-SPL Procedure successfully completed + -- Use positive offset DECLARE cur_id INTEGER; @@ -71,4 +77,11 @@ BEGIN DBMS_OUTPUT.PUT_LINE('value_length: ' || length); DBMS_SQL.CLOSE_CURSOR(cur_id); END; + +Output: +col_long: DefineColumn +value_length: 12 + +EDB-SPL Procedure successfully completed + ``` \ No newline at end of file diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11a_describe_columns2.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11a_describe_columns2.mdx index 65f6e364e49..ac338be78ec 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11a_describe_columns2.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11a_describe_columns2.mdx @@ -2,11 +2,11 @@ title: "DESCRIBE_COLUMNS2" --- -The `DESCRIBE_COLUMNS2` procedure describes specified columns returned by a cursor. This procedure provides an alternative to 'DESCRIBE_COLUMN' and can be used for migration. +The `DESCRIBE_COLUMNS2` procedure describes specified columns returned by a cursor. This procedure provides an alternative to `DESCRIBE_COLUMN`. ```sql -DESCRIBE_COLUMNS2( IN NUMBER, OUT NUMBER, OUT - DESC_TAB); +DESCRIBE_COLUMNS2( IN NUMBER, OUT NUMBER, OUT + DESC_TAB2); ``` ## Parameters @@ -19,9 +19,9 @@ DESCRIBE_COLUMNS2( IN NUMBER, OUT NUMBER, OUT The number of columns in the cursor result set. -`desc_tab` +`desc_tab2` - The table that contains a description of each column returned by the cursor. The descriptions are of type `DESC_REC` and contain the following values: + The table that contains a description of each column returned by the cursor. The descriptions are of type `DESC_REC2` and contain the following values: | Column name | Type | | --------------------- | --------------- | diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11b_describe_columns3.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11b_describe_columns3.mdx index c44751ca2c5..eeaa76877d1 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11b_describe_columns3.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/11b_describe_columns3.mdx @@ -2,11 +2,12 @@ title: "DESCRIBE_COLUMNS3" --- -The `DESCRIBE_COLUMNS3` procedure describes specified columns returned by a cursor. This procedure provides an alternative to 'DESCRIBE_COLUMN' and can be used for migration. +The `DESCRIBE_COLUMNS3` procedure describes specified columns returned by a cursor. This procedure provides an alternative to `DESCRIBE_COLUMN`. + ```sql -DESCRIBE_COLUMNS3( IN NUMBER, OUT NUMBER, OUT - DESC_TAB); +DESCRIBE_COLUMNS3( IN NUMBER, OUT NUMBER, OUT + DESC_TAB3); ``` ## Parameters @@ -19,23 +20,26 @@ DESCRIBE_COLUMNS3( IN NUMBER, OUT NUMBER, OUT The number of columns in the cursor result set. -`desc_tab` +`desc_tab3` + + The table that contains a description of each column returned by the cursor. The descriptions are of type `DESC_REC3` and contain the following values: - The table that contains a description of each column returned by the cursor. The descriptions are of type `DESC_REC` and contain the following values: +| Column name | Type | +| --------------------- | ----------------- | +| `col_type` | `INTEGER` | +| `col_max_len` | `INTEGER` | +| `col_name` | `VARCHAR2(128)` | +| `col_name_len` | `INTEGER` | +| `col_schema_name` | `VARCHAR2(128)` | +| `col_schema_name_len` | `INTEGER` | +| `col_precision` | `INTEGER` | +| `col_scale` | `INTEGER` | +| `col_charsetid` | `INTEGER` | +| `col_charsetform` | `INTEGER` | +| `col_null_ok` | `BOOLEAN` | +| `col_type_name` | `VARCHAR2(32767)` | +| `col_type_name_len` | `INTEGER` | -| Column name | Type | -| --------------------- | --------------- | -| `col_type` | `INTEGER` | -| `col_max_len` | `INTEGER` | -| `col_name` | `VARCHAR2(128)` | -| `col_name_len` | `INTEGER` | -| `col_schema_name` | `VARCHAR2(128)` | -| `col_schema_name_len` | `INTEGER` | -| `col_precision` | `INTEGER` | -| `col_scale` | `INTEGER` | -| `col_charsetid` | `INTEGER` | -| `col_charsetform` | `INTEGER` | -| `col_null_ok` | `BOOLEAN` | ### Examples diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/19_to_cursor_number.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/19_to_cursor_number.mdx index 771d2ef1a6f..bf095161868 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/19_to_cursor_number.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/19_to_cursor_number.mdx @@ -13,7 +13,6 @@ TO_CURSOR_NUMBER ( IN OUT SYS_REFCURSOR) ## Parameters -```sql `rc` The ref cursor to be transformed into a cursor number. @@ -32,5 +31,17 @@ DECLARE col2_data VARCHAR(30); BEGIN OPEN cur1 FOR 'SELECT * FROM test_tbl_tbl'; - cur_id:= dbms_sql.TO_CURSOR_NUMBER + cur_id:= dbms_sql.to_cursor_number(cur1); + + dbms_sql.define_column(cur_id, 1, tbl_desc.col1); + dbms_sql.define_column(cur_id, 2, tbl_desc.col2); + + LOOP + ret := dbms_sql.FETCH_ROWS(cur_id); + EXIT WHEN ret = 0; + dbms_sql.column_value(cur_id, 1, tbl_desc.col1); + dbms_sql.column_value(cur_id, 2, tbl_desc.col2); + dbms_output.put_line('Col1: ' || tbl_desc.col1 || ' Col2: ' || tbl_desc.col2); + END LOOP; +END; ``` \ No newline at end of file diff --git a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/index.mdx b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/index.mdx index d4f7c1c0e19..895fad44994 100644 --- a/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/index.mdx +++ b/product_docs/docs/epas/16/reference/oracle_compatibility_reference/epas_compat_bip_guide/03_built-in_packages/17_dbms_sql/index.mdx @@ -15,30 +15,38 @@ The `DBMS_SQL` package provides an application interface compatible with Oracle EDB Postgres Advanced Server's implementation of `DBMS_SQL` is a partial implementation when compared to Oracle's version. Only those functions and procedures listed in the table are supported. -| Function/procedure | Function or procedure | Return type | Description | -| --------------------------------------------------------------------------------------- | --------------------- | ----------- | ---------------------------------------------------------------------- | -| `BIND_VARIABLE(c, name, value [, out_value_size ])` | Procedure | n/a | Bind a value to a variable. | -| `BIND_VARIABLE_CHAR(c, name, value [, out_value_size ])` | Procedure | n/a | Bind a `CHAR` value to a variable. | -| `BIND_VARIABLE_RAW(c, name, value [, out_value_size ])` | Procedure | n/a | Bind a `RAW` value to a variable. | -| `CLOSE_CURSOR(c IN OUT)` | Procedure | n/a | Close a cursor. | -| `COLUMN_VALUE(c, position, value OUT [, column_error OUT [, actual_length OUT ]])` | Procedure | n/a | Return a column value into a variable. | -| `COLUMN_VALUE_CHAR(c, position, value OUT [, column_error OUT [, actual_length OUT ]])` | Procedure | n/a | Return a `CHAR` column value into a variable. | -| `COLUMN_VALUE_RAW(c, position, value OUT [, column_error OUT [, actual_length OUT ]])` | Procedure | n/a | Return a `RAW` column value into a variable. | -| `COLUMN_VALUE_LONG(c, position, length, offset, value OUT, value_length OUT` | Procedure | n/a | Return a part of the `LONG` column value into a variable. | -| `DEFINE_COLUMN(c, position, column [, column_size ])` | Procedure | n/a | Define a column in the `SELECT` list. | -| `DEFINE_COLUMN_CHAR(c, position, column, column_size)` | Procedure | n/a | Define a `CHAR` column in the `SELECT` list. | -| `DEFINE_COLUMN_RAW(c, position, column, column_size)` | Procedure | n/a | Define a `RAW` column in the `SELECT` list. | -| `DEFINE_COLUMN_LONG(c, position)` | Procedure | n/a | Define a `LONG` column in the `SELECT` list. | -| `DESCRIBE_COLUMNS` | Procedure | n/a | Define columns to hold a cursor result set. | -| `EXECUTE(c)` | Function | `INTEGER` | Execute a cursor. | -| `EXECUTE_AND_FETCH(c [, exact ])` | Function | `INTEGER` | Execute a cursor and fetch a single row. | -| `FETCH_ROWS(c)` | Function | `INTEGER` | Fetch rows from the cursor. | -| `IS_OPEN(c)` | Function | `BOOLEAN` | Check if a cursor is open. | -| `LAST_ROW_COUNT` | Function | `INTEGER` | Return cumulative number of rows fetched. | -| `LAST_ERROR_POSITION` | Function | `INTEGER` | Return byte offset in the SQL statement text where the error occurred. | -| `OPEN_CURSOR` | Function | `INTEGER` | Open a cursor. | -| `PARSE(c, statement, language_flag)` | Procedure | n/a | Parse a statement. | -| `VARIABLE_VALUE` | | | Not supported in EPAS | +| Function/procedure | Function or procedure | Return type | Description | +| ---------------------------------------------------------------------------------------- | --------------------- | ---------------- | ---------------------------------------------------------------------- | +| `BIND_ARRAY(c IN, name IN, table_variable IN [index1 IN, index2 IN])` | Procedure | n/a | Binds a value or set of values to a variable. | +| `BIND_VARIABLE(c, name, value [, out_value_size ])` | Procedure | n/a | Bind a value to a variable. | +| `BIND_VARIABLE_CHAR(c, name, value [, out_value_size ])` | Procedure | n/a | Bind a `CHAR` value to a variable. | +| `BIND_VARIABLE_RAW(c, name, value [, out_value_size ])` | Procedure | n/a | Bind a `RAW` value to a variable. | +| `CLOSE_CURSOR(c IN OUT)` | Procedure | n/a | Close a cursor. | +| `COLUMN_VALUE(c, position, value OUT [, column_error OUT [, actual_length OUT ]])` | Procedure | n/a | Return a column value into a variable. | +| `COLUMN_VALUE_CHAR(c, position, value OUT [, column_error OUT [, actual_length OUT ]])` | Procedure | n/a | Return a `CHAR` column value into a variable. | +| `COLUMN_VALUE_RAW(c, position, value OUT [, column_error OUT [, actual_length OUT ]])` | Procedure | n/a | Return a `RAW` column value into a variable. | +| `COLUMN_VALUE_LONG(c, position, length, offset, value OUT, value_length OUT)` | Procedure | n/a | Return a part of the `LONG` column value into a variable. | +| `COLUMN_VALUE_ROWID(c, position, value OUT [ column_error OUT [, actual_length OUT ]])` | Procedure | n/a | Return a `ROWID` column in a cursor. | +| `DEFINE_ARRAY(c IN, position IN, table_variable IN, cnt IN, lower_bnd IN )` | Procedure | n/a | Define collection for column into which to fetch rows. | +| `DEFINE_COLUMN(c, position, column [, column_size ])` | Procedure | n/a | Define a column in the `SELECT` list. | +| `DEFINE_COLUMN_CHAR(c, position, column, column_size)` | Procedure | n/a | Define a `CHAR` column in the `SELECT` list. | +| `DEFINE_COLUMN_RAW(c, position, column, column_size)` | Procedure | n/a | Define a `RAW` column in the `SELECT` list. | +| `DEFINE_COLUMN_LONG(c, position)` | Procedure | n/a | Define a `LONG` column in the `SELECT` list. | +| `DEFINE_COLUMN_ROWID(c IN, position IN, column IN)` | Procedure | n/a | Define a `ROWID` column in the `SELECT` list. | +| `DESCRIBE_COLUMNS(c IN, col_cnt OUT, desc_t OUT, DESC_TAB)` | Procedure | n/a | Define columns to hold a cursor result set. | +| `DESCRIBE_COLUMNS2(c IN, col_cnt OUT, desc_t OUT, DESC_TAB)` | Procedure | n/a | Define columns to hold a cursor result set. | +| `DESCRIBE_COLUMNS3(c IN, col_cnt OUT, desc_t OUT, DESC_TAB)` | Procedure | n/a | Define columns to hold a cursor result set. | +| `EXECUTE(c)` | Function | `INTEGER` | Execute a cursor. | +| `EXECUTE_AND_FETCH(c [, exact ])` | Function | `INTEGER` | Execute a cursor and fetch a single row. | +| `FETCH_ROWS(c)` | Function | `INTEGER` | Fetch rows from the cursor. | +| `IS_OPEN(c)` | Function | `BOOLEAN` | Check if a cursor is open. | +| `LAST_ROW_COUNT` | Function | `INTEGER` | Return cumulative number of rows fetched. | +| `LAST_ERROR_POSITION` | Function | `INTEGER` | Return byte offset in the SQL statement text where the error occurred. | +| `OPEN_CURSOR` | Function | `INTEGER` | Open a cursor. | +| `PARSE(c, statement, language_flag)` | Procedure | n/a | Parse a statement. | +| `TO_CURSOR_NUMBER (rc IN OUT )` | Function | `INTEGER` | Transform a ref cursor into a SQL cursor number. | +| `TO_REFCURSOR (cursor_number IN OUT)` | Function | `SYS_REFCURSOR ` | Transform an open cursor into a REF CURSOR. +| `VARIABLE_VALUE` | | | Not supported in EPAS | The following table lists the public variables available in the `DBMS_SQL` package.