Fetches the first row from the cursor associated with the statement handle.
This API can either fetch data into declared fields / data structures / arrays, or return data as primitive objects / arrays.
- Handle returned from pjs.allocStmt() or pjs.prepare(). The statement handle must be executed with pjs.execute() or pjs.executeDirect() before it can be used to fetch rows. This parameter is omitted if the API is called as a statement object method.
- Following the optional field names, a Number can be passed that specifies the number of rows to fetch. Pass SQL_FETCH_ALL to fetch all rows. If not passed, 1 row will be fetched.
SQL diagnostics are reported in the SQLCA:
SQLCA fields are defined in Profound.js programs with the names in lowercase. sqlcode will be set to zero if execution was successful.
When using an IBM i database, this API requires the Profound.js Connector module.