<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6603.0">
<TITLE>varchar vs char</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=2 FACE="Arial">Can someone please explain why this is happening and is it correct?</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Why is it that in PH (and this does not happen in Oracle), a column with a varchar will retain any trailing spaces when data with spaces after the last char is read into it?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">ie:&nbsp;&nbsp;&nbsp;&nbsp; </FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">define a varchar * 10 = &quot;abc&nbsp;&nbsp; &quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;has 3 spaces after the 'c' letter</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">define b char*20 = &quot;|&quot; + a + &quot;|&quot;</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">report a b</FONT>

<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">go</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">This shows ...</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">&nbsp; A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; B</FONT>
</P>

<P><FONT SIZE=2 FACE="Courier New">&nbsp; abc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |abc&nbsp;&nbsp; |</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">Of course if I change the B define to trunc() the A define it works ...</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Courier New">define b char*20 = &quot;|&quot; + trunc(a) + &quot;|&quot;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">It won't make any difference if I change the char*20 to varchar*20 either.</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">I don't want to have to use trunc(). We have tons of columns we're migrating over to a new PH environment that are all varchars. I don't want to have to specify trunc() on ever item that populates those columns. Is there a setting in PH that tells the dictionary to &quot;naturally&quot; trunc()?</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Thanks again gang.</FONT>
</P>

<P><I><FONT COLOR="#0000FF" SIZE=4 FACE="Arial">Fernando Olmos</FONT></I>

<BR><B><FONT SIZE=2 FACE="Arial">M.I.S.</FONT></B>
</P>

<P><SPAN LANG="en-au"><B><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">HPA</FONT></B></SPAN><B><SPAN LANG="en-us"></SPAN></B><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT FACE="Arial"><BR>
</FONT></SPAN><SPAN LANG="en-au"></SPAN><SPAN LANG="en-au"><FONT COLOR="#000000" SIZE=2 FACE="Arial">Direct:  03 9217 5411</FONT></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><BR>
</SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-au"></SPAN><SPAN LANG="en-au"></SPAN><SPAN LANG="en-au"><FONT COLOR="#000000" SIZE=2 FACE="Arial">Mobile: 0410 382 857</FONT></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT FACE="Arial"><BR>
</FONT></SPAN><SPAN LANG="en-au"></SPAN><SPAN LANG="en-au"><FONT COLOR="#000000" SIZE=2 FACE="Arial">Fax:     03 9217 5716</FONT><FONT FACE="Arial"></FONT></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"> </SPAN>
</P>

<P><SPAN LANG="en-au"></SPAN><A HREF="file:///H:/Appdata/Microsoft/Signatures/www.hpa.com.au"><SPAN LANG="en-au"></SPAN><SPAN LANG="en-au"><U></U></SPAN><SPAN LANG="en-au"><U><B><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">www.hpa.com.au</FONT></B></U></SPAN><SPAN LANG="en-au"></SPAN></A><SPAN LANG="en-au"></SPAN><SPAN LANG="en-au"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"></SPAN>
</P>
<BR>

<pre>**********************************************************************
IMPORTANT
The contents of this e-mail and its attachments are confidential and intended
solely for the use of the individual or entity to whom they are addressed.  If
you received this e-mail in error, please notify the HPA Postmaster, postmaster@hpa.com.au,
then delete  the e-mail.
This footnote also confirms that this e-mail message has been swept for the
presence of computer viruses by Ironport. Before opening or using any
attachments, check them for viruses and defects.
Our liability is limited to resupplying any affected attachments.
HPA collects personal information to provide and market our services. For more
information about use, disclosure and access see our Privacy Policy at
www.hpa.com.au
**********************************************************************
</pre></BODY>
</HTML>