SET LINE 300
SET FEEDBACK OFF
SET VERIFY OFF
COL username FOR a13
COL osuser FOR a10
COL script FOR a20
COL sql_text FOR a80
COL sql_id FOR a13
SELECT s.username, SUBSTR(s.osuser,1,10) "OSUSER", s.sql_id "SQL_ID", SUBSTR(t.sql_text,1,80) "SQL_TEXT", '@sid_details '||s.sid||' '||s.inst_id "SCRIPT" FROM gv$session s, (SELECT DISTINCT(sql_id), sql_text FROM gv$sqlarea) t WHERE UPPER(s.username) IN (SELECT UPPER(login_id) FROM tlc_bi_own.ldap_users WHERE UPPER(title) LIKE UPPER('%&&1%')) AND 1=1 AND s.sql_id=t.sql_id (+) ORDER BY s.username;


