Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Wrong values in sqlca.sqlcode, SQLCODE, and SQLSTATE

Re: Wrong values in sqlca.sqlcode, SQLCODE, and SQLSTATE

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 01 Oct 1998 17:40:27 GMT
Message-ID: <3623be1d.107821839@192.86.155.100>


A copy of this was sent to Burkhard Schultheis <bschultheis_at_tde.ra.eunet.de> (if that email address didn't require changing) On Thu, 01 Oct 1998 16:18:42 +0200, you wrote:

>Hello everybody,
>
>I'm developing with the following environment:
>DEC UNIX V4.0,
>Oracle V7.3.2.1.0
>
>Here is my test program:
>
>EXEC SQL INCLUDE sqlca;
>
>EXEC SQL BEGIN DECLARE SECTION;
> char *uid = "lzgneu/lzg";
> long SQLCODE;
> int a;
>EXEC SQL END DECLARE SECTION;
>
> char SQLSTATE [6];
>
>void main (void)
>{
> EXEC SQL CONNECT :uid;
>
> printf ("sqlca.sqlcode: %ld, SQLCODE: %ld, SQLSTATE: %s\n",
> sqlca.sqlcode, SQLCODE, SQLSTATE);
>
> EXEC SQL SELECT * INTO :a FROM lzgneu.test;
> printf ("sqlca.sqlcode: %ld, SQLCODE: %ld, SQLSTATE: %s\n",
> sqlca.sqlcode, SQLCODE, SQLSTATE);
>}
>
>Table test is created as
>Create table test (a integer);
>Table test is empty.
>
>I compiled this program with
>proc sqlcheck=full userid=lzgneu/lzg auto_connect=yes mode=ansi
>iname=test.pc
>and
>cc -Wl,-rpath,/db/oracle/lib -o testoracle -g
>-I/db/oracle/precomp/public -L/db/oracle/lib -lclntsh -ldnet_stub test.c
>
>The output from this program is as follows:
>
>sqlca.sqlcode: 0, SQLCODE: 0, SQLSTATE:
>sqlca.sqlcode: 3544382665317613593, SQLCODE: 3544382665317613593,
>SQLSTATE:
>
>Why I get so silly values? I have checked sizeof (sqlca.sqlcode): 8. Who
>

try using:

CFLAGS=-O2 -Olimit 4500 -std1 -DOSF1 -DA_OSF -Wf,-readonly_strings -D_INTRINSICS -w1 -misalign

I think, if i remember, the important ones are -DOSF1 and -DA_OSF .... Otherwise you get a mixture of 64bit ints and 32bit ints (which is what you are seeing right now)....

>can help?
>Thank you!
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Oct 01 1998 - 12:40:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US