MySQL : Stored Procedure Array Parameter In Where Clause

Define Stored Procedure :

DELIMITER $$

CREATE PROCEDURE GetVendor(IN pRegid TEXT)

BEGIN

  SET @sql = CONCAT('SELECT * FROM vendorMaster WHERE regid IN (', pRegid, ')');

  PREPARE stmt FROM @sql;

  EXECUTE stmt;

  DEALLOCATE PREPARE stmt;

END

$$


Call Stored Procedure

SET @regid = '\'1625628909\',\'1625642907\'';

call GetVendor(@regid)

Comments

Popular posts from this blog

PHP MySql CRUD Dengan Konsep MVC

Laravel - Sistem Informasi Perpustakaan Sederhana Laravel

IT Asset Management Dengan PHP MySQL