Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews DB Oracle Interviews:Concepts and ArchitectureData AccessDatabase ArchitectureDatabase ManagementDatabase Security OracleDistributed ProcessingFlexfieldForms ReportsGeneral OracleMemory ManagementMTO-SAP Financial AccountingOCIOracle AOLOracle AROracle Backup RecoveryOracle D2KOracle DatabaseOracle Database DeveloperOracle DB OptimizationOracle DBAOracle DeveloperOracle ETLOracle Forms 3.0Oracle Forms 4.0Oracle GLOracle PL-SQLOracle RMANOracle ScenariosOracle SecurityOracle SQLOracle System ArchitectureOracle Technology Network (OTN)Programmatic ConstructsRAC (Real Application Clusters)SQL Plus
Copyright © 2018. All Rights Reserved
Oracle Database Interview Question:
How To Define an External Table with a Text File?
Submitted by: AdministratorYou can use the CREATE TABLE statement to create external tables. But you need to use ORGANIZATION EXTERNAL clause to specify the external file location and the data access driver. The tutorial exercise below shows you how to define an external table as a text file:
>sqlplus /nolog
SQL> connect HR/globalguideline
SQL> CREATE TABLE ext_ggl_links (
id NUMBER(4),
url VARCHAR2(16),
notes VARCHAR2(16),
counts NUMBER(4),
created DATE
) ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY test_dir
LOCATION ('ext_ggl_links.txt')
);
Table created.
SQL> SELECT table_name, tablespace_name, num_rows
FROM USER_TABLES;
<pre>TABLE_NAME TABLESPACE_NAME NUM_ROWS
--------------------- ---------------------- ----------
REGIONS USERS 4
LOCATIONS USERS 23
DEPARTMENTS USERS 27
JOBS USERS 19
EMPLOYEES USERS 107
JOB_HISTORY USERS 10
ggl_LINKS USERS 2
EXT_ggl_LINKS
COUNTRIES 25</pre>
Submitted by: Administrator
>sqlplus /nolog
SQL> connect HR/globalguideline
SQL> CREATE TABLE ext_ggl_links (
id NUMBER(4),
url VARCHAR2(16),
notes VARCHAR2(16),
counts NUMBER(4),
created DATE
) ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY test_dir
LOCATION ('ext_ggl_links.txt')
);
Table created.
SQL> SELECT table_name, tablespace_name, num_rows
FROM USER_TABLES;
<pre>TABLE_NAME TABLESPACE_NAME NUM_ROWS
--------------------- ---------------------- ----------
REGIONS USERS 4
LOCATIONS USERS 23
DEPARTMENTS USERS 27
JOBS USERS 19
EMPLOYEES USERS 107
JOB_HISTORY USERS 10
ggl_LINKS USERS 2
EXT_ggl_LINKS
COUNTRIES 25</pre>
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.