Unix/Linux Go Back    


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.

How to get the Missing dates between two dates in the table?

UNIX for Advanced & Expert Users


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-25-2013
Venkatesh1 Venkatesh1 is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 29 October 2013, 2:19 AM EDT
Location: chennai
Posts: 62
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 Unix and Linux 02-25-2013
shamrock shamrock is offline Forum Advisor  
Registered User
 
Join Date: Oct 2007
Last Activity: 10 October 2016, 3:03 PM EDT
Location: USA
Posts: 1,595
Thanks: 34
Thanked 156 Times in 147 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 Unix and Linux 02-25-2013
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 5 December 2016, 4:51 PM EST
Location: Galactic Empire
Posts: 3,529
Thanks: 248
Thanked 1,281 Times in 1,203 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
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 01:41 AM
How to write the dates between 2 dates into a file dsfreddie UNIX for Dummies Questions & Answers 5 06-20-2012 10:11 PM
Replacing dates]] with (dates)]] lawstudent Emergency UNIX and Linux Support 20 01-19-2011 04:13 PM
SQL: find if a set od dates falls in another set of dates vertical98 Programming 0 10-16-2010 02:31 AM
Need script to generate all the dates in DDMMYY format between 2 dates frozensmilz Shell Programming and Scripting 2 01-29-2009 06:06 AM



All times are GMT -4. The time now is 03:51 AM.