Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 740
  • Last Modified:

migrating from RAW to ORDImage

task is to select image data from LONG RAW column of first table
and insert it int ORDImage column of second table.

what I have done so far:

INSERT INTO table2
SELECT T1.id,
       ORDSYS.ORDImage(
          ORDSYS.ORDSource( TO_BLOB(T1.picture),NULL,NULL,NULL,SYSDATE,1 ),
          NULL,NULL,NULL,NULL,NULL,NULL,NULL )
  FROM table1 T1;

curiously I get the error:
ORA-00932: inconsistent datatypes: expected BINARY got BINARY

Thank You in advance
0
michelek
Asked:
michelek
1 Solution
 
DatamonkeyCommented:
michelek - I get the same error trying to convert LONG RAW into a BLOB using TO_BLOB. I reckon there's something wrong with the implementation of TO_BLOB. It doesn't seem to do what it says it should!

The best (only!) workaround I can come up with which avoids this ora-932 is to use TO_LOB (not TO_BLOB) to convert PICTURE into a normal BLOB column and then move that directly into the ORDIMAGE, e.g.

create table blob_stage (id number, picture BLOB) ;
insert into blob_stage select t1.id,to_lob(t1.picture) from table1 ;
insert into table2 select id, ORDSYS.ORDImage( ORDSYS.ORDSource( picture, NULL, NULL, NULL, SYSDATE, 1 ), NULL, NULL, NULL, NULL, NULL, NULL, NULL )
 FROM blob_stage ;

which seems OK. Annoyingly if I use TO_LOB with ORDSource I also get the ora-932.
0
 
michelekAuthor Commented:
thanks.

it solves the problem.
I will try to query for images using some lookup procedure also
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now