DelphiFAQ Home Search:
General :: Databases :: InterBase
Help with InterBase, Borland's open source database.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.

Featured Article

Union in InterBase delivers '-104 Data type unknown'

I just had to make a triple union (= 3 select statements) which gave me this error message:

Dynamic SQL Error
-SQL error code = -104
-Invalid command
-Data type unknown


Each on its own, the 3 SQL statements worked fine. Also combining the first and second worked.
The 3rd one contained an additional constant string..

The SQL statements are in the box below.. once I added the CAST (expression AS CHAR(128)), it worked.

The puzzling thing is that select statements 1 and 2 already contained those string constants 'P_' and '_A_'... so why would the union of those two work without a cast? Questions over questions, but the triple union below needs the casts - then it works.

select cast (upper('P_' || p.name || '_A_' || a.name) as char(128)) as fname
 [..]
 
 union
 
 select cast (upper('P_' || p.name || '_A_' || a.name) as char(128)) as fname
 [..]
 
 union
 
 select cast (upper('P_' || p.name || '_A_' || 'World') as char(128)) as fname
 [..]

Generated 0:00:33 on Dec 13, 2017