Home  >  Article  >  Database  >  How to query the latest compilation time of a stored procedure in Oracle

How to query the latest compilation time of a stored procedure in Oracle

下次还敢
下次还敢Original
2024-04-18 15:00:32529browse

How to query the latest compilation time of stored procedures in Oracle? Connect to Oracle database. Execute the following SQL query: SELECT OBJECT_NAME, LAST_COMPILEDFROM USER_OBJECTSWHERE OBJECT_TYPE = 'PROCEDURE' AND OBJECT_NAME = '<stored procedure name>';View the LAST_COMPILED field in the query results, which displays the most recent compile time of the stored procedure.

How to query the latest compilation time of a stored procedure in Oracle

How to query the latest compilation time of stored procedures in Oracle

Oracle database provides a database called A data dictionary view of USER_OBJECTS, which stores various information about database objects, including the compile time of the stored procedure. To query the most recent compile time of a stored procedure, you can use the following steps:

  1. Connect to an Oracle database: Use SQL*Plus, Oracle SQL Developer, or other Oracle client tools.
  2. Query USER_OBJECTS view: Execute the following SQL query:
<code class="sql">SELECT OBJECT_NAME, LAST_COMPILED
FROM USER_OBJECTS
WHERE OBJECT_TYPE = 'PROCEDURE'
AND OBJECT_NAME = '<存储过程名称>';</code>

where'<stored procedure name>' is the query The name of the stored procedure at compile time.

  1. View the LAST_COMPILED field: The LAST_COMPILED field in the query results will display the most recent compilation time of the stored procedure. The timestamp format is YYYY-MM-DD HH24:MI:SS.FF, where:
  • YYYY is the year
  • MM is the month
  • DD is the day
  • HH24 is the hour in 24-hour format
  • MI is the minute
  • SS is the second
  • FF is the millisecond

For example, the following query results show the most recent compilation time of the stored procedure named GET_CUSTOMER:

<code class="sql">OBJECT_NAME           LAST_COMPILED
------------------- ----------------------------------------
GET_CUSTOMER        2023-03-06 10:15:34.233</code>

means that the GET_CUSTOMER stored procedure was compiled in 2023 Compiled at 10:15:34.233 on March 6th.

The above is the detailed content of How to query the latest compilation time of a stored procedure in Oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn