0
with the function below I want to make this function compare the current date with the date stored in the bank.HOWEVER ,THERE IS NO RETURN .
create table mercado(
id integer,
diaEntrega date,
valor integer
);
insert into mercado values (2,'7-02-18',12);
CREATE OR REPLACE FUNCTION get_d () RETURNS date AS
$$
DECLARE
dataAtual date;
varValor integer;
dataFinalizada date;
BEGIN
SELECT CURRENT_DATE INTO dataAtual;
/*SELECT diaEntrega FROM mercado WHERE '7-02-18' = diaEntrega INTO dataFinalizada;*/ /*OBS:DESTA FORMA FUNCIONA*/
SELECT diaEntrega FROM mercado WHERE dataAtual = diaEntrega INTO dataFinalizada;
return dataFinalizada;
END;
$$ LANGUAGE 'plpgsql';
What error is presented to you?
– Ismael
ACTUALLY IT IS NOT A MISTAKE. THE RETURN OF THE FUNCTION IS NOT RETURNING ANYTHING WHEN IN FACT IT WAS TO RETURN . THE PROBLEM IS THE COMPARISON THAT I MAKE FROM DATE = DAY THAT IS NOT BEING MADE . I DO NOT KNOW HOW TO FIX.
– thiago xavier
and its market table, has data for the current day?
– Pablo Tondolo de Vargas
no !!!! i also want to compare the current date that I get with this SELECT function CURRENT_DATE with this value returned from the database '7-02-18' however, the comparison is not being made.
– thiago xavier