4gl/esql syntax
Posted in 2007
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL
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
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.