Oracle Useful Queries for Report Development
How to check comments for columns in table/View in Oracle It's important to maintain column meta data so that Business Analyst can understand source of column and business meaning. To get metadata for columns. select * from all_tab_columns where table_name = 'ViewName' To check comments for columns: select * from ALL_COL_COMMENTS a where A.TABLE_NAME = 'ViewName' Validate each column have comments. The step is simple but important in migration of table/views. To get date of Last month for comparison SELECT TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE, -1))) AS LAST_DAY_LAST_MONTH FROM DUAL; Use in where clause: TRUNC (A.CALENDAR_DT) < TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE, -1))) To create timestamp select 'ora.EDW_DT' as txt, to_timestamp('10-Sep-02 1:10:10.123000') as DW_UPDT_TS from ora.D_DT