<html><head>









<style><!--&#10;/* Font Definitions */&#10;@font-face&#10;        {font-family:"Cambria Math";&#10;        panose-1:2 4 5 3 5 4 6 3 2 4;}&#10;@font-face&#10;        {font-family:Calibri;&#10;        panose-1:2 15 5 2 2 2 4 3 2 4;}&#10;@font-face&#10;        {font-family:"Lucida Console";&#10;        panose-1:2 11 6 9 4 5 4 2 2 4;}&#10;/* Style Definitions */&#10;p.MsoNormal, li.MsoNormal, div.MsoNormal&#10;        {margin:0cm;&#10;        margin-bottom:.0001pt;&#10;        font-size:11.0pt;&#10;        font-family:"Calibri",sans-serif;&#10;        mso-fareast-language:EN-US;}&#10;a:link, span.MsoHyperlink&#10;        {mso-style-priority:99;&#10;        color:#0563C1;&#10;        text-decoration:underline;}&#10;a:visited, span.MsoHyperlinkFollowed&#10;        {mso-style-priority:99;&#10;        color:#954F72;&#10;        text-decoration:underline;}&#10;span.EmailStyle17&#10;        {mso-style-type:personal-compose;&#10;        font-family:"Calibri",sans-serif;&#10;        color:windowtext;}&#10;.MsoChpDefault&#10;        {mso-style-type:export-only;&#10;        font-family:"Calibri",sans-serif;&#10;
        mso-fareast-language:EN-US;}&#10;@page WordSection1&#10;        {size:612.0pt 792.0pt;&#10;        margin:72.0pt 72.0pt 72.0pt 72.0pt;}&#10;div.WordSection1&#10;        {page:WordSection1;}&#10;--></style><!--[if gte mso 9]><xml>&#10;<o:shapedefaults v:ext="edit" spidmax="1026" />&#10;</xml><![endif]--><!--[if gte mso 9]><xml>&#10;<o:shapelayout v:ext="edit">&#10;<o:idmap v:ext="edit" data="1" />&#10;</o:shapelayout></xml><![endif]-->
</head>
<body>
    <div style="font-size: 10pt;"><div dir="auto">Morning</div><div dir="auto"><br></div><div dir="auto">If you use zero instead of 1 do you get the same?</div><div dir="auto"><br></div><div dir="auto">I must admit i have not seen that 'when a is integer/float' syntax before.</div><div dir="auto"><br></div><div dir="auto">But then i use openroad so our syntax is about 20 years behind.</div><div dir="auto"><br></div><div dir="auto">Adrian</div></div><div style="font-size: 10pt;"><div id="LGEmailHeader" dir="auto"><div dir="auto"><br></div><div
 dir="auto">------ Original message------</div><div dir="auto"><b>From: </b>Martin Bowes<martin.bowes@ndph.ox.ac.uk></martin.bowes@ndph.ox.ac.uk></div><div dir="auto"><b>Date: </b>Wed, 29 Jul 2020 08:01</div><div dir="auto"><b>To: </b>Ingres lists;</div><div dir="auto"><b>Cc: </b></div><div dir="auto"><b>Subject:</b>[Info-ingres] why is an empty string an integer</div><div dir="auto"><br></div></div><div dir="auto">
<div class="WordSection1">
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">I may have come across this before, but it’s early and I haven’t had my coffee.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">declare global temporary table fred(<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida
 Console&quot;">&nbsp;&nbsp;&nbsp; a varchar(20)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">) on commit preserve rows with norecovery;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * insert into fred values (null), (''), ('1'), ('13-jan-2020');<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
 style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">continue<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">* * * * * * * * select case when a is null then 'null'<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when a = '' then 'empty string'<o:p></o:p></span></p>
<p
 class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else a end as data,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is integer then 'integer' else 'not integer' end as is_integer,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case when a is float then 'float' else 'not float' end as is_float,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case when a is ansidate then 'ansidate' else 'not ansidate' end as is_ansidate<o:p></o:p></span></p>
<p
 class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">from fred;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">┌────────────────────┬───────────┬─────────┬────────────┐<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">│data&nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;│is_integer │is_float │is_ansidate │<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">├────────────────────┼───────────┼─────────┼────────────┤<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">│null&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │not integer│not float│not ansidate│<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">│empty string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │<span style="background:yellow;mso-highlight:yellow">integer&nbsp;&nbsp;&nbsp; │float</span>&nbsp;&nbsp;&nbsp; │not ansidate│<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span
 style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">│1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │integer&nbsp;&nbsp;&nbsp; │float&nbsp;&nbsp;&nbsp; │not ansidate│<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">│13-jan-2020&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; │not integer│not float│ansidate&nbsp;&nbsp;&nbsp; │<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">└────────────────────┴───────────┴─────────┴────────────┘<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(4 rows)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida
 Console&quot;">continue<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Now the tests with nulls behave as I expect. But the empty string cases I did not expect. Is this a bug? Documented behaviour?<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Martin Bowes<o:p></o:p></p>
</div>
</div></div>


</body></html>