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
305
April 29, 2020 02:15PM
122
April 29, 2020 03:25PM
103
May 04, 2020 02:19AM
115
April 30, 2020 11:16AM
102
May 04, 2020 02:21AM
104
June 11, 2020 11:25AM


Sorry, you can't reply to this topic. It has been closed.

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.