Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    26

    Unanswered: error while selecting

    Hi
    I am executing below stmts inside a procedure
    DECLARE USRID INTEGER;
    SET USRID=(select usrid from pq5.incdnt_all where INCDNT_ID=Incdnt_ID);

    But it is throwing below error
    Value of output parameters
    --------------------------
    Parameter Name : SQL_ERROR_CD
    Parameter Value : -811

    Parameter Name : APP_ERROR_CD
    Parameter Value : 500

    incdnt_is is the primary key of the table.

    Plz help me resolve this issue.

    Thanks
    Surjya

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    the -811 states that the select statement is returning more than one row. You need to alter your select conditions so that you only get a single row returned.
    Dave Nance

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    INCDNT_ID=Incdnt_ID
    From where came INCDNT_ID and Incdnt_ID?
    DB2 is not case sensitive.
    So, both might be considered column of table pq5.incdnt_all.

    Add prefix with table name and your procedure name, like this...
    incdnt_all.INCDNT_ID = procedure-name.Incdnt_ID

    Or, correct the names.

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Another consideration is where do you use USRID?

    If it is used in where clause in another select statement(or cursor), it might be worth to consider to include the scalar-subselect into the select statement(or cursor).

Posting Permissions

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