Re: Oracle Forms 2.3 question on possible bug in using to_char

From: Michael Winters <winters_at_access3.digex.net>
Date: 6 Jan 1994 00:26:58 -0500
Message-ID: <2gg7f2$md8_at_access3.digex.net>


In article <2getfr$jbd_at_access3.digex.net>, Michael P. Stein <mstein_at_access3.digex.net> wrote:
>In article <2gdgcg$3n4_at_access3.digex.net>,
>Michael Winters <winters_at_access3.digex.net> wrote:
>>I am getting a truncation problem with doing the following trigger in
>>Oracle Forms 2.3:
>>
>>select to_char(donor_seq,'09999')
>>into :donor.donor_code
>>from ops$irm015.last_donor
>>
>>last_donor has one column, donor_seq, defined as integer(5)
>>:donor.donor_code is a char(5) variable.
>>
>>After performing the above select statement in a pre-insert trigger,
>>:donor.donor_code = '0000'.
>
> The problem is not Forms 2.3; the problem is that the TO_CHAR()
>function, when used with a format mask, prepends a space if the converted
>number is nonnegative. Presumably this is so negatives and positives
>will line up properly, i.e. right justified. Thus ' 00008' is being put
>into a five-character field; the '8' is in position 6 and is truncated.
>Use the LTRIM function around the TO_CHAR() function in your select
>statement and you'll be fine.
>
>--
>Mike Stein The above represents the Absolute Truth.
>POB 10420 Therefore it cannot possibly be the official
>Arlington, VA 22210 position of my employer.

Way to go! Thanks for satisfying my curiosity why my Oracle code doesn't work. So, it sounds like an easy answer to this after all. Thanks a lot to the several suggestions I got for work arounds to this problem, everybody out there.....

  • Mike Winters Peace Corps (202)606-3330
Received on Thu Jan 06 1994 - 06:26:58 CET

Original text of this message