Saturday, 15 June 2013

sql - Generate dates between to date columns -


I'm trying to write a function that will populate a temporary table This temporary table, 'Orders' (both templates The table and the order share the same column names) will be populated from the rows in a table. In order, the rows items, location, quantity, sandwetts and expiration dates (sandad and end date are in 'yyyamamed' format). The difference between SendDate and Enddate will be required and the quantity will be expanded by the difference of dates. Example: A line with a quantity of 200 and sandwidth is 3/16 and the expiration date is 3/20, the function will need to be populated with the quantity of floating table with volume of 3 / 16-3 / 20 . Sample Data: - Item Location Quantity SendDate EndDate -Toy Store 200 20150316 20150320 Desired Results: - Item Location Quantity SendDate EndDate -Toy Store 40 20150316 20150320- Toy Store 40 20150317 20150320- Toy Store 40 20150318 20150320- Toy Store 40 20150319 20150320 -Toy Store 40 20150320 20150320

I'm a newbie in cursor statement, so I'm unsure about how to try it. Thank you in advance.

Using UNION ALL inside the normal table expression what you see He can give you that.

I am unfamiliar with the manipulation of Oracle's date but can do something like this:

 with  as X (D) (SELECT TO_DATE ('2014- 12-25 ',' yyyy-mm-dd ') Select all from dual union d + interval' 1 'day x WHERE d & lt; TO_DATE (' 2014-12-31 ',' yyyy-mm-dd ' ')) Select from * to x  

No comments:

Post a Comment