Home » Developer & Programmer » Precompilers, OCI & OCCI » SQLCode = -904
SQLCode = -904 [message #94341] Wed, 11 August 2004 19:41
RR
Messages: 19
Registered: October 2001
Junior Member
Following is the proc test code I downloaded from web.

After precompile and compile , when I try to run the executable it gives an error code -904. Any Ideas ??

It compiles fine and actually prints two lines one from found: clause and other from error clause.

#include <stdio.h>
#include <sqlca.h>
#include <oraca.h>

void sqlerror();

EXEC SQL BEGIN DECLARE SECTION;
char *connstr = "scott/tiger";
char db_ename[[30]];
int db_deptno;
EXEC SQL END DECLARE SECTION;

void main() {
EXEC SQL WHENEVER SQLERROR DO sqlerror();
EXEC SQL WHENEVER SQLWARNING CONTINUE;
EXEC SQL CONNECT :connstr;

EXEC SQL WHENEVER NOTFOUND GOTO notfound;
EXEC SQL SELECT ENAME, DEPTNO
INTO db_ename, db_deptno
FROM EMP
WHERE EMPNO = 7369;

found:
printf("%s is in department %in", db_ename, db_deptno);
return;

notfound:
printf("Employee record not found in database.n");
return;
}

void sqlerror() {
printf("Stop Error:t%25in", sqlca.sqlcode);
return;
}

proc iname=test.pc

bash-2.03$ gcc -m64 test.c -o test -L/opt/oracle/u01/app/oracle/product/9.2.0/li
b/ -L/opt/oracle/u01/app/oracle/product/9.2.0/rdbms/lib/ -lclntsh -locci9 -lclie
nt9 -lclntst9 -lcommon9 -ldm9 -lldapclnt9 -lnldap9 -lordim9 -lserver9 -lctxc9 `c
at /opt/oracle/u01/app/oracle/product/9.2.0/lib/ldflags` `cat /opt/oracle/u01/
app/oracle/product/9.2.0/lib/sysliblist` -R/opt/oracle/u01/app/oracle/product/9.
2.0/lib -laio -lposix4 -lkstat -lm -lthread

--Ouput

Stop Error -904
is in department 0
~
~

Solaris 8 Oracle 9i
Previous Topic: C+ and Oracle
Next Topic: Newbie with a question.
Goto Forum:
  


Current Time: Thu Mar 28 20:27:30 CDT 2024