On Tue, 11 Mar 2003 18:09:44 -0500 "Matthew O. Persico" <[EMAIL PROTECTED]> wrote:

> On Mon, 10 Mar 2003 20:44:26 -0800 (PST), Michael A Chase wrote:

> >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.

The FAQ article is talking about bind variables AKA placeholders in
DBD::Oracle code, *NOT* SQL*Plus.

> Except, then this shouldn't work:

Why not?  SQL*Plus != DBI

> 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?

Because SQL*Plus cheats.  It passes the values to the RDBMS as CHAR
values because it knows they are space padded.  Try it in SQL*Plus
with VARCHAR bind variables and see what happens.

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to