helpermethod
helpermethod

Reputation: 62294

Is it possible to create a view where deleted rows in the original table are kept

I have a table COMPANY where companies are kept. I want to create a view of that table, let's name it COMPANY_CDC but with one caveat:

When an entry in the original table is deleted, I want to set a deleted flag on the view entry instead of deleting it.

EDIT Why soft deletes? The point is that im performing change data capture using JDBC, and JDBC is only able to capture soft deletes. Inserts / updates are no problem.

If this cannot be done by using a view, what would be an alternative solution?

Upvotes: 0

Views: 36

Answers (1)

Shobhit Walia
Shobhit Walia

Reputation: 496

You can insert deleted values in another table using trigger , and with join of these two table you can create your view.

Upvotes: 1

Related Questions