Inserting Data Into Tables
Learn how to insert data into Oracle NoSQL Database Cloud Service tables from the NoSQL console.
- Simple Input Mode: You can use this mode to provide the values for the new rows declaratively.
- Advanced JSON Input Mode: You can use this mode to provide the values for the new rows in JSON format.
You can also bulk upload the data from a local file into the table, via the browser.
Inserting Data Into Tables: Simple Input Mode
Learn how to insert data into Oracle NoSQL Database Cloud Service tables by using the Simple Input insertion mode.
Inserting Data Into Tables: Advanced JSON Input Mode
Learn how to insert data into Oracle NoSQL Database Cloud Service tables by using the Advanced JSON input mode.
Bulk Upload of table rows
The Upload Data button in the Table details page allows bulk uploading of data from a local file into the table, via the browser.
The Bulk upload feature is intended for loading less than a few thousand rows. This feature is great for performing a proof of concept ( POC) or doing basic testing of the service. It is a convenient way to populate a small table. If you want to write tens of thousands of rows, then for performance reasons you would be better off using the Oracle NoSQL Database Migrator or writing your own program using one of the NoSQL SDKs. If, however, you want to quickly insert a few hundred or a few thousand rows, this upload method is an expeditious approach.
The file to be uploaded must contain a series of JSON objects. The objects can be expressed as comma-separated items of a single array or as a sequence of simple objects bounded by curly braces, with no syntactic delimiters between them. The contents of each object must be correctly formatted JSON and must conform to the schema of the table to which they will be uploaded.
CREATE TABLE Simple ( id integer, val string, PRIMARY KEY ( id ) )
[
{
"id": 0,
"val": "0"
},
{
"id": 1,
"val": "2"
}, ...
]
{
"id": 0,
"val": "0"
}
{
"id": 1,
"val": "2"
}, ...
- If a column value is not required by the table's schema, then the corresponding JSON property may be left out.
- If a column value is GENERATED ALWAYS, then the corresponding JSON property must be left out.
- If a JSON object contains properties with names that do not match any column names, those properties are ignored.
To use the upload feature, click the Upload Data button and select the file to be uploaded. The upload begins immediately, and progress will be shown on the page. Upon successful completion, the total number of rows inserted will be shown. You can interrupt the upload by clicking the Stop Uploading button. The number of rows that were successfully committed to the database will be shown.
If an error in the input file is detected, then uploading will stop and an error message with an approximate line number will be shown. Input errors might be caused by incorrect JSON syntax or schema nonconformance. Errors can also occur during requests for the service. Such errors also stop the uploading and display a message.
- If there are no columns with generated key values (that is, if the keys are entirely dictated by the JSON file), then you can simply start over with the same file. The already-written rows will be written again.
- If there are generated key values, then starting over would write new records instead of overwriting existing records. The easiest path would be to drop the table and create it again.
- Alternatively, you could remove all records from the table by executing the
statement
DELETE FROM tablename
in the Explore data form.
If the provisioned write limit is exceeded during the upload process, a transient message indicating so will be displayed, and the uploading will be slowed down to avoid exceeding the limit again.
Inserting Data Into Tables
Copyright © 2022, Oracle and/or its affiliates.
For information about Oracle's commitment to accessibility, visit the Oracle Accessibility Program website at http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.
Access to Oracle Support
Oracle customers that have purchased support have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.