0
votes

I am trying to display an image in oracle apex 19.1 which is saved as a LONG RAW in the database column.

I have created a new page with a new region.

This is the select sql query in the region as a classic report.

select ID,
       PHOTO
  from MY_TABLE
  where "ID"= '1'

I have changed the type for the PHOTO column as Display Image and in the BLOB Attributes -> BLOB column it shows as varchar2 instead of LONG RAW

And when I run the application I see the following error:

report error:
ORA-00932: inconsistent datatypes: expected CHAR got LONG BINARY
1

1 Answers

0
votes

Oh dear, please don't use the datatype LONG RAW anymore, use BLOB instead. It is deprecated since a couple of decades. (I believe the only reason it's still there is that Oracle uses LONG to store views and defaults.)

EDIT:

According to the documentation, migrating LONG to LOB is actually quite easy. Here is a minimal example:

CREATE TABLE t (id NUMBER PRIMARY KEY, x LONG RAW);
INSERT INTO t VALUES (1, RPAD('a', 2000, 'a'));

The table can be migrated to `BLOB:

ALTER TABLE told MODIFY (x BLOB) LOB (x) STORE AS SECUREFILE;