Advertisement

02.05.2008 at 03:41AM PST, ID: 23137693
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.2

PL/SQL Problem (hierarchical trees)

Asked by joselfm in PL / SQL, Oracle Database, Oracle 9.x

Tags: ,

Hi friends,
(DB: 9.2.0.7) It's not an university or school problem. It's for the real job/work... This is only an example but with the same problematic of real problem.
I have to create a select , that receives a parameter (padre) which would be put into the where clause.. and that has to show all its "descendants" ...
It is for this structure... and I'm thinking about how to do it.. but I don't kow how!
Please help me with your code if you are able to do it.
It seems to be simple.. but it's not so.
------------------------------------------------------------------------
Imagine you have:
CREATE TABLE FAMILY
(PADRE VARCHAR2(10),
CHILD_LOW VARCHAR2(10),
CHILD_HIGH VARCHAR2(10)
);

INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('01','01','01');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('01','AA','AN');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('01','K0','K50');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('AA','100','199');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('K2','500','600');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('500','VV','VV');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('02','02','02');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('02','B0','B9');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('02','1000','2000');
INSERT INTO FAMILY (PADRE ,CHILD_LOW,CHILD_HIGH) VALUES ('1500','MA','MZ');

------------------------------------------------------------------------
This will show this structure, a "parent" with a range of values (low and high) for his sons and descendants

--------------------
PADRE CHILD_LOW CHILD_HIGH
01 01 01
01 AA AN
01 K0 K50
AA 100 199
K2 500 600
500 VV VV
02 02 02
02 B0 B9
02 1000 2000
1500 MA MZ
------------------------------
Te idea is give a "parent" value to the select and... the magic query  will return the collection of descendants ranges.
I.e. for '01' it would return:
AA AN
K0 K50
100 199
500 600
VV VV

for 'K2' it would return:
500 600
VV VV

I have the initial query:

select child_low ||'-' ||child_high DESCENDANTS
from (select padre,child_low,child_high from family where
padre<>child_low)
start with padre = '01'
connect by prior child_low <=padre and prior child_high >= padre;

The from clause where it appears padre<>child_low is to avoid the loops (i.e. when a parent and the child would be '01' in this example)

PROBLEM:
In this query it apears as descendant an interval that it isn't that, MA-MZ. this is because ranges are varchars,and, in this case, when we compare '1500'<'199' .. the problem appears.

Solution is not to change varchar to number in database..  We need to find the way to compare varchars... that's the difficulty

So.. your help would be very apreciated...
Thanks,
Jose L
Start Free Trial
 
 
[+][-]02.05.2008 at 04:03AM PST, ID: 20822197

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 04:05AM PST, ID: 20822204

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 04:16AM PST, ID: 20822270

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 04:19AM PST, ID: 20822290

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 04:25AM PST, ID: 20822314

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 04:28AM PST, ID: 20822330

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 04:30AM PST, ID: 20822341

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 04:40AM PST, ID: 20822391

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 05:15AM PST, ID: 20822565

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 05:34AM PST, ID: 20822666

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 06:05AM PST, ID: 20822881

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 06:13AM PST, ID: 20822939

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 08:19AM PST, ID: 20824189

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 09:09AM PST, ID: 20824723

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 11:07AM PST, ID: 20825784

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 01:49PM PST, ID: 20827420

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 08:52PM PST, ID: 20829602

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.05.2008 at 11:18PM PST, ID: 20830155

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 12:07AM PST, ID: 20830291

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 12:16AM PST, ID: 20830328

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 12:22AM PST, ID: 20830344

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 12:36AM PST, ID: 20830411

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 02:44AM PST, ID: 20830893

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 02:48AM PST, ID: 20830917

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 04:32AM PST, ID: 20831377

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 04:37AM PST, ID: 20831403

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 09:48AM PST, ID: 20834049

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 09:59AM PST, ID: 20834155

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 12:08PM PST, ID: 20835229

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 12:30PM PST, ID: 20835432

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.06.2008 at 11:02PM PST, ID: 20838795

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 02:15AM PST, ID: 20839578

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 02:21AM PST, ID: 20839611

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 02:48AM PST, ID: 20839722

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 06:06AM PST, ID: 20840769

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 08:21AM PST, ID: 20842097

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 08:46AM PST, ID: 20842381

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2008 at 09:08AM PST, ID: 20842616

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.08.2008 at 12:27AM PST, ID: 20848628

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.08.2008 at 04:01AM PST, ID: 20849375

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.08.2008 at 05:27AM PST, ID: 20849841

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PL / SQL, Oracle Database, Oracle 9.x
Tags: PL/SQL, SQL*PLus
Sign Up Now!
Solution Provided By: joselfm
Participating Experts: 5
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628