[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: SQL error on DB2



Try using "values" before select and use parentheses

        -----Original Message-----
        From:   Don Lee [SMTP:dlee@ALGOMA.COM]
        Sent:   Wednesday, June 03, 1998 11:33 AM
        To:     Multiple recipients of list SQR-USERS
        Subject:        SQL error on DB2

        Hi,
         
        The following is a piece of code from an SQR, followed by it's
error statement.  The database platform is DB2.  Any suggestions on how
to correct this error would be greatly appreciated.
         
        INSERT INTO HRCNV.PS_EMPL_WAGELS_CAN
        SELECT A.EMPLID, A.COMPANY, A.EFFDT, 0, A.WAGE_LOSS_PLAN
        FROM   HRCNV.PS_CAN_TAX_DATA A
        WHERE NOT EXISTS (SELECT 'X' FROM HRCNV.PS_EMPL_WAGELS_CAN B
                           WHERE B.EMPLID = A.EMPLID
                             AND B.COMPANY = A.COMPANY
                             AND B.EFFDT = A.EFFDT
                             AND B.EMPL_RCD# = 0)
        
        --------------------------- Command entered
----------------------------
        INSERT INTO HRCNV.PS_EMPL_WAGELS_CAN
        SELECDB21034E  The command was processed as an SQL statement
because it was
        not a
        valid Command Line Processor command.  During SQL processing it
returned:
        SQL0118N  The table or view that is the target of the INSERT,
DELETE, or
        UPDATE statement is also specified in a FROM clause. 
SQLSTATE=42902