0
votes

Very new to Oracle Apex programming so please be gentle. I am trying to develop language testing application in Oracle APEX.

I have two tables

Table1: Data table which contains the columns ID, English and Korean.

Table2: Is mostly generated from user input and one random column from Table 1:

1. Date (Generated from a date picker on the user input page)
2. Question (This is populated from a random value taken for the Korean column in Table1).
3. Answer (This is populated from user input).
4. Score ( This is what I want to populate)

When the user inputs the English value in table2 if it matches table1 given the Korean I want to add 1 to the score variable of the row in table2.

Once this works I want to implement a 10 question test therefore score needs to increment for each right answer.

Any help would be greatly appreciated.

1

1 Answers

1
votes

I'm not sure what your question really is, but I don't see a need to persist the score attribute in the first place as it can easily be calculated from the other columns anytime you need it.

Assuming Table2.Question holds the ID from Table1

select decode( t2.answer, t1.korean, 1, 0) score
from Table1 t1, Table2 t2
Where t2.question=t1.id;

The DECODE() acts like an IF-THEN-ELSE statement (if answer=korean then 1 else 0), more info see here