Forum Stats

  • 3,828,111 Users
  • 2,260,864 Discussions


Use in(<values>) for an if statement

james_hambrick Member Posts: 248
edited Apr 14, 2015 1:51PM in SQL & PL/SQL

Oracle 11G, working on a trigger. Is there a way to use something like in(24,26,27,29,37,43) as we can in SQL code to compare a new value against a list of values?

for example if the new value is in(1,3,5,6,7,9,11,13,14,15,17,18,20,22,25,27,29,30,31,33,34,35,36) then I want to set another column to "CLEC"

If the new value is in(2,4,8,9,12,16,19,21,23,26,28,32) then I want to set another column to "ILEC"

And if the new value is null or 1 then I want to set another column to "Company"

I know I could do

if :new.Column1 := 1 or :new.Column1 := 3 etc etc which would make for a very long if statement.

I could make separate arrays with these values and check against them.

But like I said, I am hoping for something more simplistic as stated above.



This discussion has been closed.