Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-01830: date format picture ends before converting entire input string

YoavDec 28 2009 — edited Dec 28 2009
Hi ,
I am runing the following statment and get result back as follow:
SELECT d.table_name, d.partition_name, d.tablespace_name,
  2                 to_date(SUBSTR (d.partition_name,
  3                         2,
  4                         LENGTH (d.partition_name) - 5
  5                         )
  6                 || SUBSTR (d.partition_name,
  7                     LENGTH (d.partition_name) - 3,
  8                     LENGTH (d.partition_name)
  9                     ) ,'YYYYMMDD') part_date
 10                 FROM user_tab_partitions d
 11                 WHERE d.table_name = 'RADIUS_LOG' AND d.partition_name NOT LIKE '%MAX%';

TABLE_NAME                     PARTITION_NAME                 TABLESPACE_NAME                PART_DATE
------------------------------ ------------------------------ ------------------------------ ---------
RADIUS_LOG                     P20091111                      RADIUS_DATA_TS                 11-NOV-09
RADIUS_LOG                     P20091112                      RADIUS_DATA_TS                 12-NOV-09
RADIUS_LOG                     P20091113                      RADIUS_DATA_TS                 13-NOV-09
After adding the part_date to the where clause i am getting : ORA-01830: date format picture .
Why ?
 select t.table_name,t.partition_name, t.tablespace_name,to_date(t.part_date,'dd/mm/rrrr') p_date
  2    from(
  3    SELECT d.table_name, d.partition_name, d.tablespace_name,
  4                  to_date(SUBSTR (d.partition_name,
  5                          2,
  6                          LENGTH (d.partition_name) - 5
  7                          )
  8                  || SUBSTR (d.partition_name,
  9                      LENGTH (d.partition_name) - 3,
 10                      LENGTH (d.partition_name)
 11                      ) ,'YYYYMMDD') part_date
 12                  FROM user_tab_partitions d
 13                  WHERE d.table_name = 'RADIUS_LOG' AND d.partition_name NOT LIKE '%MAX%'
 14         ) t 
 15     where to_date(t.part_date,'dd/mm/rrrr') < to_date(sysdate,'dd/mm/rrrr') - 7;
                || SUBSTR (d.partition_name,
                 *
ERROR at line 8:
ORA-01830: date format picture ends before converting entire input strin
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 25 2010
Added on Dec 28 2009
13 comments
10,897 views