How Do You Insert Long Raw Data?

From: Allan Hoeltje <ahoeltje_at_bearriver.com>
Date: 1996/01/25
Message-ID: <3107D13E.3A78_at_bearriver.com>#1/1


I posted this before but got no answer. Since I think it is a valid question and one which should be covered in an Oracle manual but isn't, I am re-posting it in the hope that MAYBE someone at Oracle will answer it.

I am trying to store a large binary object in a column defined with the LONG RAW data type. I am using OCI from a Macintosh C++ program. I am currently using Oracle 6 but will be moving to Oracle 7 as soon as it arrives, which was supposed to be last month but that is another story.

The book says RAW field values must be represented as quoted hexadecimal strings in the INSERT statement, for example:

  INSERT INTO tbl (f1,f2,rawField) VALUES (42,'xyz','5B5261775F446174615D');

This also means that a 100 byte object now becomes a 200 byte string.

Oracle 6 is limited to 255 byte quoted strings within the INSERT statement but I have read that Oracle 7 has increased this limit to 2000 bytes.

Being as there is a limit on how large the quoted string can be, how do I insert a really large raw value? Can I get around this size limitation if I use a place holder in the INSERT statement? Such as:

  unsigned char * raw_data;
  // allocate 2000 bytes for raw_data and initialize it with whatever   osql3( &curs, "INSERT INTO tbl (f1,f2,rawField) VALUES (42,'xyz',:RAW)", -1 );   obndrv( &curs, ":RAW", -1, raw_data, 2000, SQLT_LRAWHR, ... );

Furthermore, if I use obndrv() to bind the raw value to a place holder does the program variable "raw_data" need to be converted to a hexadecimal character string?

-Allan Received on Thu Jan 25 1996 - 00:00:00 CET

Original text of this message