View previous topic :: View next topic
|
Author |
Message |
madlui56
New User
Joined: 08 Aug 2006 Posts: 61 Location: Philippines
|
|
|
|
What does this mean SQLCODE -811 and solution for this? |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi There,
It means that u try to insert a row which is voilating unique index clause
Code: |
-811 THE RESULT OF AN EMBEDDED SELECT STATEMENT OR A SUBSELECT IN THE
SET CLAUSE OF AN UPDATE STATEMENT IS A TABLE OF MORE THAN ONE ROW,
OR THE RESULT OF A SUBQUERY OF A BASIC PREDICATE IS MORE THAN ONE
VALUE |
Please download abend assist from the site |
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Hi,
you can even get -811 in an embedded SQL SELECT, if your query returns more than one row. The description is as follows.
Execution of an embedded SELECT statement has resulted in a result table containing more than one row. Alternatively, a subquery contained in a basic predicate has produced more than one value.
--Parag |
|
Back to top |
|
|
edsellouie
New User
Joined: 13 Sep 2007 Posts: 1 Location: toronto
|
|
|
|
In your application, you may have to declare a CURSOR to resolve this issue. If you're expecting more than 1 row during a SELECT, then you need to have a CURSOR declared before you FETCH each record until there are no more records.
If you don't expect more than one row, then you have to make sure your WHERE clause would retrieve unique records from the specified columns.
...hope this helps... |
|
Back to top |
|
|
senthilssg
New User
Joined: 09 Dec 2005 Posts: 64 Location: USA
|
|
|
|
Hi ,
If you want only row , you can use FETCH FIRST ROW ONLY to your Query , so that you can avoid -811 also reduce the CPU cost by avoiding of unncessary rows were fetched from table .
Code: |
Eg :
Select column1 , column2
From tablename
where column3 = 'value'
Fetch first row only |
|
|
Back to top |
|
|
Raghavendra P K
New User
Joined: 24 Aug 2007 Posts: 24 Location: bangalore
|
|
|
|
Hi ,
Change your where clause to fetch the records based on the Primary key.This will not give you -811 error. If you read a table based on the primary key you will not get multiple records. |
|
Back to top |
|
|
|