Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Parsing a Pseudo Code logic

575598Jul 10 2007 — edited Jul 11 2007
So this is a long shot...

We have an administrative tool that allows users to enter logic in a sort of pseudo code syntax. This logic is applied to question and answer pairs from a survey. A simple piece of logic would say, "If a person says they like green in question 1, and likes fruit in question 2, show them a picture of a watermelon." There are hundreds of these types of rules, stored as text strings in a table called Logic.

The entry for the above might read "s(q1,a2) AND s(q2,a3)". Some statements are very long and complex.

...NOT (S(Q200000005,A4) OR S(Q200000005,A12) OR S(Q200000005,A15) OR (Q200000005,A32))AND NOT (S(Q103410001,A5) OR S(Q103420002,A5) OR S(Q103470002,A5) OR S(Q103480003,A5) OR S(Q103490003,A5) OR S(Q103490007,A5)) AND....


A piece of C# code uses the table and has its own parsing procedure. But I would like to use this logic table to apply these same rules to the Q/A pairs within a SQL query.

Has anyone seen anything like this? Could I do some kind of find and replace thing to convert to SQL then run it? Like I said, long shot. Thanks for reading.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 8 2007
Added on Jul 10 2007
13 comments
1,547 views