This statement is an extension to the ANSI/ISO standard for SQL. You can use this statement with ESQL/C.
>>-PUT--+-cursor_id_var-+---------------------------------------> '-cursor_id-----' >--+----------------------------------------------------+------>< | .-,----------------------------------------. | | V | | +-FROM----output_var--+--------------------------+-+-+ | +-INDICATOR--indicator_var-+ | | +-$indicator_var-----------+ | | '-:indicator_var-----------' | '-USING--+-SQL DESCRIPTOR--+-'descriptor '--+-+------' | '-descriptor_var-' | '-DESCRIPTOR--sqlda_pointer----------'
Element | Description | Restrictions | Syntax |
---|---|---|---|
cursor_id | Name of a cursor | Must be open | Identifier |
cursor_id_var | Host variable = cursor_id | Must be a character type; cursor must be open | Language specific |
descriptor | Name of a system-descriptor area | Must already be allocated | Quoted String |
descriptor_var | Host-variable that contains descriptor | Must already be allocated | Quoted String |
indicator_var | Host variable to receive a return code if corresponding output_var receives a NULL value | Cannot be a DATETIME or INTERVAL data type | Language specific |
output_var | Host variable whose contents replace a question-mark ( ? ) placeholder in a prepared INSERT statement | Must be a character data type | Language specific |
sqlda_pointer | Pointer to an sqlda structure | First character cannot be the ( $ ) or ( : ) symbol | DESCRIBE |
PUT stores a row in an insert buffer that is created when the cursor is opened.
If the buffer has no room for the new row when the statement executes, the buffered rows are written to the database in a block, and the buffer is emptied. As a result, some PUT statement executions cause rows to be written to the database, and some do not. You can use the FLUSH statement to write buffered rows to the database without adding a new row. The CLOSE statement writes any remaining rows before it closes an insert cursor.
If the current database uses explicit transactions, you must execute a PUT statement within a transaction.
The following example uses a PUT statement in ESQL/C:
EXEC SQL prepare ins_mcode from 'insert into manufact values(?,?)'; EXEC SQL declare mcode cursor for ins_mcode; EXEC SQL open mcode; EXEC SQL put mcode from :the_code, :the_name;
The PUT statement is not an X/Open SQL statement. Therefore, you get a warning message if you compile a PUT statement in X/Open mode.
The values in the inserted row can come from one of the following sources:
The system descriptor area or sqlda structure that descriptor or sqlda_pointer references must define a data type and memory location of each value that corresponds to a question-mark ( ? ) placeholder in a prepared INSERT statement.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]