Home > Database > Oracle > body text

What are the tables involved in Oracle query stored procedures?

下次还敢
Release: 2024-04-19 05:36:51
Original
617 people have browsed it

To query the tables involved in the stored procedure: Connect to the database. Query the ALL_OBJECT_TABLES view and filter out the tables involved in the stored procedure (OBJECT_NAME matches the stored procedure OBJECT_NAME, exclude temporary tables, and the table name does not contain $). The results will contain the stored procedure name (OBJECT_NAME) and the name of the table involved (TABLE_NAME).

What are the tables involved in Oracle query stored procedures?

Oracle Query the tables involved in the stored procedure

To query the tables involved in the stored procedure, you can use Oracle data Dictionary view. These views contain information about Oracle database objects.

Steps:

  1. Connect to the Oracle database.
  2. Query the following view:
<code class="sql">SELECT
    *
FROM
    ALL_OBJECT_TABLES
WHERE
    OBJECT_NAME IN (
        SELECT
            OBJECT_NAME
        FROM
            ALL_OBJECTS
        WHERE
            OBJECT_TYPE = 'PROCEDURE'
            AND SCHEMA_NAME = 'YOUR_SCHEMA_NAME'
    )
    AND TABLE_NAME NOT LIKE '%$%'
    AND TEMPORARY = 'N'
ORDER BY
    OBJECT_NAME,
    TABLE_NAME;</code>
Copy after login

Result:

This query will return the following column information:

  • OBJECT_NAME: The name of the stored procedure
  • TABLE_NAME: The name of the table involved in the stored procedure

Example:

If there is a stored procedure named GET_CUSTOMER_DATA, and the stored procedure involves the CUSTOMER and ORDERS tables, the query results will Similar to the following:

<code class="sql">OBJECT_NAME  TABLE_NAME
GET_CUSTOMER_DATA  CUSTOMER
GET_CUSTOMER_DATA  ORDERS</code>
Copy after login

Description:

  • ALL_OBJECT_TABLES The view contains metadata information about all tables in the database.
  • ALL_OBJECTS Views contain metadata information about all objects in the database, including stored procedures. The
  • TABLE_NAME column may contain the $ flag, which indicates that the table is a temporary table used internally by Oracle. These tables should be excluded from the results.
  • TEMPORARY column indicates whether the table is a temporary table. Temporary tables are deleted after the session ends and should therefore be excluded from the results.

The above is the detailed content of What are the tables involved in Oracle query stored procedures?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template