Search notes:

Oracle: SQL Loader - Example 11

create table tq84_trailing_nullcols (
   col_1  varchar2(10),
   col_2  varchar2(10),
   col_3  varchar2(10)
);
Github repository Oracle-Patterns, path: /SQLLoader/ex_11/create_table.sql
options (skip=1,silent=(all))
load data
infile 'some.dat'
into table tq84_trailing_nullcols
truncate
fields terminated by '|'
(
  col_1,
  col_2,
  col_3
)
Github repository Oracle-Patterns, path: /SQLLoader/ex_11/without_trailing_nullcols.ctl
options (skip=1, silent=(all))
load data
infile 'some.dat'
into table tq84_trailing_nullcols
truncate
fields terminated by '|'
trailing nullcols
(
  col_1,
  col_2,
  col_3
)
Github repository Oracle-Patterns, path: /SQLLoader/ex_11/with_trailing_nullcols.ctl
col_1|col_2|col_3
one|two|three
foo||
Github repository Oracle-Patterns, path: /SQLLoader/ex_11/some.dat
@create_table.sql

host sqlldr userid=rene/rene  control=without_trailing_nullcols.ctl

prompt Only one record loaded:
select * from tq84_trailing_nullcols;

host sqlldr userid=rene/rene  control=with_trailing_nullcols.ctl
prompt All (two) records loaded:
select * from tq84_trailing_nullcols;

drop table tq84_trailing_nullcols purge;
Github repository Oracle-Patterns, path: /SQLLoader/ex_11/all.sql

See also

Other SQL Loader examples
SQL*Loader

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758207106, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/tools/sql-loader/example-11(99): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78