Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Q: OCI functions
I have a C program calls OCI functions to access Oracle. I set up an
unique constrain for the field1. When I try to insert a record whose
field1 exists, it prints out the error message.
ORA-00001: unique constraint (TEST.MIDX) violated
Processing OCI function OEXEC, OEXN
At position: 0
It continually executes codes in the main routine and print out "ROLLBACK", then core dumps. I use debugger to trace it, where cda.rc=3114 before it core dumps. The core dumps happen only when I try to insert more than 15 fields. If I insert less than 15 fields, then it's ok. It seems that if I insert more fields, the lda and hda data structure will be destroyed and the session will be disconnected. I verify it through MONITOR SESSION in SQL*DBA. Is it another bug of Oracle or there's something wrong of my codes? I'm running Oracle 7.2.3 on the SGI Indy.
Any suggestion is welcome. Please email to me diretly at alantai_at_multiactive.com.
Thanks in advance.
Alan
Some of the codes look like:
/* hda, lda, cda are global variables */
int Insert(const char* query)
{
char oracle_errmsg[256];
/* insert */
oparse(&cda, (text *)query, -1, 1, 2);
if (oexec(&cda)){
oerhms(&lda, cda.rc, (text *)oracle_errmsg, MAX_MSG);
printf("%s \n", oracle_errmsg);
return -1;
}
return 0;
}
main ()
{
/* codes logon and open cursor */
if (Insert("INSERT INTO table1(field1) VALUES('value')"))
{
/* some codes here */ printf ("ROLLBACK \n"); oparse(&cda, (text *)"ROLLBACK", -1, 1, 2); oexec(&cda);
/* more codes here */
}
Received on Thu Apr 10 1997 - 00:00:00 CDT
![]() |
![]() |