在批处理脚本中需要帮助:使用 1 或 2 个数组或解析具有元组名称编号的文件
我想运行使用一些参数(更准确地说是名称和关联号码)自定义的 sqlldr 命令。现在我只对名称进行迭代,但我想将每个名称与一个数字相关联。
@echo off
set ORACLE_PWD=orcl
set NLS_NUMERIC_CHARACTERS=.,
setlocal
echo "Run number " %1
For %%X in (region nation supplier customer part partsupp orders lineitem) do (
sqlldr userid='sys/%ORACLE_PWD% as sysdba' log=%%X%1.log control=%%X.ctl direct=true rows=<associated_number> multithreading=true
)
我有 2 个选择:使用另一个数字数组(这可能是最难的事情)或解析文本文件,例如:
region 25 (or region DELIMITER 25)
nation 100
supplier 5000
等等
,然后将这些值获取到 vars 并在 sqlldr 命令中使用它们来自定义我的日志名称和行数。
我知道批处理脚本中的数组是一场噩梦,我正在尝试,但我无法做到正确。有人可以帮我吗?
I want to run a sqlldr command customized with some parameters, more precisely a name and a associated number. For now I only have an iteration through names but I want to associate each of it with a number.
@echo off
set ORACLE_PWD=orcl
set NLS_NUMERIC_CHARACTERS=.,
setlocal
echo "Run number " %1
For %%X in (region nation supplier customer part partsupp orders lineitem) do (
sqlldr userid='sys/%ORACLE_PWD% as sysdba' log=%%X%1.log control=%%X.ctl direct=true rows=<associated_number> multithreading=true
)
I have 2 options: do it with another array of numbers (which may the hardest thing) or parse a text file like:
region 25 (or region DELIMITER 25)
nation 100
supplier 5000
and so on
and then get those values to vars and use them in the sqlldr command to customize my log name and the number of rows.
I understand that arrays in batch script are a nightmare and I'm trying but I can't get it right. Could someone please help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果将此:保存
在名为
params.txt
的文件中,则此脚本将读取该文件并相应地替换值:If you save this:
in a file named, for example,
params.txt
, then this script will read the file and substitute the values accordingly: