Why CURRENT is working differently in 4GL and store procedure? (fwd)
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
---------- Forwarded message ----------
Date: Tue, 26 Jan 1999 16:04:57 -0800 (PST)
From: Girish Kagrana <girishk@getafix>
To: informix-list@iiug.com
Subject: Why CURRENT is working differently in 4GL and store procedure?
Why CURRENT is working differently in 4GL and store procedure?
Create Procedure test_current()
Returning integer;
DEFINE X DATETIME YEAR TO SECOND;
DEFINE Y DATETIME YEAR TO SECOND;
LET X = CURRENT;
..
..
Delay loop of 5 minute or any interval
..
..
LET Y = CURRENT;
IF X = Y THEN
Return 1;
ELSE
Return 0;
END IF;
End procedure;
When I executed this procedure it returns me o/p 1 i.e. X and Y is same
That means CURRENT value does not change within store procedure.
If I use the same logic in 4GL program, I find the CURRENT value is not
same for that
Particular program execution instant.
Girish Kagrana wrote: [SNIP] > When I executed this procedure it returns me o/p 1 i.e. X and Y is same > That means CURRENT value does not change within store procedure. > > If I use the same logic in 4GL program, I find the CURRENT value is not > same for that > Particular program execution instant. It is a requirement of ANSI SQL that a stored procedure return a constant value for CURRENT throughout its lifetime. This is the way that Informix implemented CURRENT in SPL to meet the standard. This is a recurring discussion and perhaps should be in the FAQ if it is not already. Anyway you can browse the IUG archives of this group to see previous discussions on the subject. Art S. Kagel
In article <794ght$8u4$1@news.xmission.com>, girishk@infogain.com (Girish Kagrana) wrote: > > > > > ---------- Forwarded message ---------- > Date: Tue, 26 Jan 1999 16:04:57 -0800 (PST) > From: Girish Kagrana <girishk@getafix> > To: informix-list@iiug.com > Subject: Why CURRENT is working differently in 4GL and store procedure? > > Why CURRENT is working differently in 4GL and store procedure? > [cutting] CURRENT is not maintained within the SPL it is only set once when the first procedure is called, subsequent procedures will inherit the value. Within 4gl CURRENT is re-evaluated each time it is called. If you check back through cdi archive I think Peter Lancashire@Bayer came up with the reason but I can't remember it off top of my head. Paul Watson # I don't suffer from WF Software Ltd. # stress, I'm just Tel. (+44) 1436 674729 # a carrier Fax. (+44) 1436 678693 # www.wfsoftware.co.uk
Related threads
- the longer you surf, the MORE $$$ you earn !!
- Store procedure
- emulation for Vt100
- extent size questions again ...