Enterprise Manager Java App: Database - Procedures Tab
In BBj 13.0 and higher, the Enterprise Manager Java app has been superseded by a new browser Enterprise Manager and Eclipse plug-in. See Enterprise Manager - Database: Procedures.
Stored Procedures is a powerful feature of the BBj SQL engine that allows developers to embed portions of their application logic in the database. Putting logic in the database makes that functionality available to not only BBj programs, but also third party ODBC or JDBC applications via the SQL CALL statement.
Stored procedure code is written using the familiar BBj language.
To create a stored procedure using the Enterprise Manager
1. Select the desired database from the "Databases" list.
2. Click on the Stored Procedures tab.
3. Click [Add New Stored Procedure].
To edit an existing stored procedure using the Enterprise Manager
1. Select the desired database from the "Databases" list.
2. Click on the Stored Procedures tab.
3. Select the appropriate stored procedure.
4. Click [Edit Stored Procedure].
Information Tab
The Information tab provides SPROCs with several options.
Setting |
Description |
||||||||||||
Name |
Name of the stored procedure. This is the name that will be referred to from CALL statements. |
||||||||||||
Source Location |
Location of the source code that will be executed when the procedure is called. This should be a relative path as shown above. The source file can be a BBj program file or a plain text file. |
||||||||||||
Config Location |
Optional location of an alternate config.bbx file to use for the stored procedure instead of the default. |
||||||||||||
Return Type |
Optional data type if this procedure has a simple return value. Procedures may return either a simple type, or a result set, but not both. |
||||||||||||
Return Precision |
The precision of the return value, if it has one. |
||||||||||||
Return Scale |
The scale of the return value, if it has one. |
||||||||||||
Has Result Set |
Checked if this procedure returns a result set. Procedures may return either a simple type, or a result set, but not both. |
||||||||||||
Parameter Specification
|
A SPROC can have zero or more parameters. Parameters can be one of three types: IN, OUT, or IN/OUT (see Directionbelow). |
||||||||||||
|
Build
Source Template |
When the SPROC is fully defined, clicking [Build Source Template] creates a skeleton source file for the SPROC. This file contains the necessary code to access the stored procedure information, get/set parameter values, populate an in-memory record set that can be returned as the result of the call, sample code to read from a data file, etc. This provides an instant foundation to begin building the stored procedure code. NOTE: Creating a source template erases the current contents of the stored procedure source file. Upon clicking [Build Source Template], a warning displays requiring confirmation to continue. Next, if the SPROC is defined to return a result set, it will prompt for an option string template. If one is provided, the sample code to generate, populate, and return the result set matching the template is generated (otherwise a default template will be used). Below is an example that shows a portion of the generated code. |
Source Code Tab
The Source Code tab shows a read-only view of the source code for the stored procedure. To edit the code, BASIS recommends using the BASIS IDE. Alternatively, if the file is a plain text file, a standard text editor will work as well.