On Mon, 10 Mar 2003 20:44:26 -0800 (PST), Michael A Chase wrote:
>On Mon, 10 Mar 2003 22:55:26 -0500 "Matthew O. Persico"
><[EMAIL PROTECTED]> wrote:
>
>>Conclusion: somewhere in bind_param or whatever it is that it
>>invokes, trailing blanks are being stripped before the call to the
>>OCI.
>>
>>I was able to get around this by using
>>
>>$sth->bind_param($col_idx, $value, {TYPE => DBI::SQL_CHAR});
>>
>>So, my question is, why is the DBI apparently taking it upon itself
>>to enforce string trimming for varchars? Shouldn't the server be
>>responsible? And shouldn't the DBI behave the same for th same
>>value whether it is bound or constant? Or is there something stupid
>>I am missing?
>
>http://xmlproj.com/fom-serve/cache/124.html

That's what I thought should happen. And I really don't have
a problem with that happening.

Except, then this shouldn't work:

SQL> create table foo (nulls_allowed varchar2(3), no_nulls_allowed varchar2(3) not 
null);

Table created.

SQL> insert into foo values ('1','1');

1 row created.

SQL> insert into foo values ('','');
insert into foo values ('','') * ERROR at line 1: ORA-01400: cannot
insert NULL into ("AMGDEV"."FOO"."NO_NULLS_ALLOWED")

SQL> insert into foo values (' ',' ');

1 row created.

SQL> commit;

Commit complete.

Why isn't the trailing whitespace stripped in the third insert? Is this an SQLPLUS 
aberration?

--
Matthew O. Persico


Reply via email to