Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Problem

Re: SQL Problem

From: D R Patterson <patterd1_at_home.com>
Date: Mon, 01 Oct 2001 15:41:10 GMT
Message-ID: <3BB88D9B.695C10CB@home.com>


Niall, how about the following:

set serveroutput on Format TRUNC;

DECLARE
  v_empno career_history.empno%TYPE;   CURSOR C_multi1 IS
    SELECT empno, count( storeid) storecount     FROM career_history
    HAVING count(storeid) > 1
    GROUP BY empno;
  CURSOR C_multi2 IS

    SELECT      storeid,
                start_period,
                end_period
    FROM        career_history
    WHERE       empno = v_empno

    ORDER BY start_period;
  v_prior_end career_history.end_period%TYPE;   v_prior_store career_history.storeid%TYPE; BEGIN
  DBMS_Output.Put_Line( 'Start of list of problem employees.');

It has two cursors -- the first will select only the employees with multiple rows of experience. The second will look at the career history rows for each identified employee and flag the ones with overlapping work history.

I think it would be fairly efficient if the right indices are present.

Dave Patterson
patterd1_at_home.com Received on Mon Oct 01 2001 - 10:41:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US