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!

Substr to get the date and validate

RedeDec 1 2010 — edited Dec 1 2010
Hi all,

I had a file with name as Emp_Names20101028_123245.txt

Now i want to validate the date part ( 20101028_123245 ) in the filename having the format YYYYMMDD HH24:MM:SS.

The date format should be only in the format as shown as above.other wise it should thrown an exception in a plsql procedure.
Declare

l_filename Varchar2(30);

Begin

l_filename = 'Emp_Names20101028_123245.txt'


/* Sql statement to check the format */

Exception

When others

Dbms_output.put_line(" Invalid File date Format");

End;
Edited by: Rede on Dec 1, 2010 12:41 PM
This post has been answered by MichaelS on Dec 1 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 29 2010
Added on Dec 1 2010
8 comments
5,384 views