Unanswered: Newbie..need help with year and month manipulation.
heres my code..I m trying to generete 6 months of data in orcale..the dataset is huge..in billions..what query should i use to extract only last 6months from the database..pls help...
from enttsku a, cirttrn b
where b.trans_dt between to <WHT SHOULD I USE TO GENERATE JUST LAST 6 MONTHS OF DATA > and a.sku_id = b.sku_id
and a.subclass_id in (915,287,701,719,256)
With that number of rows you really should be using Oracle Partitioning. Since you are querying transaction data I would assume it's partitionable by year+month, or maybe year+quarter. When you issue the query, Oracle will detect which partitions apply and will prune the other partitions from the query plan. Much faster.
Just a thought. Looks like Andrew already answered the real question.