テーブル
The 本製品 exposes tables for every entity set and singleton defined on the OData service document. Entities on these tables may be inserted, updated, or deleted using standard SQL insert, update, or delete statements.
Executing Deep Inserts with SQL
The 本製品 supports OData deep inserts, in which you simultaneously create a base entity and link it to related entities, by specifying navigation properties. To specify ナビゲーションプロパティ for an entity, you create a temporary table for the navigation property and then reference the temporary table in the insert to the base table. Reference the temporary table in the appropriate navigation property column on the base table. Each navigation property column is prefixed with the word "Linked".
Note that you must define the temporary tables and insert to the base table within the same connection.
Example: Deep Inserts
For example, consider the AccountCollection and LeadBusinessDocumentReferenceCollection tables. When creating a new Account, you may also want to specify an Account Address. When creating a LeadBusinessDocumentReference, you need to specify an existing document. For each of these, you need to specify the following navigation properties.
Creating Temporary Tables
Insert the related entities into temporary tables that correspond to each navigation property. You can specify an existing entity's primary key or you can insert a new entity.
- Account Address: The following statement creates two new Account Addresses:
INSERT INTO AccountAddressCollection#TEMP (CountryCode, City, Street) VALUES ('USA', 'New York', '123 Fake Street') INSERT INTO AccountAddressCollection#TEMP (CountryCode, City, Street) VALUES ('USA', 'San Franscisco', '456 CA Street')
- Opportunity: The following statement specifies an existing Opportunity:
INSERT INTO OpportunityCollection#TEMP (ObjectID) VALUES ('123')
The 本製品 will assume that the Opportunity already exists and will only link to the existing references since only the primary key was specified. When more than just the primary key is defined, such as the example for Account Address, the CData ODBC Driver for SAP Cloud for Customer will attempt to create new entries - triggering the deep insert.
Inserting the Entity
In the INSERT statement for the base entity, reference the temporary tables in the LinkedOpportunity or LinkedAccountAddress columns:
INSERT INTO AccountCollection (AccountID, AccountName, LinkedAccountAddress) VALUES ('123', 'My New Account', 'AccountAddressCollection#TEMP')
INSERT INTO LeadBusinessDocumentReferenceCollection (ParentObjectID, LinkedOpportunity) VALUES ('5555', 'OpportunityCollection#TEMP')