Home > Database > Oracle > How to view stored procedure statements in Oracle

How to view stored procedure statements in Oracle

下次还敢
Release: 2024-04-18 15:03:13
Original
645 people have browsed it

There are three methods to view Oracle stored procedure statements: 1. Use SQL*Plus to query the user_source table; 2. Right-click the stored procedure in SQL Developer and select "Edit"; 3. Use DBMS_METADATA.GET_DDL () function.

How to view stored procedure statements in Oracle

How to view Oracle stored procedure statements

The method to view Oracle stored procedure statements is as follows:

1. Use SQL*Plus

<code class="sql">SELECT text
FROM user_source
WHERE type = 'PROCEDURE'
AND name = '<存储过程名称>';</code>
Copy after login

2. Use SQL Developer

  • Expand "Store Procedure" in the Object Browser node.
  • Right-click the stored procedure you want to view and select Edit.

3. Using the DBMS_METADATA package

<code class="sql">SELECT DBMS_METADATA.GET_DDL('PROCEDURE', '<存储过程名称>')
FROM dual;</code>
Copy after login

Example

Suppose there is a file called GET_EMPLOYEE_BY_ID's stored procedure, to view its statements, you can use the following command:

Use SQL*Plus:

<code class="sql">SELECT text
FROM user_source
WHERE type = 'PROCEDURE'
AND name = 'GET_EMPLOYEE_BY_ID';</code>
Copy after login

Use SQL Developer:

  1. Expand the "Stored Procedure" node in the Object Browser.
  2. Right-click GET_EMPLOYEE_BY_ID and select Edit.

Use DBMS_METADATA:

<code class="sql">SELECT DBMS_METADATA.GET_DDL('PROCEDURE', 'GET_EMPLOYEE_BY_ID')
FROM dual;</code>
Copy after login

The above is the detailed content of How to view stored procedure statements in Oracle. 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