Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to View Oracle Stored Procedure using SQLPlus?

How can I view the code of a stored procedure using sqlplus for Oracle 10g?

When I type in:

desc daily_update; 

it shows me the parameter, but when I try to do the following:

select * from all_source where name = 'daily_update';

I get

no rows selected

What am I doing wrong?

like image 660
Madam Zu Zu Avatar asked Aug 09 '11 17:08

Madam Zu Zu


People also ask

How do I view a stored procedure in SQL query?

Using SQL Server Management Studio Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure and then click View Dependencies. View the list of objects that depend on the procedure.

How do I edit a stored procedure in Oracle SQL Plus?

sqlplus> spool myprocname. sql; sqlplus> select text from all_source where name = 'MYPROCNAME' and type = 'PROCEDURE' order by line; sqlplus> quit; then edit the local SQL file in a decent editor. Then use SQLPlus to run the SQL file to re-build the proc for testing.

How do you view the code of a procedure in Oracle?

You can use user_source or all_source data dictionary view to view the procedure or function code. Try this. You can replace PROCEDURE with the type you want. You can view the source code of a function or a procedure by using data dictionary views.


1 Answers

check your casing, the name is typically stored in upper case

SELECT * FROM all_source WHERE name = 'DAILY_UPDATE' ORDER BY TYPE, LINE;

like image 186
Harrison Avatar answered Oct 11 '22 02:10

Harrison