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 > create view problem in db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-22-09, 08:43
vivek.vivek vivek.vivek is offline
Registered User
 
Join Date: Jan 2009
Posts: 27
Question create view problem in db2

Showing Error in the ststement
DB2 SQL error: SQLCODE: -20211, SQLSTATE: 428FJ, SQLERRMC: null

CREATE VIEW LimitView AS
SELECT lcl,ucl,cl FROM DBO.THRESHOLD
WHERE
DBO.THRESHOLD.paramname='RPM of Spray Pump'
AND
DBO.THRESHOLD.stepname='Achieve the desired parameters for pressure, temperature and RPM'
AND
DBO.THRESHOLD.productname='Curin'
AND
DBO.THRESHOLD.unitoperationname='Wet Granulation, Drying & Final Blending'
FETCH FIRST ROW ONLY
Reply With Quote
  #2 (permalink)  
Old 01-22-09, 10:34
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
if you look in messages and code
SQL20211N
it indicates the fetch first.... is not allowed
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 01-23-09, 07:11
vivek.vivek vivek.vivek is offline
Registered User
 
Join Date: Jan 2009
Posts: 27
DB2 View help

Hi,
Please help me to convert this view.

query1:='CREATE OR REPLACE VIEW Step47view AS
SELECT * FROM (
SELECT * FROM(
SELECT * FROM (
SELECT time_stamp ' || query1 ||' FROM '|| Param9 ||' GROUP BY time_stamp ORDER BY
time_stamp DESC
)
WHERE
time_stamp >= TO_DATE('''||Param4||''',''MM/DD/YYYY HH24:MIS'')
AND
time_stamp <=TO_DATE('''||Param3||''',''MM/DD/YYYY HH24:MIS'')
AND ROWNUM<='||Param11||'
)
'||Param9||'
ORDER BY
time_stamp
ASC
) WHERE ROWNUM<='||Param10;

I am facing problem in rownum part. I changed that to "FETCH FIRST N ROWS". But its showing error that that cant be used with create view.
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