Re: Oracle Forms 2.3 question on possible bug in using to_char
Date: 5 Jan 1994 12:30:35 -0500
Message-ID: <2getfr$jbd_at_access3.digex.net>
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.Received on Wed Jan 05 1994 - 18:30:35 CET