Topic
  • No replies
Agnijalam
Agnijalam
1 Post

Pinned topic how to pass input parameter as a string separated by comma or list for IN clause in DB2

‏2013-07-23T06:17:17Z |

HI All, 

I am new in stored procedure ,i have one doubt,I need to pass input parameter as a string separated by comma or list for IN clause in DB2. please see the below sample procedure
 
 CREATE PROCEDURE  TEST_SP(IN  @listofUsername)
  SPECIFIC TEST_SP DYNAMIC RESULT SETS 1
P1:BEGIN
  DECLARE CURSOR1 CURSOR WITH RETURN FOR  
  SELECT  F_NAME FROM TEST  WHERE USER_NAME IN (@listofusername);
    }
OPEN CURSOR1;  
END P1 

 

Please guide me,
1 how to write the above stored procedure
2 Is it possible to pass any kind of list as a input parameter ,if yes , which one will give better perfomance.
 
how to pass input parameter as a string separated by comma or list for IN clause in DB2