I have to build a following child json payload to supplment the main payload. My question is how can I put these arrays into a clob to pass through as a PSLQL parameter.
Code:
Declare
l_children json_array_t;
p_clob CLOB
cursor getrec is select * from sometable;
begin
for i in getrec loop
select TO_CHAR(SYSTIMESTAMP,'mmddyyyyhhmiss') into l_doc_id from dual;
l_children.append(json_object_t('
{
"AttachedDocumentId": "'||l_doc_id||'",
"DatatypeCode": "TEXT",
"CategoryName": "INSTANCE_NUMBER",
"UploadedText": "'||i.instance_number||'",
"UploadedFileContentType": "text",
"ContentRepositoryFileShared": "false",
"Title": "'||i.instance_number||'",
"Description": "'||i.instance_number||'"
}'));
select TO_CHAR(SYSTIMESTAMP,'mmddyyyyhhmiss') into l_doc_id from dual;
l_children.append(json_object_t('
{
"AttachedDocumentId": "'||l_doc_id||'",
"DatatypeCode": "TEXT",
"CategoryName": "SERIAL_NUMBER",
"UploadedText": "'||i.attachment_serial_number||'",
"UploadedFileContentType": "text",
"ContentRepositoryFileShared": "false",
"Title": "'||i.attachment_serial_number||'",
"Description": "'||i.attachment_serial_number||'"
}'));
end loop;
p_Clob := l_children.to_clob; /* this won't work */
Thank you Darsh