1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| create or replace view v_lignes_di as
(select id_da_ligne as id_da_ligne, da_ligne.id_da_entete as id_da_entete,
da_ligne.id_organisation_logistique as id_organisation_logistique, da_ligne.id_article as id_article,
date_du_besoin as date_besoin, date_approbation as date_approbation, delai_appro as delai_appro,
case when date_du_besoin-date_approbation < delai_appro then 'O' else 'N' end as flg_di_anticip
from
da_entete, da_ligne,
(select id_article, delai_appro, id_organisation_logistique
from article_secondaire
where id_article in(select distinct id_article
from da_entete, da_ligne
where DA_LIGNE.ID_DA_ENTETE=DA_ENTETE.ID_DA_ENTETE
and DA_ENTETE.ID_TYPE_DOCUMENT = 19 )) temp
where
DA_LIGNE.ID_DA_ENTETE=DA_ENTETE.ID_DA_ENTETE
and DA_ENTETE.ID_TYPE_DOCUMENT = 19
and da_ligne.id_article = temp.id_article
and da_ligne.id_organisation_logistique = temp.id_organisation_logistique) |
Partager