cursor and substitution vars

cursor and substitution vars

 

  

Gurus,

Can you use substitution variables inside a cursor like this:

DECLARE
v_todaysdate date := SYSDATE;

CURSOR c_FACEMP is
SELECT A.SOCIAL_SECURITY_NUM AS SSN, LOWER(A.NET_ID) AS NETID, A.LAST_NM AS
LASTN, A.FIRST_NM AS FIRSTN

FROM YUDW.[Email Address Removed] O
WHERE (A.ORGANIZATION_ID = O.ORGANIZATION_ID) AND (A.CALENDAR_DT =
'&v_todaysdate' AND O.DIVISION_CD = 'D01781' AND CURRENT_EMPLOYEE_FLG='Y'
AND (JOB_NM = 'Manager and Professional' or JOB_NM = 'Clerical and
Technical')) ORDER by LASTN, FIRSTN;

Begin
blah...blah...blah
end;

If I hardcode the text the desired results are displayed, but I want to
setup a job which runs nightly and I can't hardcode the date. That would
defeat the automation. :-)

When I put in the substitution, I get errors and the cursor fails.

How can I get this to work?

Thnx.




Oracle LazyDBA home page