Created
September 14, 2016 08:38
-
-
Save cbrhex/2db89efd287490bd41ca54bbe2430015 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DEFINER=`root`@`root` PROCEDURE `procedure_name`() | |
BEGIN | |
IF (SELECT count(*) | |
FROM information_schema.TABLES | |
WHERE | |
TABLE_SCHEMA = 'DB_NAME' -- Database name | |
AND TABLE_NAME = 'TABLE_NAME' AND ...) = 0 THEN | |
SELECT ...; -- not exists | |
ELSE | |
SELECT ...; -- exists | |
END IF; | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment