<html><body><html v="urn:schemas-microsoft-com:vml" o="urn:schemas-microsoft-com:office:office" w="urn:schemas-microsoft-com:office:word" x="urn:schemas-microsoft-com:office:excel" m="http://schemas.microsoft.com/office/2004/12/omml"><head>

<meta name="Generator" content="Microsoft Word 14 (filtered medium)" />
<style><!--
/* Font Definitions */
@font-face
 {font-family:"MS Mincho";
 panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
 {font-family:"MS Mincho";
 panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
 {font-family:Calibri;
 panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
 {font-family:Tahoma;
 panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
 {font-family:"\@MS Mincho";
 panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
 {margin:0cm;
 margin-bottom:.0001pt;
 font-size:11.0pt;
 font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
 {mso-style-priority:99;
 color:blue;
 text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
 {mso-style-priority:99;
 color:purple;
 text-decoration:underline;}
span.EmailStyle17
 {mso-style-type:personal;
 font-family:"Calibri","sans-serif";
 color:windowtext;}
span.EmailStyle18
 {mso-style-type:personal;
 font-family:"Calibri","sans-serif";
 color:#1F497D;}
span.EmailStyle19
 {mso-style-type:personal-reply;
 font-family:"Calibri","sans-serif";
 color:#1F497D;}
.MsoChpDefault
 {mso-style-type:export-only;
 font-size:10.0pt;}
@page WordSection1
 {size:612.0pt 792.0pt;
 margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
 {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->

<meta name="viewport" content="width=device-width" /><meta http-equiv="Content-Type" content="text/vnd.ui.insecure+html;charset=utf-8" /></head><body lang="EN-GB" link="blue" vlink="purple" style="overflow-wrap:break-word; word-break: break-word;"><div class="mail_android_message" style="line-height: 1; padding: 0.5em">Have you thought of using OpenROAD to do this? <br>
It might enable you to do some of the processing in SQL and some in the 4GL? <br>
<br>
<br>
Or maybe report writer .... or maybe not ...<br>
Allan <br>
-- <br>
Sent from my Android phone with <a href="http://mail.com">mail.com</a> Mail. Please excuse my brevity.</div><div class="mail_android_quote" style="line-height: 1; padding: 0.3em">On 31/08/2018, 12:29 Martin Bowes &lt;martin.bowes@ndph.ox.ac.uk&gt; wrote:<blockquote class="gmail_quote" style="margin: 0.8ex 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">I would like to keep it in the database, but if push comes to shove I’m more than willing to look at some utility outside the database.<p></p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Marty<p></p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><p>&nbsp;</p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> Paul White [mailto:paul.white@shift7solutions.com.au]
<br />
<b>Sent:</b> 31 August 2018 12:20<br />
<b>To:</b> Martin Bowes; info-ingres@lists.planetingres.org<br />
<b>Subject:</b> RE: [Info-ingres] More similar to<p></p></span></p>
</div>
</div>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D">So you want output like this?<p></p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">res_note for snapshot_id = 14 is dodgy.<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">pos=55 char=0x03<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">pos=103 char=0x04<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">pos=11999 char=0x00<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">res_note for snapshot_id = 28 is dodgy.<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D">Text processing in the database. yuk.<p></p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D">Do you have the option of extracting the matching records to a file then do the grunt work with text processing tools?<p></p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D">Paul<p></p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span lang="EN-AU" style="color:#1F497D"><p>&nbsp;</p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> info-ingres-bounces@lists.planetingres.org [mailto:info-ingres-bounces@lists.planetingres.org]
<b>On Behalf Of </b>Martin Bowes<br />
<b>Sent:</b> Friday, 31 August 2018 8:41 PM<br />
<b>To:</b> info-ingres@lists.planetingres.org<br />
<b>Subject:</b> [Info-ingres] More similar to<p></p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-AU"><p>&nbsp;</p></span></p>
<p class="MsoNormal">Hi All,</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">I just knew this non printing character stuff was going to come back and bite me…</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">I can identify the rows with non printing characters excluding \t, \r and \n.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">Now I need to find which characters are being objected to on each row. I may need to know their position as well.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">The data in question is a long varchar. But (fortunately) the longest item is under 12000 characters, so we are under the 32000 char varchar conversion limit.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">The easiest way I can think of doing this is to do it in a database procedure…</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">create procedure identify_bad_char<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">as declare<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; snapshot_id integer4 not null not default;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; res_note&nbsp;&nbsp;&nbsp; long varchar not null not default;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; msgid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integer4 not null not default;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; msg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; varchar(256) not null not default;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">begin<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; msgid = 0;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; FOR SELECT snapshot_id, res_note INTO :snapshot_id, :res_note<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM basket_snapshot<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE res_note SIMILAR TO '%[^' + x'09' + x'0a' + x'0d' + '[:print:]]%'<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; DO<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msgid = msgid + 1;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msg = 'res_note for snapshot_id = ' + varchar(:snapshot_id) + ' is dodgy.';<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; message :msgid :msg;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;"><p>&nbsp;</p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Insert manic while loop here and process the line character by character */<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">&nbsp;&nbsp;&nbsp; ENDFOR;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;">end;<p></p></span></p>
<p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;"><p>&nbsp;</p></span></p>
<p class="MsoNormal">Before I start coding up the manic while loop … does anyone have a suggestion as to how I can do this more efficiently.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">The data was probably added to a web form via a cut and paste from a word document, so we’ve picked up things like smart quotes. Hence we may ultimately be interested in replacing multi character sequences with simple ansi equivalents.
 I have a suspicion a clean() function is galloping in my direction.</p><p></p>
<p class="MsoNormal"></p><p>&nbsp;</p>
<p class="MsoNormal">Martin Bowes<span style="font-family:&quot;Courier New&quot;"><p></p></span></p>
</div>

_______________________________________________
Info-ingres mailing list
Info-ingres@lists.planetingres.org
https://lists.planetingres.org/mailman/listinfo/info-ingres
</blockquote></div></body></html></body></html>