Home » Non-English Forums » Dutch » Load spaces using SQL Loader (SQL Loader)
Load spaces using SQL Loader [message #486365] Wed, 15 December 2010 03:54 Go to next message
c van veelen
Messages: 1
Registered: December 2010
Junior Member
Als een veld volledig uit spaces bestaat wordt er null geladen in de database.
Het veld is in Oracle gedefinieerd als CHAR en de control file geeft de posities van het veld aan.
Hoe laad ik spaces in plaats van null?
Re: Load spaces using SQL Loader [message #486382 is a reply to message #486365] Wed, 15 December 2010 04:55 Go to previous messageGo to next message
Barbara Boehmer
Messages: 9077
Registered: November 2002
Location: California, USA
Senior Member
-- test.ctl:
load data
infile *
into table test_tab
fields
(col1 position(1:1),
col2 position(2:6) PRESERVE BLANKS,
col3 position(7:7))
begindata:
1     7
7     1


SCOTT@orcl_11gR2> create table test_tab
  2    (col1  number,
  3  	col2  char(5),
  4  	col3  number)
  5  /

Table created.

SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test.ctl log=test.log

SCOTT@orcl_11gR2> select col1, col2, col3, length (col2) from test_tab
  2  /

         1                7            5
         7                1            5

2 rows selected.

SCOTT@orcl_11gR2> select * from test_tab where col2 is null
  2  /

no rows selected

SCOTT@orcl_11gR2>

[Updated on: Wed, 15 December 2010 04:57]

Report message to a moderator

Re: Load spaces using SQL Loader [message #486388 is a reply to message #486382] Wed, 15 December 2010 05:26 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Verdorie, Barbara is me voor.

PRESERVE BLANKS zegt inderdaad dat er niet getrimt moet worden in de data.

MHE
Previous Topic: JSF en Oracle
Goto Forum:
  


Current Time: Thu Mar 28 14:05:59 CDT 2024