Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

The following example fetches records from a table one at a time into specific fields:

pjs.define("prid", { type: "packed decimal", length: 5, decimals: 0 });
pjs.define("prname", { type: "char", length: 30 });
pjs.define("prdesc", { type: "char", length: 60 });

var c1 = pjs.allocStmt();
c1.executeDirect("select prid, prname, prdesc from demolib/productsp order by prid");

if (SQLSTATE == '00000') {
 
  pjs.fetch(c1, prid, prname, prdesc);
  while (c1.hasMoreRows()) {
    // Process fetched data here
    pjs.fetch(c1, prid, prname, prdesc);
  }
 
}
 
c1.close();
  • No labels