fushiyi

今日目标

  • [x] 编写shell,插入日志表
  • [x] 编写ctl文件,读取多行多列的txt文件
  • [ ] 将kettle job转化成纯shell模式
  • [ ] 将kettle job转化成纯java模式

日常笔记

  1. <<代表下个此为分节符,例如

    <<EOF 
    执行语句
    EOF
    
  2. 一起的命令不能换行,例如

    sqlplus fb/fb@orcl <<EOF
    执行语句
    EOF	
    
  3. oralce中/时begin end;语句与下一句SQL语句的分隔,例如

begin 
test();
end;
/
select 1 from dual;   

--call test();不用/来分隔

call test();
select 1 from dual;
  1. shell 异常捕获,&&和||的使用,$?和1>&2的使用,https://blog.csdn.net/womeng2009/article/details/80814284
  2. shell中>,>>的使用,https://blog.csdn.net/nahanai/article/details/83861449
  3. shell变量
# 变量赋值 ##等号两边不能有空格
a=1
a=\'1\'
a="1"
b="213${a}"
# 执行变量 ##某些系统不适用的命令,不能执行
cmd01="sqlldr userid=fb/fb@orcl control=\'C:\Users\Administrator\Desktop\jiefangdai_callout\sqlldr\control.ctl\' log=\'C:\Users\Administrator\Desktop\jiefangdai_callout\sqlldr\test.log\'"
eval cmd01



  1. $()与${}的使用:https://blog.csdn.net/SeaSky_Steven/article/details/103281133
  2. 将执行结果存入变量:https://blog.csdn.net/baidu_35757025/article/details/64440047?locationNum=8&fps=1
  3. 将执行错误存入变量:https://blog.csdn.net/u011575671/article/details/78592162/
  4. sqlplus -s: 用于输出变量时不会报错
  5. shell 的判断
if的基本语法:
if [ command ];then
   符合该条件执行的语句
elif [ command ];then
   符合该条件执行的语句
else
   符合该条件执行的语句
fi

12.“” 和‘’的区别,‘’是纯字符,“”可以引用变量

  1. 一直sqlplus 插入error变量不能成功,是因为error中有中文,sqlplus不能识别
  2. 判断字符相等
result="load succee"


if [ "$result" == "load succeed" ]; then  #加入""
echo 1
else
echo 2
fi

分类:

技术点:

相关文章:

  • 2021-09-05
  • 2021-09-15
  • 2021-09-02
  • 2022-03-04
  • 2021-09-16
  • 2021-05-22
  • 2022-02-03
  • 2021-09-19
猜你喜欢
  • 2022-01-12
  • 2022-01-13
  • 2021-12-26
  • 2021-05-27
  • 2022-02-20
  • 2021-07-22
  • 2021-09-09
相关资源
相似解决方案