Bishwajeet Mahakul
Bishwajeet Mahakul

Reputation: 1

SP Data dictionary

I have created 1 procedure in my oracle database

create or replace procedure P1(p_empno in number)
is
p_ename varchar2(10);
p_sal number(10);
begin
select ename,sal into p_ename,p_sal from emp where empno=p_empno;
dbms_output.put_line(p_ename||'  '||p_sal);
end;

SQL> Procedure created.

But when i am trying to see the data dictionary then it looks like

SQL> select name from user_source;

NAME
------------------------------
P1
P1
P1
P1
P1
P1
P1
P1
PROTECTED_PROC
PROTECTED_PROC
PROTECTED_PROC
PROTECTED_PROC
PROTECTED_PROC
PROTECTED_PROC

14 rows selected.

what is this I have created one time but it showing P1( 8 )times

Upvotes: 0

Views: 67

Answers (2)

fg78nc
fg78nc

Reputation: 5232

USER_SOURCE table keeps source code of your procedure - one line per row. As your procedure is 8 lines long, you are getting 8 rows for each line of code (of your procedure).

It will be clear for you if query

SELECT * FROM USER_SOURCE WHERE WHERE NAME = 'P1';

or if you don't need source code query :

SELECT * FROM USER_PROCEDURES WHERE OBJECT_NAME = 'P1';

Upvotes: 1

mehmet sahin
mehmet sahin

Reputation: 812

Because it is 8 lines.

You can see with;

SELECT * FROM USER_SOURCE;

Upvotes: 0

Related Questions