Skip to content

Commit

Permalink
several fixes suggested by Himanshu
Browse files Browse the repository at this point in the history
  • Loading branch information
dwicinas committed Sep 20, 2023
1 parent e43415e commit 525c434
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(<c> IN NUMBER, <col_cnt> OUT NUMBER, <desc_t> OUT
DESC_TAB);
DESCRIBE_COLUMNS2(<c> IN NUMBER, <col_cnt> OUT NUMBER, <desc_tab2> OUT
DESC_TAB2);
```

## Parameters
Expand All @@ -19,9 +19,9 @@ DESCRIBE_COLUMNS2(<c> IN NUMBER, <col_cnt> OUT NUMBER, <desc_t> 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 |
| --------------------- | --------------- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(<c> IN NUMBER, <col_cnt> OUT NUMBER, <desc_t> OUT
DESC_TAB);
DESCRIBE_COLUMNS3(<c> IN NUMBER, <col_cnt> OUT NUMBER, <desc_tab3> OUT
DESC_TAB3);
```

## Parameters
Expand All @@ -19,23 +20,26 @@ DESCRIBE_COLUMNS3(<c> IN NUMBER, <col_cnt> OUT NUMBER, <desc_t> 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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,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;
```

0 comments on commit 525c434

Please sign in to comment.