Recursive SQL giving ORA-01790

前端 未结 3 1424
自闭症患者
自闭症患者 2021-02-10 04:46

Using Oracle 11g release 2, the following query gives an ORA-01790: expression must have same datatype as corresponding expression:

with intervals(time_interval)         


        
3条回答
  •  逝去的感伤
    2021-02-10 05:31

    Odd - works if you pass around varchars and convert (not cast):

    WITH intervals(time_interval) AS
      (SELECT to_char(TRUNC(systimestamp))
      FROM dual
      UNION ALL
      SELECT to_char(to_timestamp(time_interval) + numtodsinterval(10, 'Minute'))
      FROM intervals
      WHERE to_timestamp(time_interval) < systimestamp
      )
    SELECT to_timestamp(time_interval) time_interval
    FROM intervals
    

提交回复
热议问题