Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Truncating trailing spaces on Oracle8

Re: Truncating trailing spaces on Oracle8

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 8 Jul 1999 12:04:41 +0100
Message-ID: <931432159.2083.0.nnrp-06.9e984b29@news.demon.co.uk>

Quick and dirty fix -

    set postcode = rpad(:1,4)

Alternative strategy

    create postcode as CHAR(4)
    rather than varchar2(4)
then it will always be padded to 4 characters (unless completely null) whatever goes in -  watch out for subsequent comparisons though.

--

Jonathan Lewis
Yet another Oracle-related web site: www.jlcomp.demon.co.uk

Homepages wrote in message
<931431337.29172.0.nnrp-01.c2dead46_at_news.demon.co.uk>...
>Hi
>
>I've got a problem with truncating trailing spaces on Oracle 8. I develop
on
>my PC using Personal Oracle 7 and Oraperl, and then upload to the server
>which runs Oracle 8
>
>If I do 'UPDATE props SET postcode = :1 WHERE ...' and then bind :1 to 'CR2
>' (note the trailing space), it actually updates it to 'CR2' (with no
>trailing space). It doesn't do this on Personal Oracle 7.
>
>How can I get it to actually take all four characters of 'CR2 ' and NOT
>truncate the trailing space? Is there a database option I can put into
>INIT.ORA? Is this a new 'feature' of Oracle 8 or is it a shortcoming of
>Personal Oracle 7?
Received on Thu Jul 08 1999 - 06:04:41 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US