I have a situation where I want to add a record to an Oracle 8.1.7 table. One of the fields is declared as VARCHAR2 NOT NULL, but I want its value to be a space.

DBD::Oracle 1.06 notes in the Changes file that as of 1.05, it strips trailing spaces from VARCHAR2 fields. This appears to be true on all operations, including SELECT.

Of course, if you strip trailing spaces from a field whose value is ONLY spaces, then the value becomes null (as far as Oracle is concerned).

The only workaround I've found thus far is to use NVL(?,' ') in the preparation of all statements which use this field.

Is there a better workaround? Please??

--Glenn


In reply to adding blank to varchar2 NOT NULL field in DBD::Oracle by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.