1
votes

I am developping a web application in Oracle Application Express (Apex) technology.

I have a page where I can add a new record to a table called 'tz_tab'. That table has a column 'pos' which is one letter (single char) - 'Y' or 'N'. Now, i'd like to do something like this:

  • When post processing (== updating/inserting 'tz_tab') form on the page - check if 'pos' value is 'Y'
  • If so - update the rest of records in 'tz_tab' values to 'N'

I tried creating triggers on 'tz_table' but with no success.

Summing up, I need to have only one record with 'pos' value == 'T' in 'tz_tab'.

Is there any method to do this by APEX or should it be done with oracle triggers?

Thanks!

2

2 Answers

1
votes

It sounds like you can achieve this by creating a PL/SQL process in your APEX page that will fire after submit. You should be able to check page items and perform an UPDATE statement as required.

1
votes

You don't say how you're doing your processing in Apex, but you can create a page process that fires after your insert/update step with something like.

UPDATE tz_table SET pos = 'N' WHERE id != :ID_OF_THE_ITEM_JUST_UPDATED