If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Use of DB2 Views question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-06, 17:04
FiguringItOut FiguringItOut is offline
Registered User
 
Join Date: Sep 2006
Posts: 1
Use of DB2 Views question

Hi, is it possible for a view definition to be the following? or something like it w/o actually selecting anything from a table

SELECT 'X' FROM SYSIBM.SYSDUMMY

We basically want to make the view as fast as absolutely possible and we know the value we want it to return...Is know this is strange, but we cannot eliminate the reference to the view in many different SQLs throughout the system, so we want to alter it to almost act as a host variable value.

Thanks
Reply With Quote
  #2 (permalink)  
Old 09-27-06, 18:43
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
defnitely possible to do this


sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 09-28-06, 01:52
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
CREATE VIEW MA_TRIAL (age, NAME) AS SELECT 26, 'RAHUL' FROM eone.TSYS_EXCLSN_FTRE
DB20000I The SQL command completed successfully.

select * from MA_TRIAL fetch first 1 rows only

AGE NAME
----------- -----
26 RAHUL
Reply With Quote
  #4 (permalink)  
Old 09-28-06, 04:01
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Quote:
Originally Posted by FiguringItOut
SELECT 'X' FROM SYSIBM.SYSDUMMY
Hi,
SYSDUMMY does not exist, there is SYSDUMMY1. You can use for example:
Code:
db2 create view view_schema.view_name
as select 'X' AS ColName from SYSIBM.SYSDUMMY1
Hope this helps,
Grofaty
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On