Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Postgresql DBLink Error
Message
De
02/09/2022 08:39:06
 
 
À
Tous
Information générale
Forum:
PostgreSQL
Catégorie:
Codage, syntaxe et commandes
Titre:
Postgresql DBLink Error
Divers
Thread ID:
01684928
Message ID:
01684928
Vues:
43
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
Fil
Voir

Click here to load this message in the networking platform