DelphiFAQ Home Search:

Union in InterBase delivers '-104 Data type unknown'


comments5 comments. Current rating: 5 stars (4 votes). Leave comments and/ or rate it.

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_' || || '_A_' || as char(128)) as fname


select cast (upper('P_' || || '_A_' || as char(128)) as fname


select cast (upper('P_' || || '_A_' || 'World') as char(128)) as fname


2006-03-29, 08:47:05
anonymous from United States  
I realized my mistake as soon as I saw this and can explain what went wrong. The union requires the exact same type and LENGTH. When the third select used a constant instead of, it was no longer the same length of 128 or more correctly the length of and
2006-08-29, 10:05:14
anonymous from Belarus  
2006-11-09, 05:36:04
anonymous from Netherlands  
After developing for over 12 years with Oracle as the backend i'm spoiled with oracle's implicit type casting.
Had been struggling for a couple of hours with a new view before starting googling for the solution. Thanks.
2017-01-10, 14:33:07
anonymous from Indonesia  
Call/Sms Di No_o82_319_2o8_865_ AKI NUGROHO
Insya Allah Beliau Akan Siap Membantu Menyelesaikan Smua Masalah Anda,.
1. Pikiran Yang Positif,
2. Keyakinan Yang Bulat
3. Percaya Bahwa Kita Akan Berhasil
2017-05-19, 16:03:22
Rhonda from Taiwan  
I absolutely love your blog and find the majority of your post's to be just what I'm looking for.
can you offer guest writers to write content available for you?
I wouldn't mind publishing a post or elaborating on some of the subjects you write related to here.
Again, awesome website!



NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: