Hi i want to know if it is possible to use decode to do the following:
I have a pl/sql sp that takes a date (StartDate) as an in parameter. I always want the where clause to have the id < 1000 part, but i also want it so that if StartDate is not null the where clause will be
where employees.datecreated > startdate AND id < 1000
if start date is null then it would just be
where id < 1000
I've started with something like this...
SELECT id, name
FROM employees
WHERE DECODE (StartDate, Null, '',
employees.datecreated > TO_DATE(StartDate, 'dd-MM-yyyy') AND )
id < 1000;