SQL returns diff results in ESQL and Power Builder
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration
Hi guys,
We have a SQL like below in an ESQL/C program
select count(*) in :var
from ...... where ....
When we execute it from ESQL/C it returns 1 in var
When we execute it from Power Builder or Dbaccess it returns 0 in var
We are sure that the result from Power Builder and Dbaccess is right.
Does any body know why sql from ESQL/C gives wrong results
Thanks in advance
Vinod Bhansali
Informix DBA
DSL Transportation
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
Vinod Bhansali wrote:
> Hi guys,
>
> We have a SQL like below in an ESQL/C program
> select count(*) in :var
is that:
SELECT count(*)
INTO :hostvar
FROM ...
WHERE ...;
What do you get if you run the query (without the INTO clause) in
dbaccess/isql?
Does it return 1 or 0? Are you checking the error returns after the
SELECT? You
must check either SQLCODE or sqlca.sqlcode (the Informix specific error
handlers) or use ANSI exception handling procedures to determine if the
SELECT
was successful and if not why. Most simply print out the values of
sqlca.sqlcode
and sqlca.sqlerrd[1] to see the SQL (high) level and ISAM (low) level error
codes
reported from the engine and libraries.
Art S. Kagel
> from ...... where ....
>
> When we execute it from ESQL/C it returns 1 in var
> When we execute it from Power Builder or Dbaccess it returns 0 in var
>
> We are sure that the result from Power Builder and Dbaccess is right.
>
> Does any body know why sql from ESQL/C gives wrong results
>
> Thanks in advance
> Vinod Bhansali
> Informix DBA
> DSL Transportation
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com