Where clause with substr for a update statement
678370Jan 6 2009 — edited Jan 6 2009Dear Reader,
Currently I am working on a package that will update a value in a column, this column always has a default value of 9999 and is named STATUS_FLAGS
In my package I need to update this column's value for instance into 9919. Where 1 represents a specific extraction run and 9 represents non-ran records.
Currently I have the following code (which does not work):
IF run = 'somevalue' THEN
-- The flag string: 9999 where 9 = xx, 9 = xxx, 9 = xxxx, 9 = etc
UPDATE TABLE.STATUS_FLAGS
SET TABLE.STATUS_FLAGS = 1 || substr(TABLE.STATUS_FLAGS,1,4)
WHERE SUBSTR(TABLE.STATUS_FLAGS,2,3) <> '1';
END IF;
Could you please help me to tell me what I am doing wrong and how I should do it?
Thanks a lot.
Edited by: user3542281 on Jan 6, 2009 5:31 AM