Precompiler-generated stored procedures

You can set an optional command line switch so that the precompiler automatically generates stored procedures that can optimize the execution of Transact-SQL statements in your program.

For the list of precompiler command line option switches, see the Open Client and Open Server Programmer’s Supplement.

Follow these steps to activate precompiler-generated stored procedures:

  1. Set the appropriate command line switch so that the precompiler automatically generates stored procedures for the Transact-SQL statements to be optimized.

    The precompiler generates an isql file containing statements that generate the stored procedures.

  2. Use interactive SQL (the isql program) to execute the file.

    This loads the stored procedures on Adaptive Server. The precompiler also creates the stored procedure calls in its output file.

By default, precompiler-generated stored procedures have the same name as the source program, minus any file extensions. The stored procedures are numbered sequentially and the file name and number are separated by a semicolon (“;”).

For example, the stored procedures for a source program named test1.pc, would be named test1;1 through test1;n, where n is the number of the source program’s last stored procedure.

Optionally, you can set a command line flag that lets you alter the stored procedures’ names. By using this flag, you can test a modified application without deleting a stored procedure already in production. After successfully testing the application, you can precompile it without the flag to install the stored procedure.

NoteWhen you issue the declare cursor statement, only the select clause is saved as a stored procedure. If an application has syntax errors, the precompiler generates neither the target file nor stored procedures.