cancel
Showing results for 
Search instead for 
Did you mean: 

Update ... IN ... Problems

Former Member
0 Kudos

Hi:

I need to update a couple of records using an update query based on a select statement. The following examples works perfect:

UPDATE "***"."****"

SET value = 0

WHERE id IN

(SELECT id FROM :A

          WHERE value = 1 and (CANT_NEIGHBOURS < 2 or CANT_NEIGHBOURS > 3))

But, I want to do it on the same way using variables:

  KILL = SELECT id FROM :A

          WHERE value = 1 and (CANT_NEIGHBOURS < 2 or CANT_NEIGHBOURS > 3);

          UPDATE "***"."***"

          SET value = 0

          WHERE id IN KILL;

But crash. The error is not very helpfull. Also I tried to use "WHERE id IN :KILL;" but same result.

All this is under a PROCEDURE sentence.

Ideas???

Thanks in advance!

Accepted Solutions (0)

Answers (1)

Answers (1)

lucas_oliveira
Advisor
Advisor
0 Kudos

Hi Leonardo,

Not sure if you already solved this on your own.

Either way: have you tried to put the variable between parenthesis? Something like:

UPDATE "***"."***"

          SET value = 0

          WHERE id IN (:KILL);

Regards,

Lucas de Oliveira