Inserts or updates data in a SQL descriptor.
For a list of possible SQL descriptor datatypes, see Table 10-5.
exec sql set descriptor descriptor_name {count = host_variable} | {value item_number {item_name = :host_variable}[,...];
The name of the SQL descriptor that contains information about the dynamic parameter markers in a prepared statement.
The number of dynamic parameter specifications to be described.
A host variable defined in a declare section.
Represents the nth occurrence of either a dynamic parameter marker or a select column.
Represents the attribute information of either a dynamic parameter marker or a select list column. Table 10-4 lists the values for item_name.
Value |
Description |
---|---|
data |
Value for the dynamic parameter marker or target associated with the specified SQL descriptor. If indicator is negative, this field is undefined. |
length |
The length, in characters, of the dynamic parameter marker of target for the specified SQL descriptor. |
precision |
An integer specifying the total number of digits of precision for the CS_NUMERIC variable. |
scale |
An integer specifying the total number of digits after the decimal point for the CS_NUMERIC variable. |
type |
The datatype of this column (item number) in the row. For values, see Table 10-5. |
exec sql prepare get_royalty
from "select royalty from roysched
where title_id = ? and lorange <= ? and
hirange > ?";
exec sql allocate descriptor roy_desc with max 3;
exec sql set descriptor roy_desc
value 1 data = :tid;
exec sql set descriptor roy_desc
value 2 data = :sales;
exec sql set descriptor roy_desc
value 3 data = :sales;
exec sql execute get_royalty into :royalty
using sql descriptor roy_desc;
An Embedded SQL program passes attribute and value information to Client-Library, which holds the data in the specified SQL descriptor until the program issues it a request to execute a statement.
allocate descriptor, describe input, describe output, execute, fetch, get descriptor, open(dynamic cursor)