Don't put SYSDATE in the execute. Put it in the prepared statement:
my $sth = $dbh->prepare( "INSERT INTO stats VALUES (SYSDATE,?,?,?,?)" )
or die "Cannot prepare SQL statements from $DBI::errstr\n";
foreach (@stats){
chomp;
($host, $user $cpu_pct, $mem_pct = split( /,/ );
$sth->execute( $host, $user $cpu_pct, $mem_pct );
}
--
On Fri, 2002-06-14 at 14:27, Kipp, James wrote:
> i am using it for a timestamp record insertion :-)
> the date/time is one of the fields in the table where i will be inserting
> the records.
> the table stats has the fields: sdate(date), host, user %cpu, %mem
> i will give this a try:
>
> my $sth = $dbh->prepare( "INSERT INTO stats VALUES (?,?,?,?,?)" )
> or die "Cannot prepare SQL statements from $DBI::errstr\n";
>
> foreach (@stats){
> chomp;
> ($host, $user $cpu_pct, $mem_pct = split( /,/ );
> $sth->execute( SYSDATE, $host, $user $cpu_pct, $mem_pct );
> }
> --
>
> Thank You
> Jim
>
> > -----Original Message-----
> > From: Ian Harisay [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, June 14, 2002 1:48 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: best way to insert date/time into oracle table
> >
> >
> > Are you using this for just a timestamp for record insertion?
> > If so, SYSDATE is your best bet. You can use SYSDATE like so:
> >
> > prepare("insert into table1 (field1, field2, timestamp)
> > values(?, ?, SYSDATE)");
> >
> > execute("Harry", "Potter");
> >
> > Your execute statement can then be looped through with
> > different values.
> >
> > Ian
> >
> >
> >
>