Subject | RE: [IBO] Update SQL question |
---|---|
Author | Helen Borrie |
Post date | 2003-03-27T01:55:19Z |
At 12:24 PM 27/03/2003 +1100, you wrote:
I think your problem here is in the SQL: you are trying to get two values
from a single subquery cursor. Subqueries need to be "self-contained" -
so, even though both of these values come from the "same" table, you have
to provide two cursors so that the query sees them as two sets.
You need a parameter for *each* - a parameter is an object which has a
value, it is not (of itself) a value.
So the statement really ought to be:
UPDATE TBLBSLIST SET
BSREQIND = :BSREQIND, /*PK*/
LINKTOPROJ = (SELECT a.LINKTOPROJ FROM TBLJOBSCHEDULE a
WHERE
a.JOBIND=:LINKTOJOBSCHED1),
LINKTOWO = (SELECT b.LINKTOBSAWWO FROM TBLJOBSCHEDULE b WHERE
b.JOBIND=:LINKTOJOBSCHED2),
BSNO = :BSNO,
LINKTOSLAB = :LINKTOSLAB,
etc
Helen
>I juggled the sequence around.. I try to use it 3 times.. no matter what theAlan,
>sequence, I only get one use out of it..
>I imagine that the parameter value is set only once in IBO..
>Is here any way to set the other ones?
I think your problem here is in the SQL: you are trying to get two values
from a single subquery cursor. Subqueries need to be "self-contained" -
so, even though both of these values come from the "same" table, you have
to provide two cursors so that the query sees them as two sets.
You need a parameter for *each* - a parameter is an object which has a
value, it is not (of itself) a value.
So the statement really ought to be:
UPDATE TBLBSLIST SET
BSREQIND = :BSREQIND, /*PK*/
LINKTOPROJ = (SELECT a.LINKTOPROJ FROM TBLJOBSCHEDULE a
WHERE
a.JOBIND=:LINKTOJOBSCHED1),
LINKTOWO = (SELECT b.LINKTOBSAWWO FROM TBLJOBSCHEDULE b WHERE
b.JOBIND=:LINKTOJOBSCHED2),
BSNO = :BSNO,
LINKTOSLAB = :LINKTOSLAB,
etc
Helen