Reference Manual
CHAPTER 9. SQL Statements
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.
PUT cursor-name
... [ USING DESCRIPTOR sqlda-name
| FROM host-variable-list ]
... [ INTO DESCRIPTOR into-sqlda-name
| INTO into-host-variable-list ]
... [ ARRAY :nnn ]
cursor-name: identifier or host-variable
sqlda-name: identifier
host-variable-list: may contain indicator variables
Must have INSERT permission.
None.
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 |
Inserting into a cursor |
SQL/92 Entry level feature.
Sybase Supported by Open Client/Open Server.
The following statement illustrates the use of PUT in Embedded SQL:
EXEC SQL PUT cur_employee FROM :emp_id, :emp_lname;