Hi All,
The situation is that I am trying to find all customers whose Date Of Birth (DOB) is greater or equal to 150 days ago. Unfortunately, when I run this SQL I get these error message:
1) ORA-00904: "FEB": invalid identifier
1) ORA-06512: at line 4
I am unsure what I need to do to resolve this, I hope you can help.
Note - I have to wrap this statement in an execute immediate due to Roles/Privilidge issues. In the full version I also use AUTHID CURRENT_USER.
DECLARE
curr_date Date := SYSDATE;
BEGIN
EXECUTE IMMEDIATE ' SELECT cust_name,
cust_dob, -- date of birth
cust_shoe_size
FROM tblCustDetails c
WHERE SUBSTR(c.cust_name, 1,7) = ''Bob''
AND cust_dob >= NEXT_DAY(' || curr_date ||' - 150 , ''SATURDAY'')
';
END;
Edited by: DaveyB on Feb 23, 2012 8:39 AM