Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: BLOB writing/reading
A copy of this was sent to "Edward A. Walker" <awalker_at_sombrero.cs.utexas.edu>
(if that email address didn't require changing)
On 3 Sep 1998 22:05:08 GMT, you wrote:
>Hello,
>
>I am having problems using BLOB types. What I want to do is create
>an 180byte field used as a bitfield. Here's what I've done:
>
why use a blob? Just use a RAW type. RAW is sort of like CHAR or VARCHAR in that you need to specify a length (thats the cause of your error below, you just say "raw", not "raw(NN)" where NN is some number). If you want a 180 byte RAW then you would:
create table test ( bitfield raw(180), id number );
you may want to look at the UTL_RAW package which has some bitwise operations for RAW types. UTL_RAW may not be installed by default, its part of the procedural gateway and advanced replication code. If neither of these options are installed then utl_raw won't be. to install utl_raw, goto $ORACLE_HOME/rdbms/admin and look for the files '*raw*' -- there will be 2 of them. when connected as SYS or INTERNAL use svrmgrl to run both the spec and the body. If you read the specification, you'll find the 'documentation' for this package.
>create table test (
>bitfield blob,
>id number);
>
>insert into test values (empty_blob(), 1);
>
>declare
> locator_var blob;
> amount_var integer;
> offset_var integer;
> buffer_var RAW;
>begin
> amount_var :=12;
> offset_var:=1;
> buffervar := 1010;
> select bitfield into locator_var
> from test
> where id=1
> for update;
> DBMS_LOB.WRITE(locator_var, amount_var, offset_var, buffer_var);
>commit;
>end;
>/
>
>The following errors occur:
>
> buffer_var RAW;
> *
>ERROR at line 5:
>ORA-06550: line 5, column 13:
>PLS-00215: String length constraints must be in range (1 .. 32767)
>ORA-06550: line 5, column 13:
>PL/SQL: Item ignored
>ORA-06550: line 9, column 2:
>PLS-00201: identifier 'BUFFERVAR' must be declared
>ORA-06550: line 9, column 2:
>PL/SQL: Statement ignored
>ORA-06550: line 14, column 55:
>PLS-00320: the declaration of the type of this expression is incomplete or
>malformed
>ORA-06550: line 14, column 3:
>PL/SQL: Statement ignored
>
>
>Thanks for any help
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
--
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Sep 04 1998 - 08:41:50 CDT