Information générale
Catégorie:
Codage, syntaxe et commandes
Titre:
Postgresql DBLink Error
Good norning,
I'm testing how to insert data into another postgresq database and I'm having the attached error.
Below is the code to create the postgresql function:
CREATE OR REPLACE FUNCTION efaturas(
character,
character,
character,
character)
RETURNS text AS
$BODY$
DECLARE
o_codigo_retorno character(5);
a_data_vencimento date;
lcComandoSQL text;
o_tipodoc character(2);
o_totaldocumento numeric(10,2);
BEGIN
-- Reuno as Variaveis
o_tipodoc := $4;'
o_totaldocumento := 15000;
lcComandoSQL := 'INSERT INTO teste(nomeentidade, valor) VALUES('||o_tipodoc||', '||o_totaldocumento||')';
-- Gravo os Dados no ficheiro de Documentos na Base dados eFatura
SELECT * FROM dblink('dbname = mydb port = 5432 host = myserver.com user = my_login password = 1234', lcComandoSQL) AS foreign_rec(id integer) INTO o_codigo_retorno;
END;$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION efaturas(character, character, character, character)
OWNER TO clima_user;
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement