Avatar of sakthikumar
sakthikumar

asked on 

Need help on decision table structure

I want to create a table by which we should be able to implement complex business rules.

simple eg:

(test1 = pass or (test2 = fail and test3 = pass))
or (test4 = fail or test5 = pass)

test1,test2,test ... test5 are columns in a table.
pass and fail are values.

what should be the table structure to implement these rules?
Oracle DatabaseSQL

Avatar of undefined
Last Comment
johnsone
Avatar of Sean Stuber
Sean Stuber

not enough information yet.

Does every rule consist of the same 5 tests?  if so, all 5 should be distinct columns in a single table.
You might want to consider this structure even if some rules might be missing a couple and simply null them.
(rule_id, test1, test2,test3,test4,test5)


Could each rule have a varying number of tests, possibly even more than 5, and the which types of tests can vary as well?
If so test types should be a separate table and each rule should have one or more rows that join to the test table.

(test_id,  test_description)
(rule_id, test_id, test_result)
Avatar of sakthikumar
sakthikumar

ASKER

I have a table with columns test1 to test5 and more columns.
rule could be based on any one of these columns.

Also in the rule table, there should be a column to store operator(">","<" ...)

I am just confused like how to handle nested conditions
If there are Parent conditions / child conditions like multiple "OR" and "AND". In this case,  what should be the procedure
for this rule
Avatar of Sean Stuber
Sean Stuber

I'm not sure I understand.

I think you might just want a large text column (like varchar2(4000))  to hold the text of your rule
Then you could simply evalute it with substitution
Avatar of sakthikumar
sakthikumar

ASKER

I'm sorry I didn't explain you clearly. I am creating a front end application in apex for creating rules.
I will be having an option to select the column name (from table. this could be test1 or test2 or any column)
                                          then to choose operator (> < = etc.,)
                                          then to choose value ('pass','fail' ...)
what should be the table design to build rule like below.

(test1 = pass or (test2 = fail and test3 = pass))
or (test4 = fail or test5 = pass)
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of sakthikumar
sakthikumar

ASKER

This I can do, but users may not be able to write condition.

if there is something like dropdown available for rule creation, it will be easy for them.

and If I know in which table structure I can store this rule, I can design a front end for them.
SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo