我正在尝试从JSON读取数据并将其存储在Oracle DB中。
我正在使用以下代码读取JSON数据,但收到“ ORA-01704:字符串文字太长”错误。
with json as (select to_clob('[
{
"Identifier": "999999999999999999999",
"Item_Document": "<item>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n<creationDateTime>2019-02-22T09:30:47Z</creationDateTime>\n <documentStatusCode>ORIGINAL</documentStatusCode>\n <documentActionCode>ADD</documentActionCode>\n <itemIdentification>\n <entityIdentification>HM0108775015187006</entityIdentification>\n </itemIdentification>\n<tradeItemIdentification>\n <gtin>00000000000000</gtin>\n </tradeItemIdentification>\n <description languageCode=\"en\" descriptionType=\"Short\">S-TOP BL XL</description>\n <description languageCode=\"en\" descriptionType=\"Long\">STRAP TOP BLACK XL</description>\n <countryOfOrigin>BD</countryOfOrigin>\n <tradeItemBaseUnitOfMeasure>EA</tradeItemBaseUnitOfMeasure>\n <itemHierarchyInformation>\n <hierarchyLevelIdentifier>SKU</hierarchyLevelIdentifier>\n <ancestry>\n <hierarchyLevelIdentifier>OPTION</hierarchyLevelIdentifier>\n <memberIdentifier>HM0108775015187</memberIdentifier>\n </ancestry>\n </itemHierarchyInformation>\n <tradeItemMeasurements>\n <size>\n <descriptiveSize languageCode=\"en\">XL</descriptiveSize>\n <sizeCode sizeCodeListCode=\"2\">6</sizeCode>\n</size>\n</tradeItemMeasurements>\n</item>",
"Number": "1"
}
]') as doc From Dual)
Select Item_Identification ,
Item_Document,
Doc_Seqno
From json_table( (Select Doc From Json) , '$[*]'
Columns ( Item_Identification Path '$.Identifier',
Item_Document Path '$.Item_Document',
Doc_Seqno Path '$.Number'
) )
错误消息是:
ORA-01704:字符串文字太长
01704. 00000-“字符串文字太长”
*原因:字符串文字长于4000个字符。
*措施:使用最多4000个字符的字符串文字。只能使用绑定变量输入更长的值。