SQL/MX Guide to Stored Procedures in Java (G06.24+, H06.03+)

Invoking SPJs in NonStop SQL/MX
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
5-13
Invoking SPJs in a NonStop ODBC/MX Client
Invoking SPJs in a NonStop ODBC/MX Client
You can execute a CALL statement in a NonStop ODBC/MX client. Microsoft ODBC
requires that you put the CALL statement in an escape clause:
For IN or INOUT parameters, use a literal or a parameter marker (?).
If you specify a literal for an INOUT parameter, the driver discards the output value.
For OUT parameters, you can use only a parameter marker (?). You must bind all
parameter markers with the SQLBindParameter function before you can execute the
CALL statement.
In this example, a CALL statement is executed from a NonStop ODBC/MX client:
/* Declare variables. */
SQLHSTMT hstmt;
SQL_NUMERIC_STRUCT salary;
SDWORD cbParam = SQL_NTS;
/* Bind the parameter markers. */
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_NUMERIC,
SQL_NUMERIC, 4, 0, 202, 0, &cbParam);
SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_FLOAT,
SQL_FLOAT, 0, 0, 5.5, 0, &cbParam);
SQLBindParameter(hstmt, 3, SQL_PARAM_OUTPUT, SQL_C_NUMERIC,
SQL_NUMERIC, 8, 2, &salary, 0, &cbParam);
/* Execute the CALL statement. */
SQLExecDirect(hstmt, "{call adjustsalary(?,?,?)}", SQL_NTS);
For more information about NonStop ODBC/MX clients, see the ODBC/MX Driver for
Windows Manual.
{call procedure-name ([parameter][,[parameter]]...)}
Note. You cannot use an empty string as an IN or INOUT parameter in the argument list.