MySQL Forums
Forum List  »  Stored Procedures

Does Table Exist
Posted by: John Noble
Date: April 29, 2020 02:15PM

Hi folks,

Im trying to write a SP to detect if a table exists or not.

Here is my effort...

CREATE DEFINER=`root`@`localhost` PROCEDURE `usp_DoesTableExist`(
IN p_tableName varchar(100)
)
BEGIN

SHOW TABLES LIKE p_tableName;


END

The LIKE statement only seems to accept a literal string and not a parameter. Any ideas ??

J

Options: ReplyQuote


Subject
Views
Written By
Posted
Does Table Exist
274
April 29, 2020 02:15PM
94
April 29, 2020 03:25PM
86
May 04, 2020 02:19AM
92
April 30, 2020 11:16AM
85
May 04, 2020 02:21AM
79
June 11, 2020 11:25AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.