SCN to TimeStamp - wrong expression?

177 Views Asked by At

I have SCN:

SELECT TIMESTAMP_TO_SCN(SYSTIMESTAMP) SCN FROM DUAL;

I can convert it to time stamp:

SELECT SCN_TO_TIMESTAMP(6480157) FROM DUAL;

When I want to mix this two select Im getting error:

SELECT SCN_TO_TIMESTAMP(SELECT TIMESTAMP_TO_SCN(SYSTIMESTAMP) FROM DUAL) FROM DUAL;

ORA-00936: missing expression

2

There are 2 best solutions below

0
F.Madsen On BEST ANSWER

Please use

SELECT SCN_TO_TIMESTAMP(TIMESTAMP_TO_SCN(SYSTIMESTAMP)) FROM DUAL;
0
Based On

@F.Madsen has the correct and simplest answer, but just to illustrate, you can get to the result following your logic:

SELECT SCN_TO_TIMESTAMP(SCN) FROM
(
  SELECT (TIMESTAMP_TO_SCN(SYSTIMESTAMP)) SCN FROM DUAL
);