samedi 12 septembre 2015

How to create a new View from an existing View

With Java and SQLite, can a View be created from another View where the values in the base View are not equal to a collection of values?

To be precise, the requirement (in pseudo-code) is:

CREATE VIEW B FROM VIEW A WHERE A._ID NOT IN <array of int>

This requirement has come up because VIEWs cannot be UPDATEd or DELETEd officially:

You cannot DELETE, INSERT, or UPDATE a view. Views are read-only in SQLite. However, in many cases you can use an INSTEAD OF trigger on the view to accomplish the same thing. Views are removed with the DROP VIEW command.

Almost certain that an INSTEAD OF trigger is not the solution, simply because altering the base table that created VIEW A is not what's needed. Please advice if there's a clever way to meet that requirement.

Guess no need code is needed as part of the question, but an answer with code will be gratefully appreciated.

Thanks a ton in advance!

Aucun commentaire:

Enregistrer un commentaire