|
SQL Statements | SQL Language in 602SQL | Control Statements |
Objects can be classified in SQL as follows:
Local and global objects are marked with names. Local objects declared in different program blocks may have the same name.
Some object categories, such as triggers or sequences may exist only as global objects.
Local objects are declared inside a program block. Local objects are automatically created and deleted when leaving a SQL block. You cannot work with local objects outside the program block they are declared.
Variables, routines, exceptions, handlers, cursors and local tables may be declared as local object.
Global objects (tables, queries, procedures, triggers and sequences) are created and deleted using the CREATE and DROP statement or with the interactive tools in the 602SQL Client. Each object category is visible in the object list on the Control Panel. These objects often create during the import of an application. They are accessible from all objects in the schema (and also from other database schemas if the schema name is used as a prefix).
Global variables, exceptions and handlers are created by specifying their declaration in the special object Module_globals. This object is placed along with other procedures in the control panel. Use the dialog for creating routines from the control panel when creating this procedure, since Module_globals has somewhat different syntax than a common SQL procedure. A common procedure named Module_globals cannot be compiled.
These objects are not accessible from other database schemas. Module_globals routine is not accessible from other database schemas.
Global handlers cannot execute statements that manipulate database contents. They can only call procedures that work with data.
An syntax error in the Module_globals is signalized in a category TRACE_BCK_OBJ_ERROR ("Error in the background")
There is a special instance of all global variables for each client working with objects from a schema. The global variable values set by a client are not visible to other clients.
If a client calls a SQL statement that assigns some global variable a value then this value remains in the variable until a new value is assigned by the same client. If a client calls two procedures, the second procedure gets those variables values that the first procedure assigned. When the client disconnects from the server, all global variables are discarded.
Database tables, not variables, serve for transferring values among clients or for persistent storage.
Variations from Intermediate to Full SQL
All declarations are implemented according to the SQL3 standard.
List of topics:
SQL Statements | SQL Language in 602SQL | Control Statements |