The following statements call a stored procedure that returns an output parameter. The result is displayed in the result pane of the Command window.

d = new Database()

d.databaseName = "IBLOCAL"

d.active = true

p = new StoredProc()

p.database = d

p.procedureName = "DEPT_BUDGET"

p.params[ "DNO" ].value = "670"

p.active = true

? p.params[ "TOT" ].value // Display output

The following statements call a stored procedure in a database that does not return any parameter information. Therefore, the parameters must be declared in the procedureName property. Note that the parameter names are case-sensitive, and you must initialize any output parameters by assigning a dummy value of the correct data type.

#define PARAMETER_TYPE_INPUT 0

#define PARAMETER_TYPE_OUTPUT 1

#define PARAMETER_TYPE_INPUT_OUTPUT 2

#define PARAMETER_TYPE_RESULT 3

d = new Database()

d.databaseName = "WIDGETS"

d.active = true

p = new StoredProc()

p.database = d

p.procedureName = "PROJECT_SALES(:month, :units)"

p.params[ "month" ].type = PARAMETER_TYPE_INPUT

p.params[ "month" ].value = 6

p.params[ "units" ].type = PARAMETER_TYPE_OUTPUT

p.params[ "units" ].value = 0 // Output will be numeric

p.active = true

? p.params[ "TOT" ].value // Display output