DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: How to pass a date parameter to cursor while opening...

  1. #1
    Join Date
    Feb 2008
    Posts
    2

    Red face How to pass a date parameter to cursor while opening...

    DEAR GURUS,
    Help Required..


    The code looks like this:

    create procedure emp
    (id number)

    --JOIN_DATE & SAL_DATE are DATE fields in EMP table.
    AS
    CURSOR DateCursor
    (
    c_id NUMBER,
    c_date emp.join_date%type
    )
    IS
    SELECT DISTINCT emp.join_date
    FROM emp e,
    dept d,
    salary s
    WHERE e.id=d.id
    AND e.join_date>sysdate-1
    AND e.sal_date <> c_date
    AND e.mgrflag= 'Y'
    ORDER BY e.join_date DESC;

    OPEN DateCursor (c_id, c_date);

    LOOP
    dbms_output.put_line ('entering loop');
    FETCH DateCursor
    INTO l_date;
    dbms_output.put_line (l_date);

    EXIT WHEN NOT DateCursor%FOUND;
    END LOOP;
    CLOSE DateCursor;
    END;

    Help Needed...........

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Wouldn't be nice to tell us what is the problem?
    Does it compiles?
    Are you getting any runtime errors?

    You are not expecting us to figure it out your question, don't you?
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

  3. #3
    Join Date
    Feb 2008
    Posts
    2
    It compiles successfully but at runtime it doesn't accept c_date as parameter to the cursor...As a result it's not able to fetch the value in l_date...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width