Bonjour,

J'ai un module spécifique qui s'occupe de créer un fichier pour le factor.
Il est lancé depuis une procédure stockée ORACLE qui ne fonctionne plus depuis quelques jours.

SQL developer me retourne une erreur :
ORA-01722: Nombre non valide
J'imagine qu'une donnée ne renvoie pas un nombre mais je ne sais pas comment l'identifier, pouvez-vous m'aider s'il vous plait?

voici le code d'une partie de la procédure :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
dbms_output.put_line(' Ligne 6 ' || Nomuser );
 
 
 
 Execute immediate 
 
 ' create table 
 
z_affac_ecr_55_dom as 
 
 
 
select enr || contrat||refcli ||DEBITEUR ||BNPPFACTOR || SIREN || NIC || TVAINTRACEE|| TYP || NUM ||ACCDAT || DUEDAT||sens||montantcc
 
||montantor|| CODPAIBNP || jou || libelle || Filler as txt1, substr(lpad(rownum+1, 6,''0''),1,6) as chrono
 
 
 
 
 
from
 
(
 
select 
 
 ''55'' ENR ,(select zctdom_0 from zaffac where ztyp_0=''STD'') Contrat, 
 
  substr(rpad(t01.bpr_0, 35,'' ''), 1, 35) Refcli, 
 
 substr (rpad(t06.bprnam_0,20,'' ''), 1,20) as DEBITEUR, 
 
 ''000000000'' BNPPFACTOR, 
 
 ''         '' as SIREN,
 
 ''     '' as NIC,
 
  substr (rpad(t06.eecnum_0, 20,'' ''), 1,20) as TVAINTRACEE,
 
 
 
  decode( t01.typ_0, ''AVC'', ''AV'', ''FAC'', ''FA'',''ODG'', ''OD'' , ''ENC'',''PN'', ''??'') TYP,
 
  substr (( substr(t01.num_0, 1, 2) || substr(t01.num_0, 4, 12))||''    '',1,14) NUM,
 
 
 
 to_char(t01.accdat_0,''YYYYMMDD'') ACCDAT, to_char(t02.duddat_0,''YYYYMMDD'') DUEDAT,
 
 
 
 decode( t01.sns_0, -1,''C'', 1,''D'') sens,
 
 --t01.sns_0,
 
 substr(lpad(t01.amtcur_0*100, 17,''0''),-17,17) as MONTANTCC,
 
 substr(lpad(t01.amtcur_0*100, 17,''0''),-17,17) as MONTANTOR,
 
 
 
 decode(t05.pam_0,''BOR'', 4, ''CHQ'', 2,''VIR'', 3,''TRA'',5,''LCR'',7,'' '') as CODPAIBNP,
 
 substr (rpad(t02.jou_0,10,'' ''),1,10) as jou,
 
 substr (rpad(t02.desvcr_0, 50,'' ''),1,50) libelle,
 
RPAD('' '',58,'' '') filler
 
 
 
 
 
  --t01.*,t03.des_0, t02.*,t06.eecnum_0
 
  from  gaccentryd t01
 
  left join   gaccentry  t02 on t01.typ_0=t02.typ_0 and t01.num_0=t02.num_0
 
--  MAJ200131 left join   gaccdudate t05 on t01.typ_0=t05.typ_0 and t01.num_0=t05.num_0 and t01.lig_0=t05.lig_0 and t01.typ_0=t05.typ_0
 
  left join   gaccdudate t05 on t01.typ_0=t05.typ_0 and t01.num_0=t05.num_0 and t01.lin_0=t05.lig_0 and t01.typ_0=t05.typ_0
 
  left join   bpartner  t06 on t01.bpr_0=t06.bprnum_0
 
  left join   bpcustomer t07 on t01.bpr_0=t07.bpcnum_0
 
 
 
  left join GTYPACCENT  t03 on t01.typ_0=t03.typ_0
 
  where 
 
 t01.typ_0 in (''AVC'', ''FAC'', ''ODG'', ''ENC'') 
 
-- t01.bpr_0 >''41100000'' and t01.bpr_0<''41200000''
 
 -- Si ENC alors sac=ER
 
and t01.sac_0 in(''C1'',''ER'')
 
 
 
 and t01.mtc_0='' ''  
 
 and t01.cpy_0=''LCH''
 
 and t07.tsccod_2 =''DOM''   
 
 --A corriger après saisie des données  DOM
 
 --and t07.bcgcod_0 in (''00001'',''00002'')
 
 -- Selection date fin période suivant pour les écritures suivant choix utilisateur
 
 and t01.accdat_0<=decode((select zselecr_0  from zaffac where ztyp_0=''STD''), 2,(select zd2_0 from zaffac where ztyp_0=''STD''),''31/12/2099'')
 
 
 
 
 
 UNION
 
select 
 
 ''55'' ENR ,(select zctdom_0 from zaffac where ztyp_0=''STD'') Contrat, 
 
  substr(rpad(t01.bpr_0, 35,'' ''), 1, 35) Refcli, 
 
 substr (rpad(t06.bprnam_0,20,'' ''), 1,20) as DEBITEUR, 
 
 ''000000000'' BNPPFACTOR, 
 
 ''         '' as SIREN,
 
 ''     '' as NIC,
 
  substr (rpad(t06.eecnum_0, 20,'' ''), 1,20) as TVAINTRACEE,
 
 
 
 --decode( t01.typ_0, ''AVC'', ''AV'', ''FAC'', ''FA'',''ODG'', ''OD'' , ''ENC'',''PN'', ''??'') TYP,
 
 ''ER''  TYP,
 
 substr (( substr(t01.num_0, 1, 2) || substr(t01.num_0, 4, 12))||''    '',1,14) NUM,
 
 
 
 to_char(t01.accdat_0,''YYYYMMDD'') ACCDAT, to_char(t02.duddat_0,''YYYYMMDD'') DUEDAT,
 
 decode( t01.sns_0, -1,''C'', 1,''D'') sens,
 
 --t01.sns_0,
 
 substr(lpad(t01.amtcur_0*100, 17,''0''),-17,17) as MONTANTCC,
 
 substr(lpad(t01.amtcur_0*100, 17,''0''),-17,17) as MONTANTOR,
 
 
 
 decode(t05.pam_0,''BOR'', 4, ''CHQ'', 2,''VIR'', 3,''TRA'',5,''LCR'',7,'' '') as CODPAIBNP,
 
 substr (rpad(t02.jou_0,10,'' ''),1,10) as jou,
 
 substr (rpad(t02.desvcr_0, 50,'' ''),1,50) libelle,
 
RPAD('' '',58,'' '') filler
 
 
 
 
 
  --t01.*,t03.des_0, t02.*,t06.eecnum_0
 
  from  gaccentryd t01
 
 
 
  left join   gaccentry  t02 on t01.typ_0=t02.typ_0 and t01.num_0=t02.num_0
 
  -- MAJ200131 left join   gaccdudate t05 on t01.typ_0=t05.typ_0 and t01.num_0=t05.num_0 and t01.lig_0=t05.lig_0 and t01.typ_0=t05.typ_0
 
   left join   gaccdudate t05 on t01.typ_0=t05.typ_0 and t01.num_0=t05.num_0 and t01.lin_0=t05.lig_0 and t01.typ_0=t05.typ_0
 
  left join   bpartner  t06 on t01.bpr_0=t06.bprnum_0
 
  left join   bpcustomer t07 on t01.bpr_0=t07.bpcnum_0
 
 
 
  left join GTYPACCENT  t03 on t01.typ_0=t03.typ_0
 
  where 
 
 t01.typ_0 in (''AVC'', ''FAC'', ''ODG'', ''ENC'') 
 
-- t01.bpr_0 >''41100000'' and t01.bpr_0<''41200000''
 
 -- Si ENC alors sac=ER
 
and t01.sac_0 in(''Cx'',''ER'')
 
and t02.jou_0=''EAR''   
 
-- Selection journal Effet à recevoir pour éliminer les ecritures de banque 
 
 
 
 --and t01.mtc_0='' ''  
 
 and t01.cpy_0=''LCH''
 
--and t07.tsccod_2 <>''EXC''
 
and t07.tsccod_2 =''DOM'' 
 
-- and t07.bcgcod_0 in (''00001'',''00002'')
 
--and t01.accdat_0<=(select zd2_0 from zaffac where ztyp_0=''STD'')
 
and t05.duddat_0>=to_char(sysdate)
 
-- and t01.accdat_0<=(select zd2_0 from zaffac where ztyp_0=''STD'')
 
 -- Selection date fin période suivant pour les écritures suivant choix utilisateur
 
 and t01.accdat_0<=decode((select zselecr_0  from zaffac where ztyp_0=''STD''), 2,(select zd2_0 from zaffac where ztyp_0=''STD''),''31/12/2099'')
 
 
 
  )
 
 ';