Lista de Procedimientos/Funciones Almacenados Mysql Línea de Comandos
¿Cómo puedo ver la lista de los procedimientos almacenados o funciones almacenadas en la línea de comandos de mysql como show tables;
o show databases;
comandos.
15 answers
SHOW PROCEDURE STATUS;
SHOW FUNCTION STATUS;
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-29 09:56:23
show procedure status
Le mostrará los procedimientos almacenados.
show create procedure MY_PROC
Le mostrará la definición de un procedimiento. Y
help show
Le mostrará todas las opciones disponibles para el comando show
.
Para el procedimiento de vista en nombre wise
select name from mysql.proc
El código inferior se usa para enumerar todo el procedimiento y el código inferior es dar el mismo resultado que mostrar el estado del procedimiento
select * from mysql.proc
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-10-26 05:01:43
Una forma más específica:
SHOW PROCEDURE STATUS
WHERE Db = DATABASE() AND Type = 'PROCEDURE'
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-05-02 22:53:43
Como se mencionó anteriormente,
show procedure status;
Mostrará una lista de procedimientos, pero muestra todos de ellos, en todo el servidor.
Si quieres ver solo los que están en una sola base de datos, prueba esto:
SHOW PROCEDURE STATUS WHERE Db = 'databasename';
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-11-09 09:48:58
Alternativa:
SELECT * FROM INFORMATION_SCHEMA.ROUTINES
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-02-13 16:21:26
Mi preferencia es por algo que:
- Enumera tanto las funciones como los procedimientos,
- Me permite saber cuáles son cuáles,
- Da los nombres y tipos de los procedimientos y nada más ,
- Filtra los resultados por la base de datos actual, no por el definidor actual
- Ordena el resultado
Juntando otras respuestas en este hilo, termino con
select
name, type
from
mysql.proc
where
db = database()
order by
type, name;
... que termina con resultados que parecen esto:
mysql> select name, type from mysql.proc where db = database() order by type, name;
+------------------------------+-----------+
| name | type |
+------------------------------+-----------+
| get_oldest_to_scan | FUNCTION |
| get_language_prevalence | PROCEDURE |
| get_top_repos_by_user | PROCEDURE |
| get_user_language_prevalence | PROCEDURE |
+------------------------------+-----------+
4 rows in set (0.30 sec)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-18 17:17:11
Usa esto:
SHOW PROCEDURE STATUS;
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-30 12:17:48
Para mostrar solo el tuyo:
SELECT
db, type, specific_name, param_list, returns
FROM
mysql.proc
WHERE
definer LIKE
CONCAT('%', CONCAT((SUBSTRING_INDEX((SELECT user()), '@', 1)), '%'));
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-29 10:03:58
Una variación del post de Praveenkumar_V:
SELECT `name` FROM mysql.proc WHERE db = 'dbname' AND `type` = 'PROCEDURE';
SELECT `name` FROM mysql.proc WHERE db = 'dbname' AND `type` = 'FUNCTION';
..y esto porque necesitaba ahorrar tiempo después de un poco de limpieza:
SELECT CONCAT(
"GRANT EXECUTE ON PROCEDURE `"
,`name`
,"` TO username@'%'; -- "
,`comment`
)
FROM mysql.proc
WHERE db = 'dbname'
AND `type` = 'PROCEDURE';
SELECT CONCAT(
"GRANT EXECUTE ON FUNCTION `"
,`name`
,"` TO username@'%'; -- "
,`comment`
)
FROM mysql.proc
WHERE db = 'dbname'
AND `type` = 'FUNCTION';
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-12 10:26:38
SELECT specific_name FROM `information_schema`.`ROUTINES` WHERE routine_schema='database_name'
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-01-06 14:08:15
Si desea enumerar el Procedimiento de Almacenamiento para la Base de Datos Seleccionada Actual,
SHOW PROCEDURE STATUS WHERE Db = DATABASE();
Enumerará Rutinas basadas en la Base de datos seleccionada actual
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-12 06:59:29
SHOW PROCEDURE STATUS;
Muestra todos los procedimientos almacenados.
SHOW FUNCTION STATUS;
Muestra todas las funciones.
SHOW CREATE PROCEDURE [PROC_NAME];
Mostrará la definición del procedimiento especificado.
SHOW PROCEDURE STATUS WHERE Db = '[db_name]';
Le mostrará todos los procedimientos de la base de datos dada.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-12-07 05:22:14
show procedure status;
Usando este comando puede ver todos los procedimientos en las bases de datos
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-22 07:26:41
Utilice la siguiente consulta para todos los procedimientos:
select * from sysobjects
where type='p'
order by crdate desc
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-11 08:27:04