0

I have my datetime column in table defined as Oracle NUMBER data type which contains data in this format 1363709957 for example.

I want to get these numbers in query so i can execute my insert scripts which will put in current time in there. What is the oracle SQL for that?

1
  • @Ben I do not want any conversion here. I just want the epoch time in oracle sql in NUMBER format. Commented Mar 26, 2013 at 9:28

1 Answer 1

2

Your time stamp appears to be a standard Unix time stamp. You need to use arithmetic to convert this here's a post on OTN about this,

and one for the other direction.

Sign up to request clarification or add additional context in comments.

2 Comments

I am using this SELECT (SYSDATE - TO_DATE('01-01-1970 00:00:00', 'DD-MM-YYYY HH24:MI:SS')) * 24 * 60 * 60 FROM DUAL. But then it gives me values as 1364264318.999999999999999999999999999998 and not as whole number
This is normal floating point behavior. You can use the ROUND() function to make an integer of it. The INTEGER() function will truncate, so you need to round.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.