14.3 DISCOVER Function
This is a function to discover the column profile of a file. This function calls parse()
and then returns the generated file profile. This function is a shortcut which can be used instead of first calling parse()
and then get_file_profile()
.
Syntax
FUNCTION DISCOVER(
p_content IN BLOB,
p_file_name IN VARCHAR2,
p_decimal_char IN VARCHAR2 DEFAULT NULL,
p_xlsx_sheet_name IN VARCHAR2 DEFAULT NULL,
p_row_selector IN VARCHAR2 DEFAULT NULL,
p_csv_row_delimiter IN VARCHAR2 DEFAULT LF,
p_csv_col_delimiter IN VARCHAR2 DEFAULT NULL,
p_csv_enclosed IN VARCHAR2 DEFAULT '"',
p_file_charset IN VARCHAR2 DEFAULT 'AL32UTF8',
p_max_rows IN NUMBER DEFAULT 200 ) RETURN CLOB;
Parameter
Table 14-1 DISCOVER Function Parameters
Parameter | Description |
---|---|
|
The file content to be parsed as a BLOB |
|
The name of the file used to derive the file type. |
|
Use this decimal character when trying to detect |
|
For XLSX workbooks. The name of the worksheet to parse. If omitted, the function uses the first worksheet found. |
|
Whether to detect data types ( |
|
Use this decimal character when trying to detect |
|
For XLSX workbooks. The name of the worksheet to parse. If omitted, the function uses the first worksheet found. |
|
For JSON and XML files. Pointer to the array / list of rows within the JSON or XML file. If omitted, the function will:
|
|
Override the default row delimiter for CSV parsing. |
|
Override the default row delimiter for CSV parsing. |
|
Use a specific CSV column delimiter. If omitted, the function detects the column delimiter based on the first row contents. |
|
Override the default enclosure character for CSV parsing. |
|
File encoding, if not |
|
Stop discovery after |
Returns
Returns a CLOB containing the file profile in JSON format.
Example
select apex_data_parser.discover(
p_content => {BLOB containing XLSX file},
p_file_name=>'large.xlsx' ) as profile_json
from dual;
PROFILE_JSON
-----------------------------------------------------------
{
"file-encoding" : "AL32UTF8",
"single-row" : false,
"file-type" : 1,
"parsed-rows" : 2189,
"columns" : [
{
"name" : "C0",
"format-mask" : "",
"selector" : "",
"data-type" : 2
},
{
"selector" : "",
"format-mask" : "",
"data-type" : 1,
"name" : "FIRST_NAME"
},
{
"name" : "LAST_NAME",
"format-mask" : "",
"selector" : "",
"data-type" : 1
},
:
{
"name" : "DATE_",
"format-mask" : "DD\"/\"MM\"/\"YYYY",
"data-type" : 3,
"selector" : ""
},
{
"format-mask" : "",
"selector" : "",
"data-type" : 2,
"name" : "ID"
}
],
"row-selector" : "",
"headings-in-first-row" : true,
"xslx-worksheet" : "sheet1.xml",
"csv-delimiter" : ""
}
Parent topic: APEX_DATA_PARSER