Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 03 Feb 2012 @ 09:51:23 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Use of Union with literals
 
From:   David Wellman

Hi,

When using a UNION (I think any of the set operators - UNION, UNION ALL, MINUS etc) the SELECT statement ** must ** reference a table. I think this is just an ANSI syntax requirement (but not sure).

If you don't have a table that should be used for the query then use one of the system ones, usually a view. Try any of the following:

     Select 'GE' as name
     FROM dbc.dbcinfo
     WHERE infokey = 'release'
     Union All
     Select 'ME' as name
     FROM dbc.dbcinfo
     WHERE infokey = 'release'

     Select 'GE' as name
     FROM dbc.databasesv
     WHERE databasename = user
     Union All
     Select 'ME' as name
     FROM dbc.databasesv
     WHERE databasename = user;

Of the two above options the first will probably perform better and should (!?!?!?!) run on any Teradata system currently being used.

Or of course create your own table with a UPI contaning one row.


Cheers,

Dave



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023