Calling a PostgreSQL function via DBI
- From: christian.stalp@xxxxxx (Christian Stalp)
- Date: Wed, 22 Feb 2006 14:26:16 +0100 (MET)
Hello out there,
I just try to call a PostgreSQL-function via the DBI.
The function is very simple:
CREATE OR REPLACE FUNCTION neues_suchprofil ( NUMERIC, TEXT ) RETURNS void
AS $$
BEGIN
INSERT INTO suchprofile ( kid, spname ) VALUES ( $1, $2 );
END
$$ LANGUAGE plpgsql;
It is as you can see made in plpgsql. If I call this in psql it works:
SELECT neues_suchprofil ( 1::numeric , 'test'::text );
neues_suchprofil
------------------
(1 Zeile)
test2=#
So when I call this via DBI, I made it this way:
.....
$result = $dbh->prepare ( "SELECT neues_suchprofil ( $cookieValue::numeric,
'$suchprofil_name::text' ) " ) or die "Vorbereitung nicht durchfuehrbar!\n";
$result->execute() or die "Abfrage nicht ausfuehrbar -suchprofil!
$DBI::errstr\n";
$result->finish();
......
I got this error:
[Wed Feb 22 14:25:54 2006] suchprofil_uebernehmen.cgi: Abfrage nicht
ausfuehrbar -suchprofil! FEHLER: Fehler»Syntaxfehler« bei »,« at character
27
which means: suchprofil_uebernehmen.cgi: query not executable. Error
syntaxerror at >,< at char 27.
How do I have to cover this function to make a succesfull request?
Gruss Christian
--
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie
.
- Follow-Ups:
- Re: Calling a PostgreSQL function via DBI
- From: Greg Sabino Mullane
- Re: Calling a PostgreSQL function via DBI
- Prev by Date: Re: DBD::Sybase and IQ anomaly.
- Next by Date: Re: Calling a PostgreSQL function via DBI
- Previous by thread: query DBI:Pg code utf-8
- Next by thread: Re: Calling a PostgreSQL function via DBI
- Index(es):