How to retrieve data of type LONG RAW
Date: 12 Apr 93 12:12:39 GMT
Message-ID: <zhou.734616759_at_batida>
Hi Everybody,
I want to use long raw to store images but cannot to fetch data of type long raw in Pro*C. The table is
Name Null? Type ------------------------------- -------- ---- OBJECTKEY RAW(8) STARTPOS NUMBER(11) NBYTES NUMBER(11) PART LONG RAW
The following test program inserts a tuple into the table CM_3 and tries to fetch the tuple afterwords, but it is terminated with an error
ORA-01460: unimplemented or unreasonable conversion requested
This is the test program:
#include <stdio.h>
#include <ctype.h>
#include <sys/time.h>
/* * oracle declaration area */ EXEC SQL BEGIN DECLARE SECTION; VARCHAR username[20]; VARCHAR password[20]; VARCHAR statement[240]; char Objectkey[16]; int Startpos; int Nbytes; VARCHAR Part[65533];
EXEC SQL END DECLARE SECTION; EXEC SQL INCLUDE sqlca;
main()
{
(void) strcpy(username.arr, "april"); username.len = strlen(username.arr); (void) strcpy(password.arr, "knoedel42"); password.len = strlen(password.arr); EXEC SQL WHENEVER SQLERROR GOTO sqlerror; EXEC SQL CONNECT :username IDENTIFIED BY :password; strncpy(Objectkey, "0001000200030004", 16); Startpos = 0; Nbytes = 10; Part.len = 10; strncpy(Part.arr, "1234567890", 10); /* The insert works ... */ EXEC SQL INSERT INTO CM_3 (OBJECTKEY, STARTPOS, NBYTES, PART) VALUES(:Objectkey, :Startpos, :Nbytes, :Part); /* but I cannot fetch it */ EXEC SQL SELECT PART INTO :Part FROM CM_3; Part.arr[Part.len] = '\0'; printf("Part=%s\n", Part.arr); EXEC SQL COMMIT;; sqlerror: printf("\n% .70s \n", sqlca.sqlerrm.sqlerrmc); EXEC SQL WHENEVER SQLERROR CONTINUE; EXEC SQL ROLLBACK WORK RELEASE; exit(1);
}
I have tried to use dynamic SQL and functions RAWTOHEX and HEXTORAW, but they don't help. Could you give me any hints ? I am using ORACLE C Precompiler Version 1.4.8.2.2 with ORACLE RDBMS V6.0.36.0.2 on a SGI Indigo with IRIX Release 4.0.5F System V. I have also tested the same program on a Sun Sparc 4 with ORACLE RDBMS V6.0.33.1.1 and ORACLE Precompiler Version 1.3.18.1.1 and the results are similar.
Thanks a lot in advance.
Jian
+-------------------------------------------------------------------+ | Jian Zhou: Fraunhofer-Institute for Computer-Graphics | | Wilhelminenstrasse 7 | | W-6100 Darmstadt | | Germany | | email: zhou_at_igd.fhg.de Home: +49/6151/312269 | | Fax: +49/6151/155199 Office: +49/6151/155131 | +-------------------------------------------------------------------+Received on Mon Apr 12 1993 - 14:12:39 CEST