You can also compare "LAST_ACTIVE_TIME", "LAST_LOADED_TIME", and "FIRST_LOAD_TIME" values of pl/sql and sql query entries in v$sql. If you know the pl/sql code, you can also compare expected execution count of standalone sql statement. Thanks, Sai http://sai-oracle.blogspot.com From: "Koppelaars, Toon" <T.Koppelaars@xxxxxxxxxxxxxxxxxxxx>To: <Ajay_Thotangare@xxxxxx>, <oracle-l@xxxxxxxxxxxxx>Date: Tue, 2 Oct 2007 22:13:26 +0200 V$sqlarea holds a PARSING_SCHEMA_ID column. This holds the user-id under which the SQL was parsed. If from stored procedure, it holds the user-id from the owner of the stored procedure (assuming auth_id current user was not used for the procedure). If from somebody else (not using procedure), it holds somebody-elses user-id. Hope this helps Toon -----Oorspronkelijk bericht----- Van: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx]Namens Thotangare, Ajay (GTI) Verzonden: dinsdag 2 oktober 2007 21:35 Aan: oracle-l@xxxxxxxxxxxxx Onderwerp: Link procedure to sql statement in v$sqlarea Hi, I have a question about v$sqlarea. Appreciate your help/inputs on this. Background ----------------- 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) e.g. create or replace procedure PQR as begin execute immediate 'select object_name AS INSIDE_PQR_PRC from user_objects'; end; / Procedure created. SQL> exec PQR; PL/SQL procedure successfully completed. SQL> select rownum,sql_text,executions from v$sqlarea where sql_text like '%PQR%'; ROWNUM SQL_TEXT EXECUTIONS ------ ----------------------------------------------------------------- ---------- 1 select rownum,sql_text,executions from v$sqlarea where sql_text l 3 ike '%PQR%' 2 BEGIN PQR; END; 1 3 select object_name AS INSIDE_PQR_PRC from user_objects 1 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. regards, Ajay Thotangare 212-647-4312 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- //www.freelists.org/webpage/oracle-l