Query Data that Uses Pre-Authenticated Request (PAR) URL Source
You can create an external table over an Autonomous Database Pre-Authenticated Request (PAR) URL.
-
When you need to use a REST client to create an external table and then utilize the SQL API to perform analytics on the datasets. This may include running SQL queries to analyze the data or aggregating results based on your requirements.
-
When you need to query data from databases across regions.
There are two ways to create an external table in an Autonomous Database using a Pre-Authenticated Request (PAR) URL:
-
Use a single Autonomous Database Pre-Authenticated Request (PAR) URL to create an external table. After the table is created, you can read data from the table using the
SELECT
statement. You can also apply filters and clauses when retrieving data from the table. For example, you can filter the data with theWHERE
clause or sort it using theORDER BY
clause.Example to create an external table over a single PAR URL:DBMS_CLOUD.CREATE_EXTERNAL_TABLE
( table_name => 'ext_tab_parurl', file_uri_list => 'https://dataaccess.adb.us-chicago-1.oraclecloudapps.com/adb/p/K6XExample/data' ); END; /After the table is created, you can query the table using theSELECT
statement, and you can also filter or sort the output. Example to read data from theext_tab_parurl
table in descending order:SELECT * FROM ext_tab_parurl ORDER BY height DESC; COUNTY SPECIES HEIGHT ------ ---------- ------- First Chestnut 51 Main Alder 45 Main Douglas-fir 34 Main Pine 29 Main Cedar 21
-
Use a comma-delimited list of Autonomous Database Pre-Authenticated Request (PAR) URLs, you must ensure that all included PAR URLs must have the same column names, column order, and column data types in the same schema.
Example to create an external table over a list of PAR URLs:DBMS_CLOUD.CREATE_EXTERNAL_TABLE
( table_name => 'ext_tab_parurl_1', file_uri_list => 'https://dataaccess.adb.us-chicago-1.oraclecloudapps.com/adb/p/K6XExample/data', 'https://dataaccess.adb.us-chicago-1.oraclecloudapps.com/adb/p/K7XExample/data' ); END; /Query the table using theSELECT
statement:SELECT * FROM ext_tab_parurl_1; COUNTY SPECIES HEIGHT ------ ---------- ------- First Chestnut 51 Main Alder 45 Main Douglas-fir 34 Main Pine 29 Main Cedar 21 Main Aspen 35 First Maple 16
The parameters are:
-
table_name
: is the external table name. -
file_uri_list
: is either a single Pre-Authenticated Request (PAR) URL or a comma-delimited list of Pre-Authenticated Request (PAR) URLs.
Parent topic: Query External Data with Autonomous Database