Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2017
    Posts
    5

    Answered: sql code -803 sqlstate 23050 on sql select

    Hi,

    My application program (ETL job) is failing with -803 sql code. The application program is a simple job with DB2 stage as input and flat file as target. The source DB2 stage has a user defined sql to fetch data.
    When I run my datastage application getting error "SQL fetch reported SQLSTATE = 23505; Native error code -803". What could be reason for getting -803 on select sql? Please advice what is causing the job to fail.

    Thanks.

    Sorry for the typo...SQLSTATE is 23505, not 23050
    Last edited by s532; 04-02-17 at 12:11.

  2. Best Answer
    Posted by mark.bb


  3. #2
    Join Date
    Jan 2003
    Posts
    4,310
    Provided Answers: 5
    Do you know what the select statement is?

    Andy

  4. #3
    Join Date
    Apr 2017
    Posts
    5

    SQL statement

    Quote Originally Posted by ARWinner View Post
    Do you know what the select statement is?

    Andy
    The SQL statement is something like below...

    select A.column1
    ,A.column2
    , coalesce (case when Z.columnB = 'A' then Z.column2 else '0')
    ,B.Column3
    ,B.Column4
    from table1 A
    join table2 C
    on matching columns from A and C and some other predicates
    left outer join table3 D
    on matching columns from A and D and some other predicates
    left outer join table4 B
    on matching columns from D and B and and some other predicates
    left outer join (select distinct columnA, ColumnB
    from tablex X, table Y
    where matching columns from X = matching columns from Y and some other predicates) AS Z
    on matching column from C and Z

  5. #4
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    259
    Provided Answers: 39
    Hi,

    Does yor job use buffered inserts?
    What's the previous statement executed in the job before this select?
    Regards,
    Mark.

  6. #5
    Join Date
    Apr 2017
    Posts
    5
    Quote Originally Posted by mark.bb View Post
    Hi,

    Does yor job use buffered inserts?
    What's the previous statement executed in the job before this select?
    There is no other processing before running the SQL statement and buffering is default.

    Also the error message is showing sqlcode -803 on TEMP....actual error message is "One or more values in the INSERT statement, UPDATE statement or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "<12121><MY user id>.TEMP (01203,00023)" from having duplicate values for the index key". SQLSTATE = 23505: Native Error code = -803

    Does above error mean the SQL is fetching duplicate data? and failing with -803 when inserting into TEMP?

    My ETL jobs is simple
    DB2Stage -----> Sequential file (no other transformations in between)

    Thanks.

  7. #6
    Join Date
    Jul 2016
    Location
    Moscow
    Posts
    259
    Provided Answers: 39

Posting Permissions

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