EXTERNAL
EXTERNAL is a keyword in SQL that specifies a table as an external table. This means that the table data is stored outside the SQL server, typically in a flat file or data file. The SQL server does not control the data or the file format; it just interacts with it for data retrieval or data modification operations. It allows SQL to access data in a database-independent way.
Example
Output
Explanation
The example SQL query uses the CREATE EXTERNAL DATA SOURCE
statement to create a data source named MyAzureBlobStorage
that connect to an Azure Blob Storage. The TYPE
is set to BLOB_STORAGE
, LOCATION
to the URL of the Blob Storage account, and CREDENTIAL
to a pre-existing credential. The output indicates the command executed successfully.
Example
Output
No output is produced as CREATE TABLE...ORGANIZATION EXTERNAL
doesn’t produce any output. But it let oracle know to treat the data in the specified file as table ‘employees_ext’.
Explanation
The above SQL creates an external table named ‘employees_ext’. It links to the file ‘employees.txt’ in the directory ‘def_dir’. The ORGANIZATION EXTERNAL
clause indicates that it’s an external table. The ACCESS PARAMETERS
clause indicates how oracle should interpret the data in the file. The REJECT LIMIT UNLIMITED
allows all rows that have format errors to be skipped.