Thats exactly my mistake, thanks to everyone
I have a sentence that look like this.
$mbd = DBI->connect("dbi:Pg:dbname=$database", "$username", "$password")
or die "Error opening database: $DBI::errstr \n";
$sth1 = $mbd->prepare
("
INSERT INTO public.table (month, day, server, daemon, duration,
sent, rcvd)
VALUES(
?::varchar(5), ?::varchar(3),
?::varchar(25), ?::varchar(15),
?::varchar(20), ?::varchar(20),
?::varchar(20))
");
The data type I changed in my database to float4 allowing having float points
numbers (1.24) but I still have the problem. Postgresql was expecting to
receive a varchar and my script returns a float
Instead of using varchar I changed it to float4, and It works =)
Thanks to everyone
On Thursday 09 September 2004 01:49 pm, Jeff 'japhy' Pinyan wrote:
> On Sep 9, Eduardo Vazquez Rodriguez said:
> >@duration = $string =~ /\sduration=(.*?)\s/;
> >
> >The first element in duration contains "1.23", in a string format
> >
> >When I try to insert $duration[0], into a field of integer type in a
> > database, I get the Following error:
> >
> >Error Column "duration" is of type integer but expression is of type
> > character varying
>
> You neglected to show us the code that actually inserts the data into the
> table. Perhaps you've accidentally quoted the data?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>