allocate descriptor

Description

Allocates a SQL descriptor.

Syntax

exec sql allocate descriptor descriptor_name  
[with max [host_variable | integer_literal]];

Parameters

descriptor_name

The name of the SQL descriptor that will contain information about the dynamic parameter markers in a prepared statement.

with max

The maximum number of columns in the SQL descriptor.

host_variable

An integer host variable defined in a declare section.

integer_literal

A numeric value representing the size, in number of occurrences, of the SQL descriptor.

Examples

Example 1

exec sql begin declare section;
 CS_INT      type;
 CS_INT      numcols, colnum;
 exec sql end declare section;
 ...
 exec sql allocate descriptor big_desc
     with max 1000;
 exec sql prepare dynstmt from "select * from
     huge_table";
 exec sql execute dynstmt into sql descriptor
     big_desc;
 exec sql get descriptor :numcols = count;
 for (colnum = 1; colnum <= numcols; colnum++)
 {
     exec sql get descriptor big_desc :type = type;
         ...
 }
 exec sql deallocate descriptor big_desc;
         ...

Usage

See also

deallocate descriptor, get descriptor, set descriptor