Reputation: 385
UPDATE
S
SET
(S.a,
S.b,
S.c)
=
(
SELECT
FS.a,
FS.b,
FS.c
FROM
(SELECT
T.a,
T.b,
T.c,
T.d,
T.e,
CASE
WHEN IS.a IS NULL THEN 'N'
ELSE 'Y'
END
FROM
t T
JOIN
y
ON(y.a = T.a)
) FS
WHERE
FS.a = S.e
AND FS.b = S.a
AND FS.c = S.b
AND FS.d = S.c
)
While i execute this query iam getting an error :
21:23:59 [UPDATE - 0 row(s), 0.000 secs] [Error Code: -811, SQL State: 21000] DB2 SQL Error: SQLCODE=-811, SQLSTATE=21000, SQLERRMC=null, DRIVER=3.50.152
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]
Can u please explain me the root cause...?
Upvotes: 0
Views: 6063
Reputation: 5069
All DB2 messages and their meanings can be found online.
In your case, according to the writeup for SQL0811N:
One of the following caused the error:
This means that your select statement that starts:
SELECT
FS.a,
FS.b,
FS.c
FROM ...
returns more than one row. This isn't allowed since you're trying to set a single row's values in the update statement.
Upvotes: 3