I have this query on Oracle 10g:
UPDATE "SCHEMA1"."CELLS_GLIST"
SET ("GLIST_VALUE_ID", "USER_ID", "SESSION_ID") = (
SELECT "GLIST_VALUE_ID", 1 AS "USER_ID", 123456 AS "SESSION_ID"
FROM "SCHEMA1"."GLISTS_VALUES_UOR"
WHERE ("UOR_ID"=3)
AND ("GLIST_ID"=67)
AND ("GLIST_VALUE_DESC" = (
SELECT "GLIST_VALUE_DESC"
FROM "BMAN_TP1"."GLISTS_VALUES_UOR"
WHERE ("UOR_ID"=3)
AND ("GLIST_VALUE_ID"="CELLS_GLIST"."GLIST_VALUE_ID")
))
)
WHERE EXISTS (......)
It keeps saying ORA-01407: cannot update ("SCHEMA1"."CELLS_GLIST"."SESSION_ID") to NULL
"SESSION_ID" is obviously Not Nullable, but I'm actually passing a value to that field, so I do not understand the problem.
I found this query also to work:
UPDATE "BMAN_TP1"."CELLS_GLIST"
SET "GLIST_VALUE_ID" = (
SELECT "GLIST_VALUE_ID"
FROM "BMAN_TP1"."GLISTS_VALUES_UOR"
WHERE ("UOR_ID"=3)
AND ("GLIST_ID"=67)
AND ("GLIST_VALUE_DESC" = (
SELECT "GLIST_VALUE_DESC"
FROM "BMAN_TP1"."GLISTS_VALUES_UOR"
WHERE ("UOR_ID"=3)
AND ("GLIST_VALUE_ID"="CELLS_GLIST"."GLIST_VALUE_ID")
))
),
"SESSION_ID" = 123456,
"USER_ID" = 1
WHERE EXISTS (......)
But, it performs really really fast... I doubt I'm missing something...