The Select, Modify and ProcedureCall beans support the use of parameterized SQL statements. A parameterized SQL statement contains one or more parameters or variables whose value can be changed as your program runs. For example, youir SQL statement might be "SELECT * FROM STAFF WHERE DEPT = :deptNo" Your program can change the value for :deptNo each time the statement runs.
When you call a stored procedure, you can use parameters to supply input values. If the stored procedure returns output values (instead of or in addition to result sets), you must use parameters to obtain the output values. For example, your SQL statement might be "CALL MYPROC (5, :in1, :out1)". Your program will always use "5" as the first input value and can change the input value for ":in1" each time the statement runs. It must get the output value of ":out1" from the stored procedure after each run.
The Select, Modify, and ProcedureCall beans have methods to set and get the values of parameters. Each parameter for these beans has a name and can be accessed by name or number. For example, the statement above, "CALL MYPROC (5, :in1, :out1)" has two paraneters. (Because your program cannot change the value 5, it is not a statement parameter. The last parameter can be identified either with the name "out1" or the number 2.
When you use the SQL Assist SmartGuide to compose your SQL statement, VisualAge for Java generates two bound properties for each parameter; the parameter in its specified data type and a string representation of the parameter. In the Visual Composition Editor you can connect these properties to properties of interface components to get and set parameter values. For example, a property-to-property connection between the string representation of an output parameter and the text property of a text field results in the value displayed in the text field changing whenever the parameter value changes.
Connection Aliases and SQL Specifications
Select Bean
Modify Bean
ProcedureCall Bean