Search code examples
sqloraclesql-server-2008oracle11goracle-sqldeveloper

How to concatenate two field in single column in oracle SQLLDR control file?


My raw text file like below (having two fields (ACC and INT))

ACC INT


1160 1291

1160 1291

1160 1291

1160 1291

My table -> create table product(product_CODE number);

Control file -> load data

infile 'E:\SQLLDR\product.txt' "str '\r\n'"

append into table product

fields

trailing nullcols (

product_code position (1:9)

)

Requirement : Need product code without space like below

select * from product;

PRODUCT_CODE

11601291

11601291

11601291

11601291

how to achieve this?


Solution

  • I think you need to use the REPLACE function here considering it as a string as follows:

    product_code position (1:9) "REPLACE(:PRODUCT_CODE,' ','')"
    

    I have not tested it but you can leave a comment if you find any issue with this solution