Search code examples
postgresqlprocedure

procedure type date IN param postgresql


I want to know how I can enter a parameter within a function type date since at the time of doing so, the following error

report_soat(date, date)

Undefined function: 7 ERROR: operator does not exist: date >= character varying LINE 6: BETWEEN fecha_in AND fecha_out ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. QUERY: SELECT soats.status AS "estado", soats.placa AS "placa" FROM soats where soats.task_id IS NOT NULL and date(soats.created) BETWEEN fecha_in AND fecha_out CONTEXT: PL/pgSQL function report_soat(character varying,character varying) line 2 at RETURN QUERY

SELECT 
    soats.status AS "estado",
    soats.placa AS "placa"
FROM soats 
where soats.task_id IS NOT NULL and date(soats.created)  
BETWEEN start_date AND end_date;

IN start_date date, IN end_date date, OUT status varchar, OUT placa varchar


Solution

  • Try...

    report_soat('2017-11-14'::date, '2017-11-14'::date)