Be sure to read this entire chapter. The requirements discussed throughout this chapter also apply when writing stored procedures using IQ UTILITIES. You must obey several crucial additional requirements.
If you use IQ UTILITIES in your procedure, you must use this statement in exactly the same way that existing procedures use it. In particular, you must:
Declare a local temporary table in which you store results from the procedure. This table must have exactly the same schema as in the system stored procedures, including column names, column width, column order, data types, precision, and so on.
Issue an EXECUTE IMMEDIATE command to execute IQ UTILITIES and store its results in the temporary table.
Where the IQ UTILITIES statement includes a number, you must use exactly the same number as in the system stored procedures, for exactly the same purpose. You cannot create your own numbers or change the way in which existing numbers are used.
In other words, you must use the local temporary table and IQ UTILITIES statement in exactly the same way as system stored procedures.
Do not eliminate columns or add extra columns.
Do not alter the contents of the table used in the system procedures. Users who call your procedure may also call other procedures that use the same table.
You can change the post-processing of information in the table. You can use any name for the table.
WARNING! You must obey the rules listed here. Violating these rules can cause serious problems for your IQ server or database.
IQ system procedures are in the file iqprocs.sql in the scripts directory of your IQ installation directory.
The syntax for IQ UTILITIES is:
IQ UTILITIES MAIN INTO local-temp-table-name arguments
For examples of how this command is used, refer to the iqprocs.sql file.
The IQ UTILITIES command is not documented in the Sybase IQ Reference Manual except to run the IQ monitor, because of the strict requirements for its use, and the risk to system operations if it is used incorrectly.
The numbers in IQ system procedures are fixed. They will not change from release to release. However, new numbers may be added in future releases.
Give your procedures a different name than the system procedures.