Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 1851: SELECTs are not UNION compatible. 1

Status
Not open for further replies.

torturedmind

Programmer
Jan 31, 2002
1,052
PH
Hi all,

So here's the scenario: I have a view I SELECTed from a VFP free table from a Novell file server (let's call it NOV_TABLE) and a view that resulted from an SPT with data coming from an Oracle server (let's call it ORA_TABLE). The two tables have equal number of fields and with exact data types. I tried combining them using SELECT...UNION but it just gave me the error similar to the title of this post. I found that the problem is one of the numeric fields in NOV_TABLE doesn't match the field length of ORA_TABLE (lets call it nFieldX). Length of nFieldX in NOV_TABLE is 3 while in ORA_TABLE it is 7. The said field will never exceed 999 so length of 3 is enough. I tried re-querying like so:
Code:
SELECT ;
     ROUND(VAL(TRANSFORM(ora_table1.nstage, "999")), 0) nFieldX ;
     FROM ora_table
but it gives the same field length of 7 everytime. What is a better way of producing the same numeric field lengths for both table?

TIA

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
CAST.

For example CAST(ora_table1.nstage as N(3)) or CAST(ora_table1.nstage as I), and do the same Cast with the other view/table.

Bye, Olaf.
 
@Olaf,
Thank you sir. That did the job. [thumbsup2] Uhmm... Where's that "Thank <member name> for this valuable post!" link? [ponder]

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
I don't see it, too. It must be in each single post, it doesn't make sense anywhere else. As there is only the red flag link, it seems this is temporarily unavailable.

It's more important CAST worked for you, it would have been harder to do without CAST.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top