Use SODA from SQLcl
SQLcl provides SODA support using commands and scripting integration.
Topics
Get Started with SODA Using SQLcl Commands
Perform some basic SODA operations using SQLcl, including creating a collection, inserting documents, finding a select set of documents, committing the document insertions and dropping the collection.
Note:
For a complete list of all commands and additional information about each command, you can execute thesoda help
command within SQLcl.
To perform basic SODA operations using SQLcl.
Get Started with SODA Using SQLcl Scripts
You can access SODA for Java classes using SQLcl running Javascript. The following simple script illustrates using SODA for Java classes with Javascript in SQLcl. The script creates a collection, inserts a document, and finds the inserted document using a QBE (query-by-example).
For further details about Java classes, see SODA for Java Javadoc and Oracle Database SODA for Java Online Documentation.
To run a simple Javascript that performs some basic SODA operations:Note:
If you run this script multiple times, the collection grows. Each time the script is executed, another JSON document is inserted. This is becausecreateCollection(...)
simply opens the collection if it already exists. To completely drop the collection created by the script, execute the soda drop foo
command from SQLcl.