Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> how to read and write LONG RAW TYPE BYE PROC
Pleas help me . look up these code is right?
proc + oracle8.1.7
TEST_LONG
CREATE TABLE TEST_LONG
(
ID NUMBER(4),
DATA LONG RAW
)
DATA 'S FORMAT IS A ST_HEAD+ N*ST1
struct
{
unsigned long pos_st1;
unsigned long pos_st2;
}st_head;
struct
{
char c1[10];
char c2[20];
}st1;
struct
{
char c3[30];
int l;
}st2;
EXEC SQL BEGIN DECLARE SECTION;
unsigned char h_szData[16000]; /* DATA LONG RAW */
EXEC SQL END DECLARE SECTION;
EXEC SQL SELECT
DATA
INTO
:h_szData
FROM
TEST_LONG
WHERE
ID = 1;
if( sqlca.sqlcode == 0 )
{
// get data head
memcpy( st_head, h_szData, sizeof( st_head ) );
// get st1
memcpy( st1, h_szData+st_head.pos1, sizeof( st1 ) );
// get st2
memcpy( st2, h_szData+st_head.pos2, sizeof( st2 ) );
}
Received on Thu Aug 22 2002 - 21:56:03 CDT
![]() |
![]() |