Progress
SQL-92
Guide and Reference
Structure of Stored Procedures
There are two parts to any stored procedure:
EXAMPLEA simple stored procedure requires the procedure name in the specification, and a statement requiring no parameters in the body. The procedure in this example assumes the existence of a table named HelloWorld, and inserts a quoted string into that table:
EXAMPLE
Subsequently, from SQL Explorer you can execute the procedure like this:
The procedure specification can also contain other clauses:
EXAMPLE
- Parameter declarations specify the name and type of parameters that the calling application will pass and receive from the procedure. Parameters can be input, output, or both.
- The procedure result set declaration details the names and types of fields in a result set the procedure generates. The result set is a set of rows that contain data generated by the procedure. If a procedure retrieves rows from a database table, for instance, it can store the rows in a result set for access by applications and other procedures. Note that the names specified in the result-set declaration are not used within the stored procedure body. Instead, methods of the Progress SQL-92 Java classes refer to fields in the result set by ordinal number, not by name.
- The import clause specifies which packages the procedure needs from the Java core API. By default, the Java compiler imports the
java.lang
package. The IMPORT clause must list any other packages the procedure uses. Progress SQL-92 automatically imports the packages it requires.The following example shows a more complex procedure specification that contains these elements:
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |