Skip to content

Instantly share code, notes, and snippets.

@quoidautre
Created September 28, 2012 15:28
Show Gist options
  • Select an option

  • Save quoidautre/3800526 to your computer and use it in GitHub Desktop.

Select an option

Save quoidautre/3800526 to your computer and use it in GitHub Desktop.
MYSQL: Procédures stockées avec paramètres
BEGIN
SET @mySelect:= 'SELECT * FROM CATEGORY ';
IF(param_id_category > 0) THEN
SET @mySelect:= CONCAT(@mySelect, 'WHERE CAT_ID=',param_id_category);
END IF;
prepare stmnt FROM @mySelect;
EXECUTE stmnt;
DEALLOCATE PREPARE stmnt;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment