Neoview Guide to Stored Procedures in Java (R2.5)
Order/Num Part/Num Unit/Price Qty/Ord Part Description
---------- -------- ------------ ---------- ------------------
100210 2001 1100.00 3 GRAPHIC PRINTER,M1
100210 2403 620.00 6 DAISY PRINTER,T2
100210 244 3500.00 3 PC GOLD, 30 MB
100210 5100 150.00 10 MONITOR BW, TYPE 1
100250 6500 95.00 10 DISK CONTROLLER
100250 6301 245.00 15 GRAPHIC CARD, HR
.
.
.
--- 70 row(s) selected.
--- SQL operation complete.
For other result set examples, see Appendix A (page 65).
Calling SPJs From an ODBC Client Application
You can execute a CALL statement in an ODBC client application. Microsoft ODBC requires that
you put the CALL statement in an escape clause:
{call procedure-name ([parameter][,[parameter]]...)}
For IN or INOUT parameters, use a literal or a parameter marker (?). You cannot use an empty
string as an IN or INOUT parameter in the argument list. 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 an ODBC client application:
/* 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 ODBC client applications, see the Neoview ODBC Drivers Manual.
Returning Result Sets in an ODBC Client Application
This example shows how an ODBC client application processes the result sets returned by a
CALL statement. The SQLMoreResults() function closes the current result set and moves
processing to the next available result set.
56 Executing SPJs