Home » SQL & PL/SQL » SQL & PL/SQL » decision tree in sql
decision tree in sql [message #33471] Wed, 13 October 2004 12:32 Go to next message
Robert
Messages: 43
Registered: August 2000
Member
Hello,

Is it possible to make a decision tree in SQL*Plus? 
Re: decision tree in Oracle DB [message #447961 is a reply to message #33471] Thu, 18 March 2010 13:42 Go to previous messageGo to next message
marlon_loyolite
Messages: 66
Registered: July 2006
Member
Hi Friends,

Can anyone please explain me to have a decision tree (Quesion & answer type) in Oracle database with some sample data?

And based on answers select by the user, we determine some decision.

Regards,
carlos
Re: decision tree in Oracle DB [message #447963 is a reply to message #447961] Thu, 18 March 2010 13:45 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Can anyone please explain me to have a decision tree (Quesion & answer type) in Oracle database with some sample data?


visualize a nested IF THEN ELSE structure with multiple ESLEIF
Re: decision tree in sql [message #447964 is a reply to message #33471] Thu, 18 March 2010 13:50 Go to previous messageGo to next message
marlon_loyolite
Messages: 66
Registered: July 2006
Member
Hi Thanks.

Am very much new to this decision tree concept.

So can you please elaborate me about how to implement it in Oracle with an example.

Regards Carlos.
Re: decision tree in sql [message #447965 is a reply to message #447964] Thu, 18 March 2010 13:56 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
incapable or unwilling to use GOOGLE or wikipedia?

http://en.wikipedia.org/wiki/Decision_tree
Re: decision tree in sql [message #447966 is a reply to message #447964] Thu, 18 March 2010 13:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
SQL> select lpad(' ',2*level-1)||ename
  2  from emp
  3  connect by prior empno = mgr
  4  start with ename='KING'
  5  /
LPAD('',2*LEVEL-1)||ENAME
----------------------------------------
 KING
   JONES
     SCOTT
       ADAMS
     FORD
       SMITH
   BLAKE
     ALLEN
     WARD
     MARTIN
     TURNER
     JAMES
   CLARK
     MILLER

14 rows selected.

Regards
Michel
Re: decision tree in sql [message #447969 is a reply to message #33471] Thu, 18 March 2010 14:09 Go to previous messageGo to next message
marlon_loyolite
Messages: 66
Registered: July 2006
Member
Thanks Michel,

If it is like Question and Answer type, how would it be like in the database?

Regards,
carlos
Re: decision tree in sql [message #447978 is a reply to message #447969] Thu, 18 March 2010 19:09 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Are you trying to get an interactive SQLplus script that can branch depending on user response?

http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1934751139108
Re: decision tree in sql [message #447990 is a reply to message #447978] Thu, 18 March 2010 23:42 Go to previous messageGo to next message
marlon_loyolite
Messages: 66
Registered: July 2006
Member
No..

Hi. I've been tasked with finding how to convert a decision tree to Oracle tables. It's used for a user help center: If caller answers Question A with Answer 1, then ask Question C, else ask Question B, etc. And they'd like to record the user's responses along the way. The subject-matter experts are developing the questions/typical answers and we in IT have to now build a web-based system to guide people through this decision tree.

How do you create such a thing in a relational database? Your guidance is much appreciated.

Thanks.
Re: decision tree in sql [message #447993 is a reply to message #447990] Thu, 18 March 2010 23:52 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>How do you create such a thing in a relational database?
With a small matter of programming & any RDBMS would suffice.

Please realize we are not being paid to do application development for you or your organization.

>It's used for a user help center
Tell us about the existing help center application.
In which language is it written & which RDBMS name & version does it current interface with?
Is it a 2 or 3 tier application?

This task should be assigned to someone who knows more than how Oracle is spelled, in my opinion.

Re: decision tree in sql [message #448014 is a reply to message #447990] Fri, 19 March 2010 02:01 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Like a parent-child relationship as in the emp table.
If it is a tree (not a network) then it is possible to do it like that.
Of course it depends on your specific case and requires a couple hours to think about it, so it is not something we can design in a forum.

Regards
Michel
Previous Topic: pdf from pl/sql
Next Topic: Preventing duplicate column value using Trigger
Goto Forum:
  


Current Time: Thu Feb 13 11:02:37 CST 2025