Margus =?iso-8859-1?Q?V=E4li?= <mvali@kirmus.ee> wrote:
:hi there
:
:4gl 4.20 wd1: got 4 cursors in one module, different names and all,
:and the error file looks as follows. Could anyone please point
:out what's wrong with it?
:
:function raport_ajal()
:.
:.
:.
: prepare l6pp_lause from sel_lause -- teeme executable SQL lause
: declare k_ajal cursor for l6pp_lause
:.
:.
:.
:end function
:
:
:function raport_ajak()
:.
:.
:.
: prepare l6pp_lause from sel_lause -- teeme executable SQL lause
: declare k_ajak cursor for l6pp_lause
:|
:| Cursors must be uniquely declared within one program module.
:| See error number -4371.
It's your l6pp_lause which is the same as above.
Both prepared statement names and declared cursor names should be
unique over all your source modules (yes, yes, in 4.x versions of 4GL
they only need to be unique within a module, but that was *allways* a
very bad programming practice that will hit you hard with version 6.x
of 4GL).
We allways prepare/declare like this:
prepare s_xxx from l_charvariable
declare c_xxx cursor for s_xxx
to avoide problems with non unique names and name collisions with
everything else (variables, databases, tables, columns.....).
s_ - prepared statement
c_ - declared cursor
l_ - local simple variable
lr_ - local record
la_ - local array
g_ - global simple variable
and so on.
:.
:end function
:
:on and on 2 more times like this (got 4 functions containing
:curson declarations, l6pp_lause is a local scope char variable)
Assuming sel_lause is a char variable. l6pp_lause shouldn't be
defined. It's "defined" by the prepare statement.
:thanks for your time,
:mv
Nils.Myklebust@idg.no
NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway
My opinions are those of my company
The Informix FAQ is at http://www.iiug.org