zoukankan      html  css  js  c++  java
  • Llinux shell heredoc使用

    • 直接上例子
    /home/postgres/pgsql/bin/psql -Upostgres -d efc -c "DROP TABLE tbl_event_record_2019_11_03_03"
    
    SQL=`cat <<-EOF
    explain(verbose, analyse)
    insert into tbl_event_record(
    event_id,
    event_type,
    event_source,
    dev_code,
    active_name,
    event_security,
    event_time,
    alarm_status,
    check_time,
    check_user,
    ack_time,
    ack_user,
    ack_suggestion,
    key_value,
    event_desc,
    is_misinform,
    is_plan_alarm,
    is_once_plan_alarm,
    security_name,
    security_color,
    user_code_list,
    event_record_time)
    select n , n, 'event_source', 'dev_code','active_name',n,now(), n, 'check_time','check_user','ack_time',
    'ack_user','ack_suggestion','key_value','event_desc',n,n,n,'security_name','security_color','{hello,world}',now()
    from generate_series(1,10000) as t(n) ;
    EOF
    /home/postgres/pgsql/bin/psql -Upostgres -d efc -c "$SQL"
    
  • 相关阅读:
    JavaScript
    多线程
    MySQL进阶一(基础查询)
    英语语法随笔1
    MySQL
    Love Story
    两个数组的交集
    只出现一次的数字
    MybatisPlus
    数组中值加一
  • 原文地址:https://www.cnblogs.com/yldf/p/11899943.html
Copyright © 2011-2022 走看看