?
Solved

migrating from RAW to ORDImage

Posted on 2003-03-10
2
Medium Priority
?
709 Views
Last Modified: 2012-05-04
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
Comment
Question by:michelek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
Datamonkey earned 200 total points
ID: 8104816
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
 

Author Comment

by:michelek
ID: 8109560
thanks.

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

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question