Home > database >  SQL loader how to import data inserted the upload folder as a list, is need to TXT file in folder
SQL loader how to import data inserted the upload folder as a list, is need to TXT file in folder

Time:10-03

SQL loader how to import data inserted the upload folder as a list of file, folder is need to TXT file, how to use the shell?
Saw on the Internet before have inserted the filename as a column, how specific implementation is not clear, now inserted the folder name as a list of don't know how to do?

CodePudding user response:

 
- the field name CONSTANT 'J: \ Data \ 1. TXT' default path to write directly in the control file
The load data infile 'J: \ 1. TXT append into table TB fields terminated by', 'trailing nullcols (a, b, c CONSTANT' HJM ')

CodePudding user response:

 

//the field name CONSTANT 'J: \ Data \ 1. TXT' default path to write directly in the control file
The load data infile 'J: \ 1. TXT'
Append into table TB
Fields terminated by ', '
The trailing nullcols (a, b, c CONSTANT 'HJM')

CodePudding user response:

refer to the second floor cnceohjm response:
 

//the field name CONSTANT 'J: \ Data \ 1. TXT' default path to write directly in the control file
The load data infile 'J: \ 1. TXT'
Append into table TB
Fields terminated by ', '
The trailing nullcols (a, b, c CONSTANT 'HJM')

this is the new field - write die folder name, if the folder name is changing, which means that I want to take this folder name automatically through the shell, then put him as a list of values to insert table

CodePudding user response:

reference qq_28716109 reply: 3/f
this is the new field - write die folder name, if the folder name is changing, which means that I want to take this folder name automatically through the shell, and then put him as a list of values to insert table

SQLLDR import is certainly one of the import of a file, you get a data file, change a bai, and not complicated! I think he data files should not be too much

CodePudding user response:

reference 4 floor cnceohjm response:
Quote: reference qq_28716109 reply: 3/f

This is the new field - write die folder name, if the folder name is changing, which means that I want to pick up the folder name automatically through the shell, and then put him to a list of values to insert list

SQLLDR import is certainly one of the import of a file, you get a data file, change a bai, and not complicated! I think he data files should not be too much

SQLLDR userid=$db_user/$db_pswd @ $db_tnsn control=$ctl_path/${column}. The CTL data=https://bbs.csdn.net/topics/$data_path/${column}. TXT bad=$bad_path/${column}. Bad log=$log_path/${column}. The log bindsize rows=50000=2048000 direct=true
This is sqlload script, each folder below has hundreds of tables, sqlload import need to put these tables are imported into, if you write die bad to implement this function, and the specific folder name is changing along with the date

CodePudding user response:

 load data 
Characterset UTF8
Truncate into table O_HX_KYZB_XJKHDZ
REENABLE DISABLED_CONSTRAINTS
Fields terminated by '~ @ ~
The trailing nullcols
(FARENDMA,
LAOKEHUH,
XINKEHUH,
KEHUZWMC,
KEHUYWMC
)

This is one of the CTL file, each about three hundred this file folder, now the TXT file exists directory:/home/weblogic/ods_data under/data/hx, hx the subdirectory name is change at any time, now want to add the directory name change at any time to the last column of the table, the specific use shell how to operate?
Friend gave a train of thought on the second floor, if the
 trailing nullcols (a, b, c CONSTANT 'HJM') 
in the 'HJM replaced with a value can be executed command, don't know is that ok?

CodePudding user response:

refer to 6th floor qq_28716109 response:
in the 'HJM replaced with a value can be executed command, don't know is that ok?
to command values should be able to, but I didn't try

CodePudding user response:

refer to 7th floor cnceohjm response:
Quote: refer to the sixth floor qq_28716109 response:

Of 'HJM replaced with a value can be executed command, don't know is that ok?
to command values should be able to, but I didn't try

I tried,
 test CONSTANT ` ls/home/weblogic/ods_data/data ` 

This paragraph, used here is an error, don't know what kind of way to add commands to the CTL file processing

CodePudding user response:

Not very understand, you are to read files in the folder, or incoming parameters in executing sh script?

CodePudding user response:

refer to 6th floor qq_28716109 response:
 load data 
Characterset UTF8
Truncate into table O_HX_KYZB_XJKHDZ
REENABLE DISABLED_CONSTRAINTS
Fields terminated by '~ @ ~
The trailing nullcols
(FARENDMA,
LAOKEHUH,
XINKEHUH,
KEHUZWMC,
KEHUYWMC
)

This is one of the CTL file, each about three hundred this file folder, now the TXT file exists directory:/home/weblogic/ods_data under/data/hx, hx the subdirectory name is change at any time, now want to add the directory name change at any time to the last column of the table, the specific use shell how to operate?
Friend gave a train of thought on the second floor, if the
 trailing nullcols (a, b, c CONSTANT 'HJM') 
in the 'HJM replaced with a value can be executed command, don't know is that ok?


# variable assignment
Aa=/home/weblogic/ods_data/data/ls/home/weblogic/ods_data/data/

Calls to the variable ${aa}

CodePudding user response:

references to the tenth floor js14982 response:
Quote: refer to the sixth floor qq_28716109 response:

 load data 
Characterset UTF8
Truncate into table O_HX_KYZB_XJKHDZ
REENABLE DISABLED_CONSTRAINTS
Fields terminated by '~ @ ~
The trailing nullcols
(FARENDMA,
LAOKEHUH,
XINKEHUH,
KEHUZWMC,
KEHUYWMC
)

This is one of the CTL file, each about three hundred this file folder, now the TXT file exists directory:/home/weblogic/ods_data under/data/hx, hx the subdirectory name is change at any time, now want to add the directory name change at any time to the last column of the table, the specific use shell how to operate?
Friend gave a train of thought on the second floor, if the
 trailing nullcols (a, b, c CONSTANT 'HJM') 
in the 'HJM replaced with a value can be executed command, don't know is that ok?


# variable assignment
Aa=/home/weblogic/ods_data/data/ls/home/weblogic/ods_data/data/

Calls to the variable ${aa}
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related