Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, hm.

Asked: February 22, 2019 - 2:44 pm UTC

Last updated: February 25, 2019 - 1:26 pm UTC

Version: 18

Viewed 1000+ times

You Asked

Hi Tom,
please i need your help ASAP !!!

i have a grid of (agents) in oracle apex with the button DELETE , and i want to know the steps how to show deleted rows in another grid

and Chris said...

If clicking the APEX delete button runs a SQL delete statement, then the rows have GONE!

Meaning you can't view them in another screen.

There may be some tricks you can do storing the results in a temporary collection to review. But how you'd do that is beyond my knowledge of APEX.

Flashback query might also help, as this allows you to view the contents of a table as of a time in the past.

e.g. to see the table as it looked a minute ago:

select * from t 
  as of timestamp sysdate - interval '1' minute


Whether that will work depends on what you're trying to do.

Rating

  (3 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

hm hm, February 22, 2019 - 4:21 pm UTC

thanks for your answer,
what if instead of deleting the row from the table (t), moving it to another table (t_deleted)
is that possible ?

best regards
Chris Saxon
February 22, 2019 - 4:29 pm UTC

Yes, you could do something like:

insert into t_deleted
  select * from t where ...

delete t where ...


Or you could implement "soft deletes", where you have an is_deleted flag. To "delete" a row, you update this instead:

update t
set    is_deleted = 'Y'
where  ...


Then in normal screens you filter out rows where is_delete = 'N' (or is null if you allow that).

Audit could be another option, if soft delete canĀ“t be done....

J. Laurindo Chiappa, February 22, 2019 - 7:54 pm UTC

hm, if all you want is to show 'record with key value X was deleted on nnH:nnM;nnS', you could simply implement AUDIT, with this the DELETE SQL and the values passed to it would be in the AUD$ table....
If this not suffice and you REALLY NEED to show ALL the values for ALL the columns of ALL the deleted records, without SOFT DELETE your option would be a trigger on code like that, copying the values to a LOG table, see https://blogs.oracle.com/oraclemagazine/a-fresh-look-at-auditing-row-changes and https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:59412348055 ....

regards,

Chiappa

hm hm, February 25, 2019 - 9:50 am UTC

Hi Tom,

im really new with the oracle apex and i do not know exactly how to do the soft deletes flag .. can you please help me with steps
Chris Saxon
February 25, 2019 - 1:26 pm UTC

I'm not an APEX expert either!

Instead of running a delete, you need your submit process to run the update instead:

update t
set    is_deleted = 'Y'
where  ...


For more specifics on how to do this, you're better off asking on the APEX forum:

https://community.oracle.com/community/groundbreakers/database/developer-tools/application_express

More to Explore

APEX

Keep your APEX skills fresh by attending their regular Office Hours sessions.