我在一个CLOB变量中有一个JSON数据。我们称之为“p_clob”。
{
"CustomerTransactionId": 300000164734650,
"DueDate": "2023-07-31",
"ConversionDate": null,
"ConversionRate": null,
"receivablesInvoiceLines": [
{
"LineNumber": 1,
"Description": "TEST DESCRIPTION1",
"Quantity": 10,
"UnitSellingPrice": 1100,
"TaxClassificationCode": null,
"SalesOrder": null
},
{
"LineNumber": 2,
"Description": "TEST DESCRIPTION2",
"Quantity": 10,
"UnitSellingPrice": 1100,
"TaxClassificationCode": null,
"SalesOrder": null
},
{
"LineNumber": 3,
"Description": "TEST DESCRIPTION3",
"Quantity": 10,
"UnitSellingPrice": 1100,
"TaxClassificationCode": null,
"SalesOrder": null
},
{
"LineNumber": 4,
"Description": "TEST DESCRIPTION4",
"Quantity": 10,
"UnitSellingPrice": 1100,
"TaxClassificationCode": null,
"SalesOrder": null
}
]
}
数组“receivablesqualiceLines”有4行。
我需要插入一个表中使用下面的选择共4行。
INSERT INTO dump_Data
SELECT
*
FROM
JSON_TABLE ( p_clob
COLUMNS
customertransactionid VARCHAR2 ( 300 ) PATH '$.CustomerTransactionId',
duedate VARCHAR2 ( 50 ) PATH '$.DueDate',
conversiondate VARCHAR2 ( 20 ) PATH '$.ConversionDate',
conversionrate NUMBER PATH '$.InvoiceCurrencyCode',
specialinstructions NUMBER PATH '$.SpecialInstructions',
crossreference VARCHAR2 ( 50 ) PATH '$.CrossReference',
documentnumber VARCHAR2 ( 20 ) PATH '$.DocumentNumber',
transactionnumber NUMBER PATH '$.TransactionNumber',
transactiondate DATE PATH '$.TransactionDate',
);
COMMIT;
我如何在上面的表格中选择和插入4行来构造receivablepixiecLines部分?
1条答案
按热度按时间h7wcgrx31#
你可以使用嵌套,例如