Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2009
    Posts
    27

    Question Unanswered: 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

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    if you look in messages and code
    SQL20211N
    it indicates the fetch first.... is not allowed
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •