In DB2, some texts in the character are intercepting

xiaoxiao2021-03-05  35

Check the content in a particular location in a field, such as some XML documents in the group. I chose the Locate function of DB2, which returns the position of the specific substrings in a given string, and I get the beginning and end position of a specific string through the Locate function, and Idle is intercepted by Substr. Below is the difference between the two methods, methods, and methods, two methods - Method 1 SELECT SUBSTR (Substr (NOTECONTENT, 200, 100), 6 Locate ('<

', Substr (NOTECONTENT, 200, 100)), LOCATE ('', Substr (NOTECONTENT, 200, 100)) - 6-Locate ('', Substr (NOTECONTENT, 200, 100))) from userid.t_note_culture

- Method Two Temp As (SELECT NOTEID, LOCATE ('', Substr (NOTECONTENT, 200, 100)) AS Begin, Locate ('', Substr (NOTECONTENT, 200, 100)) AS LTHFROM UserId.t_note_culture

) SELECT TEMP.BEGIN, TEMP.LTH, SUBSTR (NOTECONTENT, 205 TEMP.BEGIN, TEMP.LTH-TEMP.BEGIN-6) from Temp, userid.t_note_culture a where a.noteid = Temp.noteid

转载请注明原文地址:https://www.9cbs.com/read-33571.html

New Post(0)