Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2013
    Posts
    1

    Unanswered: Using cursors - the best way to compare 2 cursors

    Hi,

    here is my problem:
    I'm writing a procedure that is responsible for updating user priviledges basing on data passed to procedure.

    Code:
    PROCEDURE update_project_configuration
    (
    	project_id number,
      prj_conf SYS_GENERAL.sys_ref_cursor
    )
    IS
    
      cursor    old_conf is
      SELECT    *
      FROM      TASK_TYPE_PRJ_CONF c
      WHERE     c.project_id = project_id
      AND       c.start_date > sysdate;
    
    BEGIN
    
      --here i want to compare old data stored in cursor above and new data passed to procedure
      --its only pseudocode below, i know I cannot select from cursor :)
      
      [pseudocode]
       cursor oldminusnew is
       select *
       from   old_conf
       minus
       select *
       from   prj_conf;
    
       for each row set end date := sysdate;
    
       cursor newminusold is
       select *
       from   prj_conf
       minus
       select *
       from   old_conf;
    
       for each row insert new record to TASK_TYPE_PRJ_CONF;
    
       [/pseudocode]
    
      --implemented logic is simple but my problem is:
      How to compare these data and implement such a logic the easiest way?
    
    END;

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >I'm writing a procedure that is responsible for updating user priviledges basing on data passed to procedure.

    I am confused.
    The statement above says that you are UPDATING, but only DML is INSERT.

    INSERT INTO TASK_TYPE_PRJ_CONF
    (SELECT * FROM NEW_TBL
    MINUS
    SELECT * FROM OLD_TBL
    UNION
    SELECT * FROM OLD_TBL
    MINUS
    SELECT * FROM NEW_TBL)
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Tags for this Thread

Posting Permissions

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