내가 아는 한 매개 변수를 ctrl의 변수로 전달할 방법이 없습니다.
하지만 ctl에서 상수를 사용하고 clt 파일을 수정하여 모든 로딩 시간에 대한 상수 값 (ctl 파일 내용으로)을 변경할 수 있습니다.
편집 : 자세한 내용.
my_loader.ctl :
--options
load data
infile 'c:\$datfilename$' --this is optional, you can specify here or from command line
into table mytable
fields....
(
datafilename constant '$datfilename$', -- will be replace by real datafname each load
datacol1 char(1),
....
)
dataload.bat : 그 $의 datfilename을 $으로 가정하면 텍스트 데이터 파일의 이름으로 대체 될 것이다.
::sample copy
copy my_loader.ctl my_loader_temp.ctl
::replace the name of datafile (mainly the content to load into table's data column)
findandreplace my_loader_temp.ctl "$datafilename$" "%1"
::load
sqlldr user/[email protected] data=%1 control=my_loader_temp.ctl
::or with data be obmitted if you specified by infile in control file.
sqlldr user/[email protected] control=my_loader_temp.ctl
사용 : 당신의 대답에 대한 dataload.bat mydatafile_2010_10_10.txt
감사합니다. 사실, 내 데이터 파일의 이름이 사용에서 다른 것으로 바뀌 었다고 가정합니다 (생성 된 날짜 또는 그 날짜가 포함될 것임). 따라서 변수를 사용하면 트릭을 수행 할 수 있습니다. 정말로 내가 무엇을 찾고 있는지. – Hal
죄송하지만 어쩌면 내 영어가 충분하지 않지만 내 제안에 따라로드 할 때마다 'my_loader_yymmdd.ctl'을 1 열로 동적으로로드 할 수 있습니까? – pinichi
죄송 합니다만 충분히 명확하지 않을 수 있습니다. 이것은 변경되는 데이터 파일의 이름이며 CTL의 이름은 아닙니다. 위의 명령 줄을 사용하여 CTL을 실행합니다. 여기서 데이터 파일의 이름과 CTL의 이름을 지정합니다. 명령 줄과 CTL에서 두 번 지정하고 싶지 않기 때문에 CTL 내부의 데이터 파일 이름을 검색하고 싶습니다. 지금까지 나의 연구가 있었지만 아직이 문제에 대한 해결책을 찾지 못했습니다. – Hal