Setting FLOAT with OCI
Date: 10 Oct 92 00:46:14 GMT
Message-ID: <1992Oct10.004614.4954_at_exu.ericsson.se>
Hi,
I have problem with columns of type FLOAT, using the OCI functions in ORACLE V6.0.33.2.3, on SunOS 4.1, SPARCstation IPX.
Reading columns of type FLOAT works fine, but I get a core dump from low level ORACLE routines when I insert a new row.
Sample program:
main()
{
csrdef csr; ldadef lda; float f; .
.
.
printf("Getting FLOAT value ...\n");
if (oopen(&csr, &lda, -1, -1, -1, -1, -1)) { return (1);
}
if (osql3(&csr, "SELECT VALUE FROM FLOAT_VALUE WHERE ID = 1", -1)) { return (1);
}
if (odefin(&csr, 1, &f, sizeof(float), 4, -1, -1, -1, -1, -1, -1, -1)) { return (1);
}
if (oexec(&csr)) {
return (1);
}
if (ofetch(&csr)) {
return (1);
}
printf("Got %f\n", f);
printf("Setting FLOAT value ...\n");
if (osql3(&csr,
"INSERT INTO FLOAT_VALUE VALUES(FLOAT_VALSEQ.NEXTVAL, :p_value)", -1)) {
return (1);
}
if (obndrv(&csr, ":p_value", -1, &f, sizeof(float), 4, -1, -1, -1, -1, -1)) {
return (1);
}
if (oexec(&csr)) {
return (1);
}
. . .
exit(1);
}
The program produces this output:
Getting FLOAT value ...
Got 2.340000
Setting FLOAT value ...
Segmentation fault (core dumped)
The table FLOAT_VALUE is created as:
create table float_value (id integer not null, value float not null);
and a value inserted via SQL*Plus:
insert into float_value values(1, 2.34);
dbx shows me the following call stack when I analyze the core file:
atom% dbx t1
Reading symbolic information...
Read 1397 symbols
program terminated by signal SEGV (no mapping at the fault address)
(dbx) where
oarren() at 0x2d178 ttcf2n() at 0x26890 ttcacs() at 0x242e4 ttcdrv() at 0x119d8 osntwa() at 0xa15c upirtr() at 0x10aec upiexe() at 0xc6f4 ociexe() at 0x3c08
main(), line 52 in "t1.c"
Any help would be appreciated!
/Hans
Hans Bergsten Internet : ebuhob_at_ebu.ericsson.se Ericsson Business Communications MEMO : ERI.EBU.EBUHOB (God forbid.) 525 N. Muller St. Voice : +1 (714) 491-6264 Anaheim, CA 92803, USA FAX : +1 (714) 535-1789Received on Sat Oct 10 1992 - 01:46:14 CET