Oracle Magazine, July/August 2019
Database Developer PL SQL FINDING DOCUMENTS THAT MATCH FILTERS Ive shown you how to get all the documents in a collection and a single document by key but you have much more flexibility than that You can also use JSON queryby example syntax to filter your document retrieval You do this by adding the filter method to the chained invocation right after find as in dbms_ soda open_ collection FriendsWithDocs find filter l_ filter get_ cursor In the block below I set the filter to find only those friends of type 2 whatever that might be DECLARE l_ document soda_ document_ t l_ cursor soda_ cursor_ t l_ filter VARCHAR2 128 friend_ type 2 l_ status BOOLEAN BEGIN l_ cursor dbms_ soda open_ collection FriendsWithDocs find filter l_ filter get_ cursor ORACLE MAGAZINE JULY AUGUST 2019 101 WHILE l_ cursor has_ next LOOP l_ document l_ cursor NEXT IF l_ document IS NOT NULL
You must have JavaScript enabled to view digital editions.