Newbie could use some help on a simple(?) recursive query.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?iso-8859-15?Q?Paul_Gr=F8stad?=

    Newbie could use some help on a simple(?) recursive query.

    Hi.
    I'm very new to Oracle (and databases in general), and I have a problem
    that most of you people probably will find very easy, but I just can't
    figure it out...
    I'm trying to create a "recursive" query(?) in Oracle that finds all
    PublisherPerson s outranking my PublisherPerson in a direct line from his
    immediate supervisor and all the way up to the CEO.
    (Given that all persons except the CEO have a supervisor of sorts)

    CREATE TABLE PublisherPerson
    (
    ppersonID VARCHAR2(5) NOT NULL, <-----
    ppersonname VARCHAR2(30) NOT NULL, |
    publisherID VARCHAR2(5) NOT NULL, |
    deptID VARCHAR2(5), |
    supervisorID VARCHAR2(5), ---------------
    PRIMARY KEY (ppersonID),
    FOREIGN KEY (publisherID) REFERENCES Publisher,
    FOREIGN KEY (deptID) REFERENCES Dept
    );

    I really have no clue as to how I can achieve this, and I'd really
    appreciate any help you can give me!

    Paul
  • nobody

    #2
    Re: Newbie could use some help on a simple(?) recursive query.

    look up CONNECT by

    "Paul Grøstad" <paul.grostad@. student.uib.now rote in message
    news:oprx1h4gnq khaz1y@news.uib .no...
    Hi.
    I'm very new to Oracle (and databases in general), and I have a problem
    that most of you people probably will find very easy, but I just can't
    figure it out...
    I'm trying to create a "recursive" query(?) in Oracle that finds all
    PublisherPerson s outranking my PublisherPerson in a direct line from his
    immediate supervisor and all the way up to the CEO.
    (Given that all persons except the CEO have a supervisor of sorts)
    >
    CREATE TABLE PublisherPerson
    (
    ppersonID VARCHAR2(5) NOT NULL, <-----
    ppersonname VARCHAR2(30) NOT NULL, |
    publisherID VARCHAR2(5) NOT NULL, |
    deptID VARCHAR2(5), |
    supervisorID VARCHAR2(5), ---------------
    PRIMARY KEY (ppersonID),
    FOREIGN KEY (publisherID) REFERENCES Publisher,
    FOREIGN KEY (deptID) REFERENCES Dept
    );
    >
    I really have no clue as to how I can achieve this, and I'd really
    appreciate any help you can give me!
    >
    Paul

    Comment

    Working...