Skip to main content
mollyn6512
February 7, 2023
Question

STORED PROCEDURE - Is it possible to pass a list of value into a parameter?

  • February 7, 2023
  • 2 replies
  • 0 views

Hi everyone, 

I need to pass a list of INT into a parameter of a stored procedure which should look like this:

UPDATE table01

SET updatedDate = now()

WHERE ID in (list of ids that I will pass in);

However the parameter type only accept INT, not list of INT, so not sure how can I achieve that. 

Any suggestion will be much appreciated :)

    2 replies

    gayathris111098
    February 7, 2023

    Execute store procedure will not allow multiple values as input, but to achieve this change type to string and pass the value by Joining the array using joinarray() function and in the store proc use this code code like below sample,

    FIND_IN_SET(
    yourDBField,
    (
    REPLACE
    (JoinarrayString, '|', ',')
    )
    ) > 0

    stefanhelzle0001
    Brainy
    February 7, 2023

    Why do you need a stored procedure for this simple task?