CREATE TABLE FACTURE_NL
(
  IDTFAC  NUMBER,
  NOMFAC  VARCHAR2(200 BYTE)
)
/

CREATE TABLE TYPE_LIGNE_FACTURE_NL
(
  IDTTYPLIGFAC  NUMBER,
  TYPLIGFAC     VARCHAR2(200 BYTE)
)
/

CREATE TABLE LIGNE_FACTURE_NL
(
  IDTLIGFAC     NUMBER,
  IDTFAC        NUMBER,
  IDTTYPLIGFAC  NUMBER
)
/

CREATE TABLE D_NATURE_PRIME_NL
(
  IDTNARPRM  NUMBER,
  NTRPRM     VARCHAR2(200 BYTE)
)
/

CREATE TABLE DETAIL_LIGNE_FACTURE_NL
(
  IDTDETLIGFAC  NUMBER,
  IDTLIGFAC     NUMBER,
  IDTNARPRM     NUMBER,
  MNT           NUMBER
)
/

INSERT INTO FACTURE_NL ( IDTFAC, NOMFAC ) VALUES ( 
1, 'Facture NL'); 
COMMIT;

INSERT INTO TYPE_LIGNE_FACTURE_NL ( IDTTYPLIGFAC, TYPLIGFAC ) VALUES ( 
1, 'RR'); 
INSERT INTO TYPE_LIGNE_FACTURE_NL ( IDTTYPLIGFAC, TYPLIGFAC ) VALUES ( 
2, 'RO'); 
INSERT INTO TYPE_LIGNE_FACTURE_NL ( IDTTYPLIGFAC, TYPLIGFAC ) VALUES ( 
3, 'RVAP'); 
COMMIT;

INSERT INTO LIGNE_FACTURE_NL ( IDTLIGFAC, IDTFAC, IDTTYPLIGFAC ) VALUES ( 
1, 1, 1); 
INSERT INTO LIGNE_FACTURE_NL ( IDTLIGFAC, IDTFAC, IDTTYPLIGFAC ) VALUES ( 
2, 1, 2); 
INSERT INTO LIGNE_FACTURE_NL ( IDTLIGFAC, IDTFAC, IDTTYPLIGFAC ) VALUES ( 
3, 1, 3); 
COMMIT;

INSERT INTO D_NATURE_PRIME_NL ( IDTNARPRM, NTRPRM ) VALUES ( 
1, 'Prime'); 
INSERT INTO D_NATURE_PRIME_NL ( IDTNARPRM, NTRPRM ) VALUES ( 
2, 'PB'); 
INSERT INTO D_NATURE_PRIME_NL ( IDTNARPRM, NTRPRM ) VALUES ( 
3, 'Ristourne'); 
INSERT INTO D_NATURE_PRIME_NL ( IDTNARPRM, NTRPRM ) VALUES ( 
4, 'Back Service'); 
INSERT INTO D_NATURE_PRIME_NL ( IDTNARPRM, NTRPRM ) VALUES ( 
5, 'Transfert In'); 
COMMIT;

INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
1, 1, 1, 100); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
2, 1, 2, 200); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
3, 1, 3, 300); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
4, 2, 1, 25); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
5, 2, 2, 456); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
6, 2, 3, 78); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
7, 3, 1, 78); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
8, 3, 2, 18); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
9, 3, 3, 89); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
10, 1, 4, 4554); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
11, 3, 5, 87787); 
INSERT INTO DETAIL_LIGNE_FACTURE_NL ( IDTDETLIGFAC, IDTLIGFAC, IDTNARPRM,
MNT ) VALUES ( 
12, 1, 5, 645); 
COMMIT;

SELECT typligfac
     , prm.mnt
     , pb.mnt
     , rst.mnt
     , bcs.mnt
     , t.mnt
  FROM type_ligne_facture_nl typ
     , ligne_facture_nl lig
     , detail_ligne_facture_nl prm
     , detail_ligne_facture_nl pb
     , detail_ligne_facture_nl rst
     , detail_ligne_facture_nl bcs
     , detail_ligne_facture_nl t
 WHERE typ.idttypligfac = lig.idttypligfac
   AND prm.idtligfac(+) = lig.idtligfac
   AND pb.idtligfac(+) = lig.idtligfac
   AND rst.idtligfac(+) = lig.idtligfac
   AND bcs.idtligfac(+) = lig.idtligfac
   AND t.idtligfac(+) = lig.idtligfac
   AND prm.idtnarprm = 1
   AND pb.idtnarprm = 2
   AND rst.idtnarprm = 3
   AND bcs.idtnarprm = 4
   AND t.idtnarprm = 5;
