Re: [Q] Using Oraperl to INSERT data

From: Michael Nolan <nolan_at_helios.unl.edu>
Date: 6 Dec 1993 19:16:04 GMT
Message-ID: <2e00dk$33n_at_crcnis1.unl.edu>


ryba_at_ml.csiro.au (Miroslaw Ryba) writes:

> &ora_bind($csr, "Tom", "");
 

>results in: ORA-01722: invalid number ...

This is because the bind process doesn't translate "" into an Oracle NULL. The best way to do this is with a variable:

     &ora_bind($csr, $name, $phone);

Then you need to make sure that $phone is undefined in perl, ie, do something like: undef $phone;

(Remember, though, that virtually any reference to a variable, even printing it, causes it to be defined.)

Assuming that PHONE is a VARCHAR2 variable in ORACLE 7, then changing your definition to read 'RTRIM(:2)' should work, too. (This should also work in Oracle 6, but I haven't tested it there.)

---
Michael Nolan, Sysop for the DBMS RoundTable on GEnie
nolan_at_notes.tssi.com, dbms_at_genie.geis.com
(posted from nolan_at_helios.unl.edu)
Received on Mon Dec 06 1993 - 20:16:04 CET

Original text of this message