Skip to content

Instantly share code, notes, and snippets.

@bhachauk
Last active January 14, 2019 07:27
Show Gist options
  • Save bhachauk/ea330131c987e86b6329ad9b0c81c902 to your computer and use it in GitHub Desktop.
Save bhachauk/ea330131c987e86b6329ad9b0c81c902 to your computer and use it in GitHub Desktop.
Accessing the Unix time in Oracle database with specific date format in SQL query
DEFINE cnv_time = "24 * 60 * 60 * 1000";
select TIMESTAMP '1970-01-01 00:00:00.000' + NUMTODSINTERVAL(TIME / 1000, 'SECOND') as dat FROM FM_ALARM_11_12_2018 where
to_number(to_date('01-JAN-2019 10:00:00','DD-MON-YYYY HH24:MI:SS') - to_date('01-JAN-1970','DD-MON-YYYY')) * &cnv_time > TIME;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment