Wednesday, January 30, 2013

Oracle Tips


#1 list all the tables in a database

-> select * from tab;

#2 check oracle charset

-> select userenv('LANGUAGE') from dual;

#3 sysdate
 select   XXX    from   YYY
    where Time >= sysdate- INTERVAL '12' hour

#4 to_date
select *  from YYY where Time  >=  to_date('01-02-2013','dd-mm-yyyy');

#5 list all columns

SELECT *
FROM ALL_TAB_COLUMNS
WHERE TABLE_NAME IN (
  SELECT TABLE_NAME
  FROM ALL_TABLES
  WHERE OWNER ='user account')

No comments:

Post a Comment