sys Schema Stored Procedures | Next Output | +----------------------------------+ | Top 10 Queries Using Custom View | +----------------------------------+ | query | db | exec_count | total_latency | avg_latency | rows_sent_avg | ... 28.4.4.26 The table_exists() Procedure Parameters Example mysql>  CREATE DATABASE db1; Query OK, 1 row affected (0.01 sec) mysql>  USE db1; Database changed mysql>  CREATE TABLE t1 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.03 sec) mysql>  CREATE TABLE t2 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.20 sec) mysql>  CREATE view v_t1 AS SELECT * FROM t1; Query OK, 0 rows affected (0.02 sec) mysql>  CREATE TEMPORARY TABLE t1 (id INT PRIMARY KEY); Query OK, 0 rows affected (0.00 sec) mysql>  CALL sys.table_exists(’db1’, ’t1’, @exists); SELECT @exists; Query OK, 0 rows affected (0.01 sec) +-----------+ | @exists | +-----------+ | TEMPORARY | +-----------+ 1 row in set (0.00 sec) 5201 Tests whether a given table exists as a regular table, a  TEMPORARY  table, or a view. The procedure returns the table type in an  OUT  parameter. If both a temporary and a permanent table exist with the given name, TEMPORARY  is returned. • TEMPORARY : The table name exists as a  TEMPORARY  table. • VIEW : The table name exists as a view. • BASE TABLE : The table name exists as a base (permanent) table. • ’’ : The table name does not exist as a base table,  TEMPORARY  table, or view. • out_exists ENUM(’’, ’BASE TABLE’, ’VIEW’, ’TEMPORARY’) : The return value. This is an OUT  parameter, so it must be a variable into which the table type can be stored. When the procedure returns, the variable has one of the following values to indicate whether the table exists: • in_table VARCHAR(64) : The name of the table to check the existance of. • in_db VARCHAR(64) : The name of the database in which to check for table existance.