Collection Contents Index PRINT statement [T-SQL] RAISERROR statement [T-SQL] pdf/chap9.pdf

Reference Manual
   CHAPTER 9. SQL Statements     

PUT statement [ESQL] [SP]


Function 

To insert a row into the table(s) specified by the cursor. See SET statement for putting LONG VARCHAR or LONG BINARY values into the database.

Syntax 

PUT cursor-name
... [ USING DESCRIPTOR sqlda-name
| FROM host-variable-list ]

... [ INTO DESCRIPTOR into-sqlda-name
| INTO into-host-variable-list ]

... [ ARRAY :nnn ]

Parameters 

cursor-name: identifier or host-variable

sqlda-name: identifier

host-variable-list: may contain indicator variables

Permissions 

Must have INSERT permission.

Side effects 

None.

See also 

UPDATE statement

UPDATE (positioned) statement

DELETE statement

DELETE (positioned) statement

INSERT statement

Description 

Inserts a row into the named cursor. Values for the columns are taken from the SQLDA or the host variable list, in a one-to-one correspondence with the columns in the INSERT statement (for an INSERT cursor) or the columns in the select list (for a SELECT cursor).

If the sqldata pointer in the SQLDA is the null pointer, no value is specified for that column. If the column has a DEFAULT VALUE associated with it, that will be used; otherwise, a NULL value will be used. If no values are specified for any of the columns of one particular table involved in the cursor, no row will be inserted into that table.

The second SQLDA or host variable list contains the results of the PUT statement.

The optional ARRAY clause can be used to carry out wide puts, which insert more than one row at a time and which may improve performance. The value nnn is the number of rows to be inserted. The SQLDA must contain nnn * (columns per row) variables. The first row is placed in SQLDA variables 0 to (columns per row)-1, and so on.

One table only    
Values can be specified for columns of one table only. Inserting into two different tables through a cursor is not supported.

Inserting into a cursor    
When inserting into a cursor, the position of the inserted row is unpredictable. If the cursor involves a temporary table, the inserted record will not show up in the current cursor at all.

Standards and compatibility 

Example 


Collection Contents Index PRINT statement [T-SQL] RAISERROR statement [T-SQL] pdf/chap9.pdf