Example PL/SQL Block
DECLARE
c_base_uri VARCHAR2(4000) := '<PAR URI>/<prefix>'; -- without trailing slash
c_table_list SYS.ODCIVARCHAR2LIST := SYS.ODCIVARCHAR2LIST('ITEM_LOC_SOH_EOD', 'ITEM_LOC_SOH', 'ITEM_LOC');
l_columns CLOB;
l_query CLOB;
BEGIN
FOR i IN 1 .. c_table_list.COUNT LOOP
DBMS_OUTPUT.PUT_LINE('outputing ' || c_table_list(i) || ' to uri: ' || c_base_uri || '/' || LOWER(c_table_list(i)));
-- To guarantee a specific ordering of columns, you can use the ORDER BY
-- clause within the JSON_ARRAYAGG function.
SELECT LISTAGG(column_name, ', ')
WITHIN GROUP (ORDER BY column_id)
into l_columns
FROM user_tab_columns
WHERE table_name = c_table_list(i);
-- build query
l_query := 'SELECT ' || l_columns || ' FROM ' || c_table_list(i);
DBMS_OUTPUT.PUT_LINE('columns: ' || l_columns);
DBMS_OUTPUT.PUT_LINE('query: ' || l_query);
DBMS_CLOUD.EXPORT_DATA(
credential_name => NULL, -- PAR requires no credential
file_uri_list => c_base_uri || '/' || LOWER(c_table_list(i)),
format => JSON_OBJECT('type' VALUE 'json'),
query => l_query
);
END LOOP;
END;This generates files in object store
like:
<PAR_URI>/orders_1_<timestamp1>.json
<PAR_URI>/orders_1_<timestamp1>.json
... and so on