Because this is Oracle-specific, you would need to write your changeset as SQL rather than as a Liquibase create table change. A Liquibase create table changeset might look like this:
<changeSet author="steve" id="1470867976783-1" >
<createTable tableName="TRACE_TAB">
<column name="SEQNO" type="NUMBER(*, 0)">
<constraints nullable="false"/>
</column>
<column name="TEXT" type="VARCHAR2(4000 CHAR)"/>
</createTable>
</changeSet>
But an External table/directory would need to look like this:
<changeSet author="steve" id="externalTableDirectory" >
<sql>
CREATE OR REPLACE DIRECTORY ext_tab_data AS '/data';
</sql>
</changeSet>
<changeSet author="steve" id="1470867976783-1" >
<createTable tableName="TRACE_TAB">
<column name="SEQNO" type="NUMBER(*, 0)">
<constraints nullable="false"/>
</column>
<column name="TEXT" type="VARCHAR2(4000 CHAR)"/>
</createTable>
</changeSet>
But an External table/directory would need to look like this:
<changeSet author="steve" id="externalTableDirectory" >
<sql>
CREATE OR REPLACE DIRECTORY ext_tab_data AS '/data';
</sql>
</changeSet>
<changeSet author="steve" id="externalTable" >
<sql>
CREATE TABLE countries_ext (
country_code VARCHAR2(5),
country_name VARCHAR2(50),
country_language VARCHAR2(50)
)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ext_tab_data
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
(
country_code CHAR(5),
country_name CHAR(50),
country_language CHAR(50)
)
)
LOCATION ('Countries1.txt','Countries2.txt')
)
PARALLEL 5
REJECT LIMIT UNLIMITED;
</sql>
</changeSet>
The main limitation when using inline SQL like this is that it is difficult to support deployment to different environments, because Liquibase can't really parse/replace things in the SQL.
<sql>
CREATE TABLE countries_ext (
country_code VARCHAR2(5),
country_name VARCHAR2(50),
country_language VARCHAR2(50)
)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ext_tab_data
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
(
country_code CHAR(5),
country_name CHAR(50),
country_language CHAR(50)
)
)
LOCATION ('Countries1.txt','Countries2.txt')
)
PARALLEL 5
REJECT LIMIT UNLIMITED;
</sql>
</changeSet>
The main limitation when using inline SQL like this is that it is difficult to support deployment to different environments, because Liquibase can't really parse/replace things in the SQL.