SQLin 4GLNot Working ......
Posted in 1997
This is a multi-part message in MIME format.
--------------731876266FC6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
John Cokos wrote:
>
> ------------BA32E9F5BB31
> Content-Transfer-Encoding: 7bit
> Content-Type: text/plain; charset=us-ascii
>
> I'm having trouble with the following statement....
>
> LET cTable = "customers"
> SELECT count(*) INTO nCount FROM cTable
> WHERE status = "DEAD">
> I get an error stating that cTable is not in the database.
>
Having used 4gl through 4.x, I can tell you this doesn't work because
4gl evaluates cTable as the literal name, not a variable. Therefore, the
recourse would be to use the PREPARE method.
> I have tried the following, with the same results.
> LET cSQL = "SELECT count(*) FROM ", cTable
> " WHERE status = ", "\\"" DEAD, "\\""
> PREPARE qSQL FROM cSQL
> DECLARE q_cur CURSOR FOR qSQL
> FOREACH q_cur INTO nCount
> END FOREACH
>
> If I do a ... MESSAGE cSQL after the above code, the select
> statemente is correct
> (customers appears, not cTable)
>
> What am I missing here?
>
I have a strong feeling that the issue is related to the WHERE status =
clause. Likely, Informix is confused by status. I once had a table named
status and built a program around it. The funny thing was that things
worked fine until I ran in some strange situation. Ultimately, I renamed
the table.
Before you do something like that, try:
LET cSQL = "SELECT count(*) FROM ", cTable
" WHERE ", cTable CLIPPED, ".status = ", "\\"" DEAD, "\\""
> Thanks
> John Cokos
Hope this helps...
Tim
--------------731876266FC6
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
>Received: from bfny by mail.sisna.com Sun Feb 02 07:59:27 1997
>Received: from rmy.rmy.emory.edu (170.140.97.4) by bfny.bigfoot.com with SMTP ( Bigfoot SMTP Server Jan 31 1997 15:52:21 ); Sun, 02 Feb 1997 10:04:37 -500 (Eastern Standard Time)
>Received: (from ilist@localhost) by rmy.rmy.emory.edu (8.7.1/8.7.1) id KAA15862 for timhood@bigfoot.com; Sun, 2 Feb 1997 10:04:36 -0500 (EST)
>From: John Cokos <jcokos@ix.netcom.com>
>Message-Id: <32F43683.C44@ix.netcom.com>
>Subject: SQLin 4GLNot Working ......
>Date: Sun, 02 Feb 1997 01:38:59 -0500
>Reply-To: John Cokos <jcokos@ix.netcom.com>
>Organization: Netcom
>Sender: informix-list-owner@rmy.emory.edu
>X-Informix-List-To: timhood@bigfoot.com
>X-Informix-List-Id: <news.33316>
------------BA32E9F5BB31
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
I'm having trouble with the following statement....
LET cTable = "customers"
SELECT count(*) INTO nCount FROM cTable
WHERE status = "DEAD"
I get an error stating that cTable is not in the database.
I have tried the following, with the same results.
LET cSQL = "SELECT count(*) FROM ", cTable
" WHERE status = ", "\\"" DEAD, "\\""
PREPARE qSQL FROM cSQL
DECLARE q_cur CURSOR FOR qSQL
FOREACH q_cur INTO nCount
END FOREACH
If I do a ... MESSAGE cSQL after the above code, the select
statemente is correct
(customers appears, not cTable)
What am I missing here?
Thanks
John Cokos
--
+-------------------------------------------------------+
_/_/_/_/_/_/_/ _/_/_/_/_/_/_/ _/_/_/_/_/_/_/
_/_/ _/_/ _/_/
_/_/ _/_/ _/_/_/_/_/_/_/
_/_/ _/_/ _/_/
_/_/ _/_/ _/_/
_/_/_/_/_/_/_/ _/_/_/_/_/_/_/_/ _/_/_/_/_/_/_/
Call Center Solutions...Database Management / Design
List Brokerage
Barcoding / Caging Services
V:(609)546-0434 F:(609)310-0575
+-------------------------------------------------------+
------------BA32E9F5BB31
Content-Transfer-Encoding: 7bit
Content-Type: text/html; charset=us-ascii
<HTML><BODY>
<DT> I'm having trouble with the following statement....</DT>
<DT> </DT>
<DT> LET cTable = "customers"</DT>
<DT> SELECT count(*) INTO nCount FROM cTable</DT>
<DT> WHERE status = "DEAD"</DT>
<DT> </DT>
<DT> I get an error stating that cTable is not in
the database.</DT>
<DT> </DT>
<DT> I have tried the following, with the same results.</DT>
<DT> LET cSQL = "SELECT count(*) FROM ",
cTable</DT>
<DT>
" WHERE status = ", "\\"" DEAD, "\\""</DT>
<DT> PREPARE qSQL FROM cSQL</DT>
<DT> DECLARE q_cur CURSOR FOR qSQL</DT>
<DT> FOREACH q_cur INTO nCount</DT>
<DT> END FOREACH</DT>
<DT> </DT>
<DT> If I do a ... MESSAGE cSQL after the above
code, the select statemente is correct</DT>
<DT> (customers appears, not cTable)</DT>
<DT> </DT>
<DT> What am I missing here?</DT>
<DT> </DT>
<DT>Thanks</DT>
<DT>John Cokos<BR>
-- <BR>
+-------------------------------------------------------+<BR>
<BR>
_/_/_/_/_/_/_/ _/_/_/_/_/_/_/
_/_/_/_/_/_/_/<BR>
_/_/
_/_/
_/_/<BR>
_/_/
_/_/
_/_/_/_/_/_/_/<BR>
_/_/
_/_/
_/_/<BR>
_/_/
_/_/
_/_/<BR>
_/_/_/_/_/_/_/ _/_/_/_/_/_/_/_/ _/_/_/_/_/_/_/<BR>
<BR>
Call Center Solutions...Database Management / Design<BR>