> Could anyone tell me whether the EXEC SQL PREPARE statement is to be
> interpreted by the preprocessor or during run-time? That is can it be
> placed outside a function? Does it have to stand above the DECLARE or
> EXECUTE statement that references it or does it have to be executed
> prior to this statement?
> The DECLARE statement AFAIK is to be processed by the preprocessor.
> Hopefully that one is correct too. :-)
Pretty sure that PREPARE is a run-time thing, since you can dynamically
build the sql statement fed to PREPARE.
In fact, looking at my Ingres docs:
"Dynamic SQL has four statements that are exclusively used in a dynamic
program: 'execute immediate', 'prepare', 'execute', and 'describe'."
In another section, it says:
"The 'prepare' statement tells the DBMS to encode the dynamically built
statement and assign it the specified name. After a statement is
prepared, the program can execute the statement one or more times within
a transaction by issuing the 'execute' statement and specifying the
statement name. This method improves performance if your program must
execute the same statement many times in a transaction. When you commit
a transaction, all statements that were prepared during the transaction
are discarded."
Hope this helps...
- Tom