procedures (merged 2 topics by bb) [message #354707] |
Mon, 20 October 2008 22:52 |
gupta_vama
Messages: 8 Registered: October 2008 Location: hyderabad
|
Junior Member |
|
|
Hi,
i have 3 tables i.e.
promotions(promo_name,promo_subcategory,promo_category)
times(time_id,calendar_month_desc)
sales(time_id,promot_id,quantity_sold,amount_sold)
using above there tables i created one table i.e. aggr_calmonth_desc(promo_name,promo_subcategory_promo_category,calendar_month_desc,total_quantity_sold,total_amount_sold)
total_quantity_sold=sum(quantity_sold) group by promotions by calendar month
total_amount_sold=sum(amount_sold) group by promotions by calendar month
i am inserting values in a table by using procedure but whenever execute again the same procedure then again same records are inserted but how can i remove alredy existing values using procedure how can do it.
|
|
|
|
|
|
Re: procedures [message #354762 is a reply to message #354707] |
Tue, 21 October 2008 02:49 |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
Replace your current script with one that uses the MERGE command - that way you can insert or update the table, depending on whether or not the rows were added durung the last run.
|
|
|
Re: procedures [message #355558 is a reply to message #354707] |
Sat, 25 October 2008 05:04 |
dr.s.raghunathan
Messages: 540 Registered: February 2008
|
Senior Member |
|
|
hi,
set flag through one column. insert or update whenever this column is null and on doing insert or update set some non null value to flag column. It is very simplest solution unless you are concerned with some storage problems.
yours
dr.s.raghunathan
|
|
|