DROP PROCEDURE
and
DROP FUNCTION
Syntax
1056
13.1.16.
DROP PROCEDURE
and
DROP FUNCTION
Syntax
DROP {PROCEDURE | FUNCTION} [IF EXISTS]
sp_name
This statement is used to drop a stored procedure or function. That is, the specified routine is removed
from the server. As of MySQL 5.0.3, you must have the
ALTER ROUTINE
[576]
privilege for the routine.
(If the
automatic_sp_privileges
system variable is enabled, that privilege and
EXECUTE
[577]
are
granted automatically to the routine creator when the routine is created and dropped from the creator
when the routine is dropped. See
Section 18.2.2, “Stored Routines and MySQL Privileges”
.)
The
IF EXISTS
clause is a MySQL extension. It prevents an error from occurring if the procedure or
function does not exist. A warning is produced that can be viewed with
SHOW WARNINGS
.
Note
DROP PROCEDURE IF EXISTS
and
DROP FUNCTION IF EXISTS
are not
written to the binary log (and thus not replicated) if the stored procedure or
function named in the
DROP
statement does not exist on the master. This is a
known issue, which is resolved in MySQL 5.1 and later. (Bug #13684)
DROP FUNCTION
is also used to drop user-defined functions (see
Section 13.7.3.2, “
DROP FUNCTION
Syntax”
).
13.1.17.
DROP TABLE
Syntax
DROP [TEMPORARY] TABLE [IF EXISTS]
tbl_name
[,
tbl_name
] ...
[RESTRICT | CASCADE]
DROP TABLE
removes one or more tables. You must have the
DROP
[577]
privilege for each table. All
table data and the table definition are removed, so be careful with this statement! If any of the tables
named in the argument list do not exist, MySQL returns an error indicating by name which nonexisting
tables it was unable to drop, but it also drops all of the tables in the list that do exist.
Important
When a table is dropped, user privileges on the table are not automatically
dropped. See
Section 13.7.1.3, “
GRANT
Syntax”
.
Use
IF EXISTS
to prevent an error from occurring for tables that do not exist. A
NOTE
is generated for
each nonexistent table when using
IF EXISTS
. See
Section 13.7.5.37, “
SHOW WARNINGS
Syntax”
.
RESTRICT
and
CASCADE
are permitted to make porting easier. In MySQL 5.0, they do nothing.
Note
DROP TABLE
automatically commits the current active transaction, unless you
use the
TEMPORARY
keyword.
The
TEMPORARY
keyword has the following effects:
• The statement drops only
TEMPORARY
tables.
• The statement does not end an ongoing transaction.
• No access rights are checked. (A
TEMPORARY
table is visible only to the session that created it, so
no check is necessary.)
Using
TEMPORARY
is a good way to ensure that you do not accidentally drop a non-
TEMPORARY
table.
13.1.18.
DROP TRIGGER
Syntax
DROP TRIGGER [IF EXISTS] [
schema_name
.]
trigger_name
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...