0

I'm writing DB2 stored procedure. This stored procedure will be called using .ksh script.

I was stuck in checking IF condition.

VARIABLE = 'test1,test3,test8,......testn' The variable's datatype is varchar

IF VARIABLE = 'test1'
THEN
--PRINT TEST1 HERE;
END IF;

IF VARIABLE = 'test8'
THEN
--PRINT TEST8 HERE;
END IF;

could you please help me to achieve this?

Andy Dalton
  • 13,654
  • 1
  • 25
  • 45
looty
  • 25
  • 4
  • 1
    Is that intended to be SQL or ksh script? – Jeff Schaller May 14 '20 at 17:21
  • intended to be stored procedure which have sql statements and that stored procedure will be called by ksh – looty May 14 '20 at 17:29
  • I'm wondering if you need to be asking this at dba.stackexchange.com. Have you gotten the SQL working and you're trying to call it with KSH, or are you still working on the SQL side? – Jeff Schaller May 14 '20 at 17:45

1 Answers1

0

Try this:

IF LOCATE(',test1,', ','||VARIABLE||',')<>0 THEN
THEN
--PRINT TEST1 HERE;
END IF;