Oops, good morning!
I have the following query in postgres:
declare $1 VARCHAR;
BEGIN
IF
(SELECT COUNT(*) FROM tempo2
WHERE looping IS NULL) > 0
THEN
$1 = (SELECT banco FROM tempo2 WHERE looping IS NULL LIMIT 1);
INSERT INTO...
SELECT * FROM dblink ('host=xx.xx.xx.xx dbname='||$1||'
user=xxxxpassword=xxxxx',
'SELECT ...
My problem is that the database is not reading the variable '|| $ 1 ||', I believe that when it is read in SELECT the contents of it already come with '(single quotation marks), example: SELECT * FROM dblink (' host = xx.xx.xx.xx dbname = '' variable '' ...
Can anyone help me?
Abs, Lucas.