RE: Link procedure to sql statement in v$sqlarea

  • From: "Daniel W. Fink" <daniel.fink@xxxxxxxxxxxxxx>
  • To: Ajay_Thotangare@xxxxxx, oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 2 Oct 2007 15:09:55 -0500

I have used v$sql.program_id with moderate success. This is the object id of 
the stored code, so link to dba_objects or obj$ to get the additional 

Daniel Fink

------- Original Message -------
On 10/2/2007 7:35 PM Thotangare, Ajay (GTI) wrote:

Link procedure to sql statement in v$sqlarea


I have a question about v$sqlarea. Appreciate your help/inputs on this.



I have a procedure named 'XYZ' and inside this procedure I have select 
statement. When I execute this procedure I can see a entry for procedure 'XYZ' 
and also a entry for select statement (which is actually inside procedure). How 
do I know if this select statement has come from this procedure or somebody 
else fired this statement as standalone (not using procedure)


create or replace procedure PQR as

begin execute immediate 'select object_name AS INSIDE_PQR_PRC from user_objects';


Procedure created.

SQL> exec PQR;

PL/SQL procedure successfully completed.

SQL> select rownum,sql_text,executions from v$sqlarea where sql_text like 

ROWNUM SQL_TEXT                                                          

------ ----------------------------------------------------------------- 

    1 select rownum,sql_text,executions from v$sqlarea where sql_text l         

      ike '%PQR%'

    2 BEGIN PQR; END;                                                           

    3 select object_name AS INSIDE_PQR_PRC from user_objects                    

3 rows selected.

How do I know that statement "select object_name AS INSIDE_PQR_PRC from 
user_objects" is actually fired from procedure and not from outside.

Appreciate your help.


Ajay Thotangare


This message w/attachments (message) may be privileged, confidential or 
proprietary, and if you are not an intended recipient, please notify the 
sender, do not use or share it and delete it. Unless specifically indicated, 
this message is not an offer to sell or a solicitation of any investment 
products or other financial product or service, an official confirmation of any 
transaction, or an official statement of Merrill Lynch. Subject to applicable 
law, Merrill Lynch may monitor, review and retain e-communications (EC) 
traveling through its networks/systems. The laws of the country of each 
sender/recipient may impact the handling of EC, and EC may be archived, 
supervised and produced in countries other than the country in which you are 
located. This message cannot be guaranteed to be secure or error-free. This 
message is subject to terms available at the following link: By messaging with Merrill Lynch you 
consent to the foregoing.


Other related posts: