Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-25-2013
Registered User
 
Join Date: Jul 2012
Location: chennai
Posts: 59
Thanks: 6
Thanked 0 Times in 0 Posts
How to get the Missing dates between two dates in the table?

Hi Am Using Unix Ksh ...
I have a Table called date

Code:
select * from date ;

Date 
01/02/2013
06/02/2013

I need the output as

Code:
Missing Date 
01/02/2013 
02/02/2013
03/02/2013
04/02/2013
05/02/2013
06/02/2013

Can anyone help me pls............
Sponsored Links
    #2  
Old 02-25-2013
Registered User
 
Join Date: Oct 2007
Location: USA
Posts: 1,303
Thanks: 11
Thanked 99 Times in 95 Posts
I am no dba but what i would do is dump the table into a flat file...fill in the missing date time rows using perl...load it back into the date table...and if all of this sounds like baloney feel free to ignore it...
Sponsored Links
    #3  
Old 02-25-2013
Yoda's Avatar
Jedi Master
 
Join Date: Jan 2012
Location: Galactic Empire
Posts: 2,309
Thanks: 154
Thanked 738 Times in 710 Posts
You can use ALL_OBJECTS to generate missing dates:

Code:
select to_char(to_date('01/02/2013','dd/mm/yyyy') - 1 + rownum, 'dd/mm/yyyy') from ALL_OBJECTS
where  to_date('01/02/2013','dd/mm/yyyy') - 1 + rownum <= to_date('06/02/2013','dd/mm/yyyy');
01/02/2013
02/02/2013
03/02/2013
04/02/2013
05/02/2013
06/02/2013

Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Generating dates between two dates sathishsr Shell Programming and Scripting 4 08-09-2012 12:41 AM
How to write the dates between 2 dates into a file dsfreddie UNIX for Dummies Questions & Answers 5 06-20-2012 09:11 PM
Replacing dates]] with (dates)]] lawstudent Emergency UNIX and Linux Support !! Help Me!! 20 01-19-2011 03:13 PM
SQL: find if a set od dates falls in another set of dates vertical98 Programming 0 10-16-2010 01:31 AM
Need script to generate all the dates in DDMMYY format between 2 dates frozensmilz Shell Programming and Scripting 2 01-29-2009 05:06 AM



All times are GMT -4. The time now is 04:42 AM.