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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Search workaround for DBD:Oracle problem producing "ORA-01722"

Re: Search workaround for DBD:Oracle problem producing "ORA-01722"

From: Jimi Thompson <JIMIT_at_prodigy.net>
Date: Sat, 21 Jul 2001 23:52:57 GMT
Message-ID: <9g0d6f$cooi$1@newssvr06-en0.news.prodigy.com>

You may not have the right DBI/DBD combo for your application. Double check CPAN. Dr. Jens E. Wunderwald <jens.wunderwald_at_stb-ag.de> wrote in message news:797c938e.0106060857.ed79363_at_posting.google.com...
> Hi everybody,
>
> I have an Oracle DBD problem demonstrated in the following code:
>
> ---------------- start code -------------------------------------
> create table base(x varchar(255));
> create table derived as (select x from base where x >= 1);
> -- ok
>
> drop table derived;
>
> insert into base values('alpha');
>
> create table derived as (select x from base where x >= 1);
> -- DBD makes wrong guess leading to:
> -- ORA-01722: invalid number (DBD ERROR: OCIStmtExecute)
>
> drop table base;
> ---------------- end code ---------------------------------------
>
> The error happens when I execude the code using the Perl DBI, it
> does not occur under the Oracle SQL Worksheet.
>
> As far as I understand, the following happens: Oracle accepts the
> wrongly typed condition "where x >= 1" but the DBI make the false
> assumption that x is a number. It creates "derived(x number)" and
> Oracle does not accept an alpha value for "x".
>
> This behavor is quite annoying since the error depends upon the
> data in the base table: as long as it just contains numbers (stored
> as chars) nothing happens. The error occurs after entering the
> first real string value.
>
> Any ideas for fixing the problem except "write correct code"
> (sometimes I do err) and "use prepared statements"?
>
> Please CC to my e-mail adress, since I do not read this group
> regularly.
>
> Ciao Jens
Received on Sat Jul 21 2001 - 18:52:57 CDT

Original text of this message

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