0

In MSSQL, I usually use below parameter like this:

declare @StartDate as date, @EndDate as date
set @StartDate  = '08/01/2015' set @EndDate = '08/15/2015'

----------- and use it here as my Date Range of Records:

Select * from Table_Name 
where DateRange between @StartDate and @EndDate 

How can I do this in PostgreSQL for generating reports/records?

0

1 Answer 1

0

Do like this After $BODY$

DECLARE startdate date;
DECLARE enddate date;

After begin

startdate ='2015-08-01';
Enddate ='2015-08-15';

retrun query 

select * from Table where daterange between startdate and endate
Sign up to request clarification or add additional context in comments.

2 Comments

result: ERROR: syntax error at or near "date" LINE 3: DECLARE startdate date; ^ ********** Error **********
@fLen its throwing error because you are executing this syntax directly.....use this syntax in your function then it will work fine.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.