Check created and last modified date of Stored Procedure in MySQL/MariaDB

List the create and last modified date of Routines in MySQL / MariaDB

Check the created and last modified date of Routines:

SELECT ROUTINE_SCHEMA as schemaname,
SPECIFIC_NAME AS STOREDPROCEDURENAME,
CREATED AS CREATEDATE,
LAST_ALTERED AS LASTMODIFIEDDATE
FROM
INFORMATION_SCHEMA.ROUTINES where ROUTINE_SCHEMA = 'dbname';

Check created and last modified for particular routines:

SELECT ROUTINE_SCHEMA as schemaname,
SPECIFIC_NAME AS STOREDPROCEDURENAME,
CREATED AS CREATEDATE,
LAST_ALTERED AS LASTMODIFIEDDATE
FROM
INFORMATION_SCHEMA.ROUTINES where ROUTINE_SCHEMA = 'dbname' and ROUTINE_NAME = 'procedurename';

Check created and last modified in last 7 days in MySQL / MariaDB:

-- Check last created procedures in 7 days:
SELECT
SPECIFIC_NAME AS STOREDPROCEDURENAME,
CREATED AS CREATEDATE,
LAST_ALTERED AS LASTMODIFIEDDATE
FROM
INFORMATION_SCHEMA.ROUTINES 
where CREATED >= DATE_ADD(now(), INTERVAL -7 DAY);


--Check last altered procedure in 7 days
SELECT
SPECIFIC_NAME AS STOREDPROCEDURENAME,
CREATED AS CREATEDATE,
LAST_ALTERED AS LASTMODIFIEDDATE
FROM
INFORMATION_SCHEMA.ROUTINES 
where LAST_ALTERED >= DATE_ADD(now(), INTERVAL -7 DAY);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.