🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #970

Select from variable

#970
From: aleplgr
Date: Mon, 02 Apr 2007 17:04
31 lines
1802 bytes
Hi! I'm writing a stored procedure, for this table:

CREATE TABLE TEMPORALPRUEBA1 (
  CLIENTID INTEGER,
  DATE2 DATE,
  DATE1 DATE,
  GENE INTEGER NOT NULL);


first I select the max and min CLIENTIDs and store them in the MAXCLIENTID and MINCLIENTID variables this works fine, although I'm not sure this is the way to do it:

SELECT MAX(CLIENTID) FROM TEMPORALPRUEBA1 INTO :MAXCLIENTID;
SELECT MIN(CLIENTID) FROM TEMPORALPRUEBA1 INTO :MINCLIENTID;

But then I need to select using the variable MINCLIETNID as a condition and store it in the variable IDMAX: 

 SELECT MAX(GENE) FROM TEMPORALPRUEBA1 WHERE 
 CLIENTID = MINCLIENTID  INTO :IDMAX;

and I'm getting the error
 Column unknown MINCLIENTID.

MINCLIENTID is the name of a variable in the procedure:
DECLARE VARIABLE MAXCLIENTID SMALLINT;
DECLARE VARIABLE MINCLIENTID SMALLINT;

I'm writing the procedure in EMS SQL MANAGER 2005 for InterBase/ firebird and I'm getting the error when I compile the procedure


 
Technical Details
Message-ID: <46112987$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,9d569d1fdba243ad,start
X-Google-Attributes: gid114a0e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "aleplgr" <aleplgr@yahoo.es>
Sender: "aleplgr" <aleplgr@yahoo.es>
Reply-To: "aleplgr" <aleplgr@yahoo.es>
Subject: Select from  variable
Newsgroups: borland.public.interbase.sql
X-User-Info: 80.58.205.38     
X-Forwarded-For: 80.25.195.180, 192.168.1.55
NNTP-Posting-Host: 207.105.83.66
Message-ID: <46112987$1@newsgroups.borland.com>
Date: 2 Apr 2007 09:04:23 -0800
X-Trace: newsgroups.borland.com 1175529863 207.105.83.66 (2 Apr 2007 09:04:23 -0800)
Lines: 32
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail