Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / SQL Data Types
 

INTERVAL 1234 YEAR(3)

Invalid interval: 1234 contains four digits and therefore contains one too many digits allowed by the precision of 3 (which allows up to three digits). SQL> SQL> CREATE TABLE myTable (   2    id INTEGER,   3    duration INTERVAL YEAR(3) TO MONTH   4  ); Table created. SQL> SQL> INSERT INTO myTable (id, duration)VALUES (6, INTERVAL '1234' YEAR(3)); INSERT INTO myTable (id, duration)VALUES (6, INTERVAL '1234' YEAR(3))                                                       * ERROR at line 1: ORA-01873: the leading precision of the interval is too small SQL> SQL> select * from myTable; no rows selected SQL> SQL> drop table myTable; Table dropped. SQL>