Home » SQL & PL/SQL » SQL & PL/SQL » Inconsistent Datatypes
Inconsistent Datatypes [message #395301] Wed, 01 April 2009 01:58 Go to next message
Maverick27
Messages: 84
Registered: October 2008
Member
DECODE (dbms_lob.getlength(Photo),0,'No image',Photo)

This DECODE statement gives an error > 'Inconsistent Datatype'

Photo is a BLOB column in the table.

I get the same err with CASE statement.

I want to display the image only if it has been uploaded, else display appropriate message.

Is there a way to overcome this ?

Mave

[Updated on: Wed, 01 April 2009 02:01]

Report message to a moderator

Re: Inconsistent Datatypes [message #395304 is a reply to message #395301] Wed, 01 April 2009 02:04 Go to previous messageGo to next message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
'No image' and Photo should be of the same type to be used at the same time in DECODE.
If PHOTO is binary type you can't do it in the same way that Photoshop can't display 'No image' string.

Now SQL does not display anything, it jusr return data, it is your application that displays. So return NULL when in your decode and displays NULL as 'No image'.

Regards
Michel
Re: Inconsistent Datatypes [message #395376 is a reply to message #395304] Wed, 01 April 2009 04:37 Go to previous messageGo to next message
Maverick27
Messages: 84
Registered: October 2008
Member
Michel Cadot wrote on Wed, 01 April 2009 02:04
'No image' and Photo should be of the same type to be used at the same time in DECODE.
If PHOTO is binary type you can't do it in the same way that Photoshop can't display 'No image' string.

Now SQL does not display anything, it jusr return data, it is your application that displays. So return NULL when in your decode and displays NULL as 'No image'.

Regards
Michel



Thanks Michel.

Is there no way to display message on report to show if image is not uploaded ??
Re: Inconsistent Datatypes [message #395378 is a reply to message #395376] Wed, 01 April 2009 04:39 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Depends on which reporting tool you use.
Re: Inconsistent Datatypes [message #395379 is a reply to message #395378] Wed, 01 April 2009 04:52 Go to previous messageGo to next message
Maverick27
Messages: 84
Registered: October 2008
Member
ThomasG wrote on Wed, 01 April 2009 04:39
Depends on which reporting tool you use.


Oracle Report Builder
Re: Inconsistent Datatypes [message #395381 is a reply to message #395378] Wed, 01 April 2009 04:54 Go to previous messageGo to next message
Maverick27
Messages: 84
Registered: October 2008
Member
so it's not possible to achieve it programtically i.e SQL ??
Re: Inconsistent Datatypes [message #395386 is a reply to message #395381] Wed, 01 April 2009 05:05 Go to previous messageGo to next message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Well, you definetely can't "display an image" in SQL.

You can either do an

DECODE (dbms_lob.getlength(Photo),0,'No image','Image')


or an

DECODE (dbms_lob.getlength(Photo),0,SomeDefinedDefaultImageBlob,Photo)


Depending on whether the reporting tool displays image blobs as images or not.
Re: Inconsistent Datatypes [message #395387 is a reply to message #395381] Wed, 01 April 2009 05:07 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SQL is an interface from database to program. It is NOT an interface from program (or database) to user.

So it is more a report builder question.

Regards
Michel
Previous Topic: regular expression (merged)
Next Topic: Typical Function
Goto Forum:
  


Current Time: Sat Dec 14 14:44:41 CST 2024