Skip to Main Content

Breadcrumb

May 4th

Question and Answer

Tom Kyte

Thanks for the question, Subramanya .

Asked: May 02, 2000 - 1:21 pm UTC

Last updated: October 05, 2001 - 11:52 am UTC

Version:

Viewed 1000+ times

You Asked

Please could you tell me how to insert/
read from the Long Raw column of
a table using PL/SQL ?



and Tom said...



If the LONG RAW is always 32k or less you can do this in plsql. If it may exceed 32k in size, plsql *cannot* manipulate it in any way shape or form.

If the long raw is 32k or less, you simply declare a variable of type LONG RAW:

declare
my_var long raw;
begin
....


and then you can select into it:

...
select my_long_raw_column into my_var from T where condition;
...

To insert a long raw, you do the same as above, only use MY_VAR in an insert statement.


In order to fully manipulate long raws, you must use a 3gl such as VB or C/C++. In Oracle8 release 8.0 and up, a new datatype LOB is introduced. PLSQL has full read-write access to a LOB using the builtin DBMS_LOB package. See </code> http://docs.oracle.com/cd/A81042_01/DOC/appdev.816/index.htm <code>if you would like to read about that.


Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Manipulate a long raw in PL/SQL

Harry, October 05, 2001 - 8:58 am UTC

I have long raw wich are longer than 32k, so it is not useful to me.
I have bitmaps in a long raw column which have about 100k an i want them to copy from table to another.
But I have no idea about how to do this.

Tom Kyte
October 05, 2001 - 11:52 am UTC

You must use a 3gl such as C, Java or even VB to do it. As stated below, you cannot use plsql.

You should use a blob in 8.0 and above -- incredibly flexible, this would be trivial with a blob and SQL straight out.

More to Explore

CLOB/BLOB/etc

Complete documentation on Securefiles and Large Objects here