Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Sergio Kapul asked how to use optimizer directives in 4GL/ESQL and set CACHE ON inside a program. Carsten Haese suggested building the query as a string and preparing it. Art Kagel listed the --+, {+ } and /*+ */ syntaxes (the last only in cSDK 3.00+). Kapul got directives working by preparing a string and using the {+ } form. Richard Harnden suggested an SQL ... END SQL block for CACHE; no confirmation.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
looking for correct syntax to create directives inside
queries to overwrite optimizer query execution plan,
to be used in 4gl/esql, I got something that works in straight sql, but it's
ignored when I put it inside of a program.
also, is there a way, syntax, to set CACHE ON inside
the program 4gl/esql or it only can be done at user level
(.profile)
all AIX
thanks
On Wed, 2007-08-08 at 13:35 -0400, sergio kapul wrote:
> looking for correct syntax to create directives inside
> queries to overwrite optimizer query execution plan,
> to be used in 4gl/esql, I got something that works in straight sql, but it's
> ignored when I put it inside of a program.
Optimizer directives are comments, and comment delimiters in SQL are
also comment delimiters in I4GL. Try putting the query text into a
string and prepare the statement from that.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
↪ replying to sergio kapul
Art S. Kagel — — source: Usenet: comp.databases.informix
On Aug 8, 1:35 pm, "sergio kapul" <ska...@comcast.net> wrote:
> looking for correct syntax to create directives inside
> queries to overwrite optimizer query execution plan,
> to be used in 4gl/esql, I got something that works in straight sql, but it's
> ignored when I put it inside of a program.
You can embed using any of the following syntaxes (the last only works
in cSDK 3.00+):
SELECT --+ <directives here>
SELECT {+ <directives here>}
SELECT /*+ <directives here> */
Prior to cSDK 3.00 using /*+...*/ will probably only work within SQL
embedded in a character string built for a prepared statement since
the C preprocessor will replace the comments with whitespace.
Art S. Kagel
> also, is there a way, syntax, to set CACHE ON inside
> the program 4gl/esql or it only can be done at user level
> (.profile)
>
> all AIX
>
> thanks
thanks guys,
what worked for directives in both 4gl/esql was: putting query into a
string, preparing it, and declaring a cursor with {+ <directives>} syntax
any idea, how to set CACHE ON just inside a program?
On 8 Aug, 18:35, "sergio kapul" <ska...@comcast.net> wrote:
> looking for correct syntax to create directives inside
> queries to overwrite optimizer query execution plan,
> to be used in 4gl/esql, I got something that works in straight sql, but it's
> ignored when I put it inside of a program.
>
> also, is there a way, syntax, to set CACHE ON inside
> the program 4gl/esql or it only can be done at user level
> (.profile)
>
> all AIX
>
> thanks
In 4gl you can use an SQL ... END SQL block.
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.