Showing posts with label sql scripts. Show all posts
Showing posts with label sql scripts. Show all posts

Tuesday, January 8, 2008

Convert JULIAN to standard date using SQL.

EnterpriseOne stores dates in Julian using the following format CYYDDD ("C" is the century, "YY" is the year and "DDD" is the number of days since the start of the year).

To convert a julian date to a standard (gregorian) date format:

TO_CHAR(TO_DATE(XXXXXX+1900000,'YYYYDDD'),'MM-DD-YYYY')

Notes:
- where XXXXXX is the column name to convert.
- this only works on 19th century onwards.

Or

You can download this QuikDates! "freeware" windows application that can convert julian to standard and vice-versa. It's a handy tool (no need to install) that you can place on your desktop.
Download here!

Saturday, January 5, 2008

Obtaining a list of tables for a specific column in Oracle DB.

DBA_TAB_COLUMNS is a view that will help us obtain a list of tables for a specific column in Oracle database.

example:
SELECT owner, table_name, column_name
FROM DBA_TAB_COLUMNS
WHERE column_name like '%ADDJ'
ORDER BY owner, table_name