Announcement Announcement Module
Collapse
No announcement yet.
Execute mssql stored procedure with where IN Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Execute mssql stored procedure with where IN

    i am working with spring jdbc templates and i have a simple mssql stored procedure like follows

    Code:
    CREATE PROCEDURE sp_ps_get  @serviceUnoList varchar(max)
    AS
        select @value = max(value) 
        from some_table t
        where t.service_uno IN (@serviceUnoList) 
        ..... 
        ......
    if it is a simple query, then we can use Spring namedJDBCTemplated with java Array List as a parameter for Where in clause

    Code:
     List<Integer> serviceList = new ArrayList<Integer>();
    
     sqlStmt = select max(value) from some_table t where t.service_uno IN (:service_list);
     Map<String, Object> paramMap = new HashMap<String, Object>();
     paramMap.put("service_list", serviceList);
    So above is working fine fine for where IN clause in quires. Can we use same approach for execute above stored procedure. i tried it fails, DO you guys know better solution or suggestions?

    Code:
    String sqlStmt =  "{ CALL sp_ps_get(:service_list) }
     Map<String, Object> paramMap = new HashMap<String, Object>();
     paramMap.put("service_list", serviceList);
    Thanks,
    Kelumt
Working...
X