%SSC_SQLLINK
Link a non-SELECT statement to cursor for a SELECT statement
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
value = %SSC_SQLLINK(dbchannel, cursor, statement[, numvars][, var, ...])
Return value
value
This function returns SSQL_NORMAL (success). (i)
Arguments
dbchannel
An internal database channel previously initialized using %SSC_INIT and connected by %SSC_CONNECT. (n)
cursor
The ID number of an open cursor that will be linked to statement (a non-SELECT statement). Cursor must be within the range from 1 through the maximum number specified by the maxcur argument for %SSC_INIT. The cursor must have been opened by %SSC_OPEN. (n)
statement
The SQL statement. (a)
numvars
(optional) The number of bound host variables that follow. Note that numvars cannot exceed the value of maxcol passed in the %SSC_INIT call. (n)
var
(optional) Host variables to be bound to the non-SELECT statement. If numvars is passed, the number of var arguments passed must equal the value of numvars. (n)
Discussion
%SSC_SQLLINK links a new non-SELECT statement (statement) to an already opened SELECT statement cursor (cursor), clears all defined variables and bound variables, and rebinds variables for the new non-SELECT statement to follow. The primary use of %SSC_SQLLINK is to update the current row just fetched through %SSC_MOVE (with the SSQL_POSITION and SSQL_FORUPDATE options set in the %SSC_OPEN for the database cursor).
Note the following:
- Note that you can call %SSC_MOVE and %SSC_EXECUTE multiple times for the same set of %SSC_OPEN and %SSC_SQLLINK statements, which enables you to repeatedly fetch and update rows using the same cursor.
- To bind more than 250 variables for a statement specified by %SSC_SQLLINK, put up to 250 variables in the %SSC_SQLLINK call, then put the remainder in one or more %SSC_BIND calls.
- Don’t put a restriction clause in the update statement passed to %SSC_SQLLINK. When you specify SSQL_POSITION and SSQL_FORUPDATE in the %SSC_OPEN call for the database cursor, SQL Connection automatically positions the cursor so restrictions aren’t necessary for the update statement.
- If you use ^VARARGARRAY, note that numvars is the last declared argument for this routine.
For more information on binding host variables, see Binding data.
Examples
For an example, see exam_fetch_update.dbl, which is in the connect\synsqlx subdirectory of the main Synergy/DE installation directory.