To call a stored procedure, you use an executable clause that contains an SQL CALL statement.
You can execute the CALL statement with host identifier parameters. You can execute the CALL statement with literal parameters only if the data server on which the CALL statement runs supports execution of the CALL statement dynamically.
The basic steps in calling a stored procedure are:
String FirstName="TOM"; // Input parameters 1
String LastName="NARISINST";
String Address="IBM";
int CustNo; // Output parameters
String Mark;
String MarkErrorText;
…
#sql [myConnCtx] {CALL ADD_CUSTOMER(:IN FirstName, 2
:IN LastName,
:IN Address,
:OUT CustNo,
:OUT Mark,
:OUT MarkErrorText)};
// Call the stored procedure
System.out.println("Output parameters from ADD_CUSTOMER call: ");
System.out.println("Customer number for " + LastName + ": " + CustNo); 3
System.out.println(Mark);
If (MarkErrorText != null)
System.out.println(" Error messages:" + MarkErrorText);