oracle replaces spaces in fields

I encountered a problem today. After the fields in one report were transferred to another report, the line breaks and tabs in the string were lost, resulting in data query errors. I tried several methods, but I didn't solve it. Finally, I used a very low method, that is, in the conditional query in the second report, I processed the fields, removed all spaces, tabs, and newlines. , Can solve this problem.

select m.Sectitemid,
       m.SECTNAME,
       m.SECTDEPT,
       o.name,
       m.sectitemdesc,
       m.sectifyid,
       m.SECDESC,
       m.SECFINRESULT,
       m.SECTSTEATE
  from (Select a.Sectitemid,
               a.SECTNOTICEID,
               a.eventType,
               b.SECTNAME,
               b.SECTDEPT,
               a.sectitemdesc,
               c.sectifyid,
               c.SECDESC,
               c.SECFINRESULT,
               c.SECTSTEATE,
               x.asname
          From v_Sec_Check a
          left join SEC_BAOPESYSTEM x on a.SYSTEMID = x.id
          left join Sec_Rectifynotice b on a.Sectnoticeid = b.Sectnoticeid
          left join SEC_RECTIFYSTEP c on a.Sectitemid = c.sectitemid
         Where 1 = 1
           and NVL(businessType, 'A') <> 'H'
           and a.SECFORMDEPT = '8a8a11ef301b2f3301301bc4324e004a'
           and a.createdt >= to_date('2019-01-01', 'yyyy-mm-dd')
           and a.createdt <= to_date ( ' 2019-12-31 ' , ' yyyy-mm-dd ' ) 
           and replace (replace (replace (replace (a.sectitemdesc, '  ' , '' ), chr ( 10 ), ' ' ), chr ( 13 ), ' ' ), chr ( 9 ), ' ' ) = 
               replace (replace (replace (replace ( ' 2, the basic theory and basic skills of individual pilots are insufficient. 
( 1 ) Crosswind operation skills Need to be further strengthened. The monitoring of the trajectory of the aircraft and the timing of the five-sided entry are not accurate in crosswind weather. The coordination of the rudder and the side rod is insufficient when taking off and landing. The leveling of the rudder is too large and fast, and the front wheel is not timely. 
( 2) The basic theory is not solid. The training of the EOSID program in Chengdu was not in place. During the course follow-up inspection, the flight crew found that the flight route and flight altitude of the program were incorrectly understood. In the non-precision approach of management, theoretical knowledge is not comprehensive. 
( 3 ) The execution of thrust reduction is more conservative, and the takeoff thrust is not set strictly according to the performance calculation data. 
( 4 ) Wet runway alignment uses right-angle turning technology. When the turning speed and turning angle are too large, it is easy to cause the aircraft to move sideways.
' , '  ' , ' ' ), chr (10), ' ' ), chr (13), ' ' ), chr (9), ' ' )) m, 
       sys_organization o
  where m.SECTDEPT = o.id;

The most important one is the series of replacements, which do not look good. If you use more, you can write him as a function to call. I will use a report here.

 


Common special characters:
chr (9)
-tab chr (10)
-line feed chr (13)
-carriage return chr (32)-space character

 

Guess you like

Origin www.cnblogs.com/anningkang/p/12737853.html