Ajuda passa valores para variavel

PostgreSQL

18/09/2009

Olá amigos.

sou novo em postgrees

alguem sabe como faço para receber o valor de uma sql na variavel abaixo, está sql retorna apenas 1 valor tipo string.?

xcodlote = ´select codlote from lotecontabilidade where lote=$1´;

CREATE OR REPLACE FUNCTION gera_voucher(text,text)
RETURNS text AS
$BODY$ 
DECLARE

xcodlote TEXT=´´;

BEGIN

        xcodlote = ´select codlote from lotecontabilidade where lote=$1´;
        
       

        if xcodlote = ´1.1´ then 
         delete from temp_voucher;        
          
        end if;   
  

RETURN xcodlote;
END
 $BODY$
  LANGUAGE ´plpgsql´ VOLATILE STRICT;
ALTER FUNCTION gera_voucher(text) OWNER TO postgres;



Jjander.cunha

Jjander.cunha

Curtidas 0
POSTAR