RE: fixed and string concatenation

"Schroeder, Alexander" <[email protected]> Wed, 17 Sep 2003 14:50:12 +0200
Newsgroups gmane.comp.db.sapdb.general
Message-ID <[email protected]>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C37D1A.3C0C3300
Content-Type: text/plain;
	charset="koi8-r"

At least you can do:
 
SELECT '>' || truncated_fixfld || '<' FROM (SELECT TRUNC(fixfld) as truncated_fixfld FROM table)
 
if you want simple truncation (although even this looks a little bit ugly).
 
If you want, e.g. 8.00 as 8 and 8.10 as 8.1 and 8.13 as 8.13 you may use
 
select '<' || RTRIM(RTRIM(fixfld,'0'),'.') || '>' from table
 
Regards
 
Alexander Schroder
SAP DB, SAP Labs Berlin 

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, September 17, 2003 1:47 PM
To: [email protected]
Subject: fixed and string concatenation


Hi.
 
How I can receive the following result from
 
select '>' || fixfld || '<' from table
 
>8<
 
Where fixfld = 8 for example and fixfld is fixed (5,2).
 
I receive >8.00<
 


------_=_NextPart_001_01C37D1A.3C0C3300
Content-Type: text/html;
	charset="koi8-r"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=koi8-r">


<META content="MSHTML 6.00.2722.900" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff size=2>At 
least you can do:</FONT></SPAN></DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff size=2>SELECT 
'&gt;' ||&nbsp;truncated_fixfld || '&lt;' FROM (SELECT TRUNC(fixfld) as 
truncated_fixfld FROM table)</FONT></SPAN></DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff size=2>if you 
want simple truncation (although even this looks a little bit 
ugly).</FONT></SPAN></DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff size=2>If you 
want, e.g. 8.00 as 8 and 8.10 as 8.1 and 8.13 as 8.13 you may 
use</FONT></SPAN></DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff size=2>select 
'&lt;' || RTRIM(RTRIM(fixfld,'0'),'.') || '&gt;' from table</FONT></DIV></SPAN>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff 
size=2>Regards</FONT></SPAN></DIV>
<DIV><SPAN class=353503912-17092003><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><FONT size=2>Alexander Schr&ouml;der<BR>SAP DB, SAP Labs Berlin </FONT></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> [email protected] 
  [mailto:[email protected]]<BR><B>Sent:</B> Wednesday, September 17, 2003 1:47 
  PM<BR><B>To:</B> [email protected]<BR><B>Subject:</B> fixed and 
  string concatenation<BR><BR></FONT></DIV>
  <DIV><FONT face="Arial Cyr" size=2>Hi.</FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial Cyr" size=2>How I can receive the following result 
  from</FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial Cyr" size=2>select '&gt;' || fixfld || '&lt;' from 
  table</FONT></DIV>
  <DIV><FONT face="Arial Cyr" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial Cyr" size=2>&gt;8&lt;</FONT></DIV>
  <DIV><FONT face="Arial Cyr" size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial Cyr" size=2>Where fixfld = 8 for example and <FONT 
  face="Arial Cyr" size=2>fixfld is fixed (5,2)</FONT>.</FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face="Arial Cyr" size=2>I receive &gt;8.00&lt;</FONT></DIV>
  <DIV><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C37D1A.3C0C3300--