TheLifeOfSteve
TheLifeOfSteve

Reputation: 3288

ORA-00932 inconsistent datatypes: expected - got BLOB

I have this query I am trying to run but I keep running into this error. I am trying to do a Where clause that compares the data (BLOB column) to :var2 which is a blob object.

Here is my code.

SELECT max(id) 
INTO :var1
FROM table_name 
where data = :var2;

Any suggestions to why I would be getting this ORA-00932 error?

I am comparing a blob to a blob column, shouldn't that be fine?

Thanks

Upvotes: 5

Views: 9926

Answers (1)

Brian
Brian

Reputation: 7289

They aren't simple types and you need to use a function to compare them.

SELECT max(id) 
INTO :var1
FROM table_name 
where dbms_lob.compare(data,:var2) = 0;

Upvotes: 10

Related Questions