SCN 到 TimeStamp - 表达错误?

SCN to TimeStamp - wrong expression?

我有 SCN:

SELECT TIMESTAMP_TO_SCN(SYSTIMESTAMP) SCN FROM DUAL;

我可以把它转换成时间戳:

SELECT SCN_TO_TIMESTAMP(6480157) FROM DUAL;

当我想混合这两个时 select 我收到错误:

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

ORA-00936: missing expression

请使用

SELECT SCN_TO_TIMESTAMP(TIMESTAMP_TO_SCN(SYSTIMESTAMP)) FROM DUAL;

@F.Madsen 有正确和最简单的答案,但只是为了说明,你可以按照你的逻辑得到结果:

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