Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Confusion World: Examples of the to_date function

Examples of the to_date function might include:
to_date('10-12-06','MM-DD-YY')
to_date('jan 2007','MON YYYY')
to_date('2007/05/31','YYYY/MM/DD')
to_date('12-31-2007 12:15','MM-DD-YYYY HH:MI')
to_date('2006,091,00:00:00' , 'YYYY,DDD,HH24:MI:SS')
to_date('15-may-2006 06:00:01','dd-mon-yyyy hh24:mi:ss')
to_date('022002','mmyyyy')
to_date('12319999','MMDDYYYY')
to_date(substr( collection_started,1,12),'DD-MON-YY HH24')
to_date('2004/10/14 21', 'yyyy/mm/dd hh24')
TO_DATE(First_Load_Time, 'yyyy-mm-dd/hh24:mi:ss'))*24*60)

Query : To find DataBase Locking

SELECT o.object_name,
l.oracle_username,
l.os_user_name,
s.machine,
s.program,
DECODE(l.locked_mode,0,'None',1,'NULL',2,'Row-S(SS)',3,'Row-X(SX)',
4,'Share',5,'S/Row-X(SSX)',6,'Exclusive(X)') locked_mode,
s.sid,
s.serial#
FROM all_objects o,v$locked_object l,v$session s
WHERE l.session_id = s.sid
AND l.object_id=o.object_id

Query : to find Session Locking

select o.object_name,
l.oracle_username,
l.os_user_name,
s.machine,
s.program,
decode(l.locked_mode,0,'None',1,'NULL',2,'Row-S(SS)',3,'Row-X(SX)',
4,'Share',5,'S/Row-X(SSX)',6,'Exclusive(X)') locked_mode,
s.sid,
s.serial#
from all_objects o,v$locked_object l,v$session s
where l.session_id = s.sid
and l.object_id=o.object_id