| 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
 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
 
 |  
 
  select * from
             (
 
                select
 
 
                         case BFTCode
                         when 'PASCH' then
 
                             'Histoire du '
                         else 
 
                           nvl(regexp_replace(DBMS_LOB.SUBSTR(bftext,4000,1), '- Examen realisé: \s+?([^'||v_Linebreak||']*)'||v_Linebreak||'.*$', '\1',1,1,'n'), 'Examen')
 
                             ||' du '
                         end
                         ||
 
                         case BFTCode
                         when 'PASCH' then
                             regexp_replace(
                               regexp_substr(
                                 DBMS_LOB.SUBSTR(bftext,4000,1)
                                 -- DBMS_LOB.SUBSTR(bftext,4000,1)
                                 , ' - Date Examen:\s+\d\d\d\d\d\d\d\d'
                                 , 1, 1 
                               )
                               , ' - Date Examen:\s+(\d\d\d\d)(\d\d)(\d\d)', '\3.\2.\1' 
                             )
 
                             || ' - ' || regexp_replace(BFTitre, '\s+-$', '')
                         else 
                             regexp_substr(
                               regexp_substr(
                                 DBMS_LOB.SUBSTR(bftext,4000,1)
                                 , ' - Date Examen:\s+\d\d.\d\d.\d\d\d\d'
                                 , 1, 1  
                               )
                                , '\d\d.\d\d.\d\d\d\d'
                             )
                         end
 
                         || v_Linebreak
 
                         || rpad('-',
                                 case BFTCode
                                 when 'RAD' then 48
                                 when 'PASCH' then 73
                                 else 43
                                 end
                                 , '-')||v_Linebreak
 
                         || replace(
                              replace(
                                replace(
                                  regexp_replace(
                                    regexp_replace(
                                      regexp_replace(
                                        rtrim(DBMS_LOB.SUBSTR(bftext,4000,1))
                                        , ' - Recommandation : .*', '', 1, 1, 'n')
                                      , ' - Date Examen:\s+[0-9.]{8,10}'||v_Linebreak, '')
                                    , '- Examen realisé: \s+?([^'||v_Linebreak||']*?)'||v_Linebreak, '',1,1,'n')
                                  , ' - Befundtext: '||v_Linebreak, '')
                                , ' - Beurteilung: '||v_Linebreak, '')
                              , '- Critiques: '||v_Linebreak, '')
 
                         || v_Linebreak RESULTAT
 
                    from bfbefind
 
                         join BFTBefindtyp on BFTRefnr = bftyp
                   where BFHoRefnr = p_HoRefnr
                     and BFStatus = 1 
                     and BFTCode in ('RAD', 'PASCH', 'ENDO', 'SONO', 'NSONO', 'EPU', 'NACHK', 'EK')
                order by BFTCode, BFDate, BFAuftragsnr, BFTitre
            ) | 
Partager