SQL Language (MOSC)

MOSC Banner

Using rownum with interval

edited Jun 29, 2012 9:26AM in SQL Language (MOSC) 1 commentAnswered
Is there any limitation in passing dynamic values to INTERVAL?

SQL> select trunc(sysdate,'YY')+interval rownum year from dba_objects where rownum<9;
select trunc(sysdate,'YY')+interval rownum year from dba_objects where rownum<9
                                    *
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

SQL> select trunc(sysdate,'YY')+interval '1' year from dba_objects where rownum<9;

TRUNC(SYS
---------
01-JAN-13
01-JAN-13
01-JAN-13
01-JAN-13
01-JAN-13
01-JAN-13
01-JAN-13
01-JAN-13

8 rows selected.

Thanks

Mukul

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center