Re: Problem populating execute using @array.

2002-09-19 Thread Tim Bunce

Use trace.
Use trace.
Use trace.

Tim.

On Wed, Sep 18, 2002 at 02:35:02PM -0400, Dolan, Mark wrote:
 I am trying to update a table in an Oracle database. I am reading an
 input file which has 
 the column names for the database as the first record in the file. The
 data begins in the second row. I read the first record to pull off the
 column names. I create the sql using placeholders. I then read the rest
 of the file. At the end of the loop I attempt to perform the 'execute'
 using the statement handle of the database. I get the following error.
 
 DBD::Oracle::st execute failed: ORA-01722: invalid number (DBD ERROR:
 OCIStmtExecute) at ./ins line 61, $FH line 1. 
 
 At the time of the execute ins = 20, 2, Hello, Dolly, 000,
 01, 022 
 
 
 # assume sth is a valid statement handle 
 # assume $FH is a handle to an opened file 
 my $columns = $FH; 
 # 
 # read first record of input file 
 # split the column headers 
 # 
   my $columnitem; 
   chomp($columns); 
   ins = split /\|/, $columns; 
   foreach $columnitem (ins) { 
$columnitem = \.$columnitem.\; 
   } 
 my $formatcolumns=join ( ', ', ins ); 
 my $valstring= join ( ', ' , ('?') x scalar ins ); 
 my $sql= INSERT INTO $table ( $formatcolumns ) VALUES ( $valstring) ; 
 while ( my $line = $FH ) 
 { 
 # 
 # split the data fields 
 # 
  chomp($line); 
  my $field; 
  ins = split /\|/, $line; 
  foreach $field (ins) { 
 $field = \.$field.\,; 
  } 
  chop($ins[-1]); # remove comma from last item in array 
  #the actual sequence 
  $sth-execute(ins) or $err++; 
 } 
 



RE: Problem populating execute using @array.

2002-09-19 Thread NYIMI Jose (BMB)

Hello Tim,

I'm very interested by DBI-trace method.
I gave a look in DBI.pm, I can't find the implementation.

Where it is ?
What is the meaning of this line: 

'trace' =  { U =[1,3,'[$trace_level, [$filename]]'],  O=0x04 },

Thanks in advance for your help.

José.

 -Original Message-
 From: Tim Bunce [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, September 19, 2002 10:59 AM
 To: Dolan, Mark
 Cc: Perl Users Help (E-mail)
 Subject: Re: Problem populating execute using @array.
 
 
 Use trace.
 Use trace.
 Use trace.
 
 Tim.
 
 On Wed, Sep 18, 2002 at 02:35:02PM -0400, Dolan, Mark wrote:
  I am trying to update a table in an Oracle database. I am 
 reading an 
  input file which has the column names for the database as the first 
  record in the file. The data begins in the second row. I read the 
  first record to pull off the column names. I create the sql using 
  placeholders. I then read the rest of the file. At the end 
 of the loop 
  I attempt to perform the 'execute' using the statement 
 handle of the 
  database. I get the following error.
  
  DBD::Oracle::st execute failed: ORA-01722: invalid number 
 (DBD ERROR:
  OCIStmtExecute) at ./ins line 61, $FH line 1.
  
  At the time of the execute @ins = 20, 2, Hello, Dolly, 
  000, 01, 022
  
  
  # assume sth is a valid statement handle
  # assume $FH is a handle to an opened file 
  my $columns = $FH; 
  # 
  # read first record of input file 
  # split the column headers 
  # 
my $columnitem; 
chomp($columns); 
@ins = split /\|/, $columns; 
foreach $columnitem (@ins) { 
 $columnitem = \.$columnitem.\; 
} 
  my $formatcolumns=join ( ', ', @ins ); 
  my $valstring= join ( ', ' , ('?') x scalar @ins ); 
  my $sql= INSERT INTO $table ( $formatcolumns ) VALUES ( 
 $valstring) ; 
  while ( my $line = $FH ) 
  { 
  # 
  # split the data fields 
  # 
   chomp($line); 
   my $field; 
   @ins = split /\|/, $line; 
   foreach $field (@ins) { 
  $field = \.$field.\,; 
   } 
   chop($ins[-1]); # remove comma from last item in array 
   #the actual sequence 
   $sth-execute(@ins) or $err++; 
  } 
  
 


 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.




Re: Problem populating execute using @array.

2002-09-19 Thread Hardy Merrill

NYIMI Jose (BMB) [[EMAIL PROTECTED]] wrote:
 Hello Tim,
 
 I'm very interested by DBI-trace method.
 I gave a look in DBI.pm, I can't find the implementation.

How about trying

   perldoc DBI

at a command prompt - then search(using the forward slash) for
trace.

-- 
Hardy Merrill
Senior Software Engineer
Red Hat, Inc.



RE: Problem populating execute using @array.

2002-09-19 Thread NYIMI Jose (BMB)



 -Original Message-
 From: Hardy Merrill [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, September 19, 2002 1:26 PM
 To: NYIMI Jose (BMB)
 Cc: Tim Bunce; Dolan, Mark; Perl Users Help (E-mail)
 Subject: Re: Problem populating execute using @array.
 
 
 NYIMI Jose (BMB) [[EMAIL PROTECTED]] wrote:
  Hello Tim,
  
  I'm very interested by DBI-trace method.
  I gave a look in DBI.pm, I can't find the implementation.
 
 How about trying
 
perldoc DBI
 
 at a command prompt - then search(using the forward slash) 
 for trace.

I know that :-)
I'm looking for the code itself ...

José.

 
 -- 
 Hardy Merrill
 Senior Software Engineer
 Red Hat, Inc.
 


 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.




Re: Problem populating execute using @array.

2002-09-19 Thread Michael A Chase

On Thu, 19 Sep 2002 13:34:36 +0200 NYIMI Jose (BMB) [EMAIL PROTECTED] wrote:

  -Original Message-
  From: Hardy Merrill [mailto:[EMAIL PROTECTED]] 
  Sent: Thursday, September 19, 2002 1:26 PM
  To: NYIMI Jose (BMB)
  Cc: Tim Bunce; Dolan, Mark; Perl Users Help (E-mail)
  Subject: Re: Problem populating execute using @array.
  
  
  NYIMI Jose (BMB) [[EMAIL PROTECTED]] wrote:
   Hello Tim,
   
   I'm very interested by DBI-trace method.
   I gave a look in DBI.pm, I can't find the implementation.
  
  How about trying
  
 perldoc DBI
  
  at a command prompt - then search(using the forward slash) 
  for trace.
 
 I know that :-)
 I'm looking for the code itself ...

It's in the source archive, DBI-1.30.tar.gz.  Extract all the files and
grep for 'trace'.  Note that trace() itself is relatively uninteresting,
all it does is set the trace level and trace file.
-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.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.




RE: Problem populating execute using @array.

2002-09-19 Thread NYIMI Jose (BMB)

 It's in the source archive, DBI-1.30.tar.gz.  Extract all the 
 files and grep for 'trace'.  Note that trace() itself is

That is what I did and I thought that I will find some where( not in 
lib/DBI/PurePerl.pm file)
a line beginning with:
sub trace{

None 

Is that part written in C ?

José.




 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.




Re: Problem populating execute using @array.

2002-09-19 Thread Michael A Chase

On Thu, 19 Sep 2002 16:05:33 +0200 NYIMI Jose (BMB) [EMAIL PROTECTED] wrote:

  It's in the source archive, DBI-1.30.tar.gz.  Extract all the 
  files and grep for 'trace'.  Note that trace() itself is
 
 That is what I did and I thought that I will find some where( not in
 lib/DBI/PurePerl.pm file)
 a line beginning with:
 sub trace{
 
 None 
 
 Is that part written in C ?

Yes.  There is more to DBI than the Perl sections.  There are also .xs and
..c files.  Keep looking for 'trace', not 'sub trace'.
-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.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.




RE: Problem populating execute using @array.

2002-09-19 Thread NYIMI Jose (BMB)

 Yes.  There is more to DBI than the Perl sections.  There are 
 also .xs and .c files.  Keep looking for 'trace', not 'sub trace'.

Mamamiya ! :-)

Thanks ...


 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.




Re: Problem populating execute using @array.

2002-09-18 Thread Hardy Merrill

What are the columns defined as(data types)?  Looks to me like
at least one of the columns is defined as an INTEGER, or another
form of a number, and you are trying to feed it a string value.

HTH.

-- 
Hardy Merrill
Senior Software Engineer
Red Hat, Inc.

Dolan, Mark [[EMAIL PROTECTED]] wrote:
 I am trying to update a table in an Oracle database. I am reading an
 input file which has 
 the column names for the database as the first record in the file. The
 data begins in the second row. I read the first record to pull off the
 column names. I create the sql using placeholders. I then read the rest
 of the file. At the end of the loop I attempt to perform the 'execute'
 using the statement handle of the database. I get the following error.
 
 DBD::Oracle::st execute failed: ORA-01722: invalid number (DBD ERROR:
 OCIStmtExecute) at ./ins line 61, $FH line 1. 
 
 At the time of the execute @ins = 20, 2, Hello, Dolly, 000,
 01, 022 
 
 
 # assume sth is a valid statement handle 
 # assume $FH is a handle to an opened file 
 my $columns = $FH; 
 # 
 # read first record of input file 
 # split the column headers 
 # 
   my $columnitem; 
   chomp($columns); 
   @ins = split /\|/, $columns; 
   foreach $columnitem (@ins) { 
$columnitem = \.$columnitem.\; 
   } 
 my $formatcolumns=join ( ', ', @ins ); 
 my $valstring= join ( ', ' , ('?') x scalar @ins ); 
 my $sql= INSERT INTO $table ( $formatcolumns ) VALUES ( $valstring) ; 
 while ( my $line = $FH ) 
 { 
 # 
 # split the data fields 
 # 
  chomp($line); 
  my $field; 
  @ins = split /\|/, $line; 
  foreach $field (@ins) { 
 $field = \.$field.\,; 
  } 
  chop($ins[-1]); # remove comma from last item in array 
  #the actual sequence 
  $sth-execute(@ins) or $err++; 
 } 
 



RE: Problem populating execute using @array.

2002-09-18 Thread Fox, Michael


1. the prepare is missing, so $sth is not defined

2. the quoting loop is probably not doing what you want (its quoting the
tempoary variable field, not the elements of @ins) - but with placeholders
you probably don't want the fields quoted anyway


-Original Message-
From: Dolan, Mark [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 4:35 AM
To: Perl Users Help (E-mail)
Subject: Problem populating execute using @array.


I am trying to update a table in an Oracle database. I am reading an
input file which has 
the column names for the database as the first record in the file. The
data begins in the second row. I read the first record to pull off the
column names. I create the sql using placeholders. I then read the rest
of the file. At the end of the loop I attempt to perform the 'execute'
using the statement handle of the database. I get the following error.

DBD::Oracle::st execute failed: ORA-01722: invalid number (DBD ERROR:
OCIStmtExecute) at ./ins line 61, $FH line 1. 

At the time of the execute @ins = 20, 2, Hello, Dolly, 000,
01, 022 


# assume sth is a valid statement handle 
# assume $FH is a handle to an opened file 
my $columns = $FH; 
# 
# read first record of input file 
# split the column headers 
# 
  my $columnitem; 
  chomp($columns); 
  @ins = split /\|/, $columns; 
  foreach $columnitem (@ins) { 
   $columnitem = \.$columnitem.\; 
  } 
my $formatcolumns=join ( ', ', @ins ); 
my $valstring= join ( ', ' , ('?') x scalar @ins ); 
my $sql= INSERT INTO $table ( $formatcolumns ) VALUES ( $valstring) ; 
while ( my $line = $FH ) 
{ 
# 
# split the data fields 
# 
 chomp($line); 
 my $field; 
 @ins = split /\|/, $line; 
 foreach $field (@ins) { 
$field = \.$field.\,; 
 } 
 chop($ins[-1]); # remove comma from last item in array 
 #the actual sequence 
 $sth-execute(@ins) or $err++; 
} 




Australia Post is committed to providing our customers with excellent service. If we 
can assist you in any way please either telephone 13 13 18 or visit our website 
www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.