Hi,
Im new to perl and i wrote a script for oracle DB using DBI
The program is as follows,
#!/usr/bin/perl
use DBI;
use DBD::Oracle;
my $dbh=DBI->connect("dbi:Oracle:XE","suhail","suhail",<br>{AutoCommit
+=>0,RaiseError=>1})||die "Can't connect $DBI::errstr";
$sql='insert into u_configname values (?,?,?,?,?,?,?,?,?,?,?)';
open(MY,"Desktop/b1.txt");
while(<MY>)
{
my($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k)=split /,/;
eval {
my $sth=$dbh->prepare($sql);
$sth->execute($a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k)||die "$!";
$dbh->commit;
};
if ($@) {
$dbh->rollback;
}
}
close(MY);
END
{
$dbh->disconnect if defined $dbh;
}
After running the above program it shows error like,
DBD::Oracle::st execute failed: ORA-01722: invalid number (DBD ERROR: error possibly near <*> indicator at char 75 in 'insert into u_configname values (:p1,:p2,:p3,:p4,:p5,:p6,:p7,:p8,:p9,:p10,:<*>p11)')
for Statement "insert into u_configname values (?,?,?,?,?,?,?,?,?,?,?)" with ParamValues: :p1='0', :p10='09-JAN-2009', :p11='1000003
', :p2='0', :p3='09-JAN-2009', :p4='1000003', :p5='SO_PRICE_LIMIT', :p6='Y', :p7='priceLimit', :p8='PriceLimit', :p9='1000000' at ora4.pl line 14, <MY> line 1.
.............................
And the u_configname table description is as follows
SQL> desc u_configname;
Name Null? Type
----------------------------------------- --------
----------------------------
AD_CLIENT_ID NOT NULL NUMBER(10)
AD_ORG_ID NOT NULL NUMBER(10)
CREATED NOT NULL DATE
CREATEDBY NOT NULL NUMBER(10)
IDENTIFIER NOT NULL VARCHAR2(60)
ISACTIVE NOT NULL CHAR(1)
NAME NOT NULL VARCHAR2(60)
PRINTNAME NOT NULL VARCHAR2(60)
U_CONFIGNAME_ID NOT NULL NUMBER(10)
UPDATED NOT NULL DATE
UPDATEDBY NOT NULL NUMBER
Can anyone help me on this problem plz...............
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.