I have several sqls that I am running as part of a large db script. There are often conditions which are repeated over several of the sqls. For example
update phone_numbers set num = 'abc' where id not in (1,2,4,5,6,8);
update fax_numbers set num = 'abc' where id not in (1,2,4,5,6,8);
update email_add set val = 'abc' where id not in (1,2,4,5,6,8);
My problem is that I am constantly repeating the values in the not in clause.
how can i move these numbes into a variable and then apply to each sql. Something like
my_var = (1,2,4,5,6,8);
update phone_numbers set num = 'abc' where id not in @my_var;
update fax_numbers set num = 'abc' where id not in @my_var;
update email_add set val = 'abc' where id not in @my_var;
The SQL is running on Oracle if that helps? Ive done this before with one parameter but not with an array.
Ive seen this Oracle PL/SQL - How to create a simple array variable? but that doesnt apply to an in
Ive searched a few places but nothing seems to be quite what I want
Thanks