From: | Jean-Michel Caricand <jean-michel(dot)caricand(at)laposte(dot)net> |
---|---|
To: | pgsql-fr-generale(at)postgresql(dot)org |
Subject: | Problème avec une fonction |
Date: | 2014-09-01 18:57:49 |
Message-ID: | 5404C1AD.70909@laposte.net |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-fr-generale |
Bonjour,
Je sais que cette liste n'est peut-être pas la bonne car le problème est
certainement lié à Perl... mais j'essaie quand même ;-)
J'ai un petit souci avec une fonction en utilisant Perl. Voici les
informations pour PostgreSQL :
CREATE TABLE personne (
id bigserial NOT NULL PRIMARY KEY,
nom varchar(64) NOT NULL,
adresse_id bigint
);
CREATE TABLE personne_physique (
id bigint NOT NULL PRIMARY KEY REFERENCES personne(id),
civilite_id bigint,
date_naissance date,
lieu_naissance varchar(32)
);
CREATE OR REPLACE FUNCTION creer_personne_physique_avec_id(
p_id bigint,
p_civilite_id bigint,
p_nom varchar,
p_date_naissance date,
p_lieu_naissance varchar)
RETURNS type_personne_physique AS $$
DECLARE
v_result type_personne_physique;
BEGIN
INSERT INTO personne (id, nom) VALUES(p_id, p_nom);
INSERT INTO personne_physique (id, civilite_id, date_naissance,
lieu_naissance)
VALUES (p_id, p_civilite_id, p_date_naissance, p_lieu_naissance);
-- affecte les valeurs à la variable de retour.
v_result.id = p_id;
v_result.civilite_id = p_civilite_id;
v_result.nom = p_nom;
v_result.date_naissance = p_date_naissance;
v_result.lieu_naissance = p_lieu_naissance;
return v_result;
END
$$ language plpgsql;
Lorsque j'execute l'instruction suivante depuis pgadmin , tout fonctionne :
SELECT * FROM creer_personne_physique_avec_id(12, 1, 'Nom, '2010-10-2',
'Ville');
Par contre, depuis Perl, l'instruction suivante échoue avec le message :
$sth_crm = $dbh_crm->prepare("SELECT * FROM
creer_personne_physique_avec_id(12, 1, 'Nom', '2010-10-2', 'Ville')");
$sth_crm->execute;
DBD::Pg::st execute failed: ERROR: function
creer_personne_physique_avec_id(integer, integer, unknown, unknown,
unknown) does not exist
LINE 1: SELECT * FROM creer_personne_physique_avec_id(12, 1, 'Nom', ...
^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts. at migration.pl line 53.
DBD::Pg::st execute failed: ERROR: function
creer_personne_physique_avec_id(integer, integer, unknown, unknown,
unknown) does not exist
LINE 1: SELECT * FROM creer_personne_physique_avec_id(12, 1, 'Nom',
... ^
HINT: No function matches the given name and argument types. You might
need to add explicit type casts. at migration.pl line 53.
Vous avez une idée ?
Merci,
Jean-Michel
--
Envoi via la liste pgsql-fr-generale (pgsql-fr-generale(at)postgresql(dot)org)
From | Date | Subject | |
---|---|---|---|
Next Message | Virginie Jourdan | 2014-09-02 12:38:07 | Session PostgreSQL 9.4 / PostGIS 2.2 par Dalibo & Oslandia - 25 septembre - Inscrivez-vous ! |
Previous Message | Virginie Jourdan | 2014-08-27 10:13:19 | POWA ! Analysez votre trafic PostgreSQL en direct ! |