| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 
 | 	   FOR recFlxAirprice in (
								SELECT faretarifnumber, codeorigine, codedestination, codecompagnie,
								       farebasis, prixpublic_al, prixpublic_al_rt, codemonnaie,
								       datedebutvalidite, ft_first_ticketing_date, ft_last_ticketing_date,
								       footnote, route
								  FROM surcouf.flx_airprice
								 WHERE dateduflux = (SELECT MIN (dateduflux)
								                       FROM flx_airprice)
								INTERSECT
								SELECT faretarifnumber, codeorigine, codedestination, codecompagnie,
								       farebasis, prixpublic_al, prixpublic_al_rt, codemonnaie,
								       datedebutvalidite, ft_first_ticketing_date, ft_last_ticketing_date,
								       footnote, route
								  FROM surcouf.flx_airprice
								 WHERE dateduflux = (SELECT MAX (dateduflux)
								                       FROM flx_airprice)									 
								)
	   LOOP
 
	   	   Update surcouf.flx_airprice
		   SET etat = 10
		   WHERE faretarifnumber = recflxairprice.faretarifnumber
			   AND codeorigine = recflxairprice.codeorigine
			   AND codedestination = recflxairprice.codedestination
			   AND codecompagnie = recflxairprice.codecompagnie
			   AND farebasis = recflxairprice.farebasis
			   AND prixpublic_al = recflxairprice.prixpublic_al
			   AND prixpublic_al_rt = recflxairprice.prixpublic_al_rt
			   AND codemonnaie = recflxairprice.codemonnaie
			   AND datedebutvalidite = recflxairprice.datedebutvalidite
			   AND ft_first_ticketing_date = recflxairprice.ft_first_ticketing_date
			   AND ft_last_ticketing_date = recflxairprice.ft_last_ticketing_date
			   AND footnote  = recflxairprice.footnote
			   AND route = recflxairprice.route
			   AND dateduflux = date_new_flux;
	   END LOOP; | 
Partager