linux的计划任务操作
1.cron服务来设置
计划任务查看与设置命令:crontab
包括条目:
分钟m:0-59
小时h:0-23
月日dom:1-31
月份mon:1-12
星期dow:0-7
例子:
每隔2小时处理一个文件用:*/2
1,3,5,7,9 点间隔执行
0-4,8-12点执行
或者是*/2每隔2个小时备份文件或执行数据库操作
下面是工作中用到的sell脚本:
* * * /home/oracle/psql-jobs.sh
*/ * * * * /usr/bin/curl http://127.0.0.1:60030/admin/serpro/qianzhangcron >/dev/null 2>&1
0 5 * * * /home/oracle/xbin-1.0.0/autolog.sh
#password stored in ~/.pgpass
#psql -w -U acc_user -h localhost -d Factoring -c "select acc_user.p_loop_count_sheet()"
psql -w -U acc_user Factoring -c "select acc_user.p_loop_count_sheet()"
案例:输入命令 打开任务编辑器
crontab -e
可以看到
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# For more information see the manual pages of crontab(5) and cron(8)
# m h dom mon dow command 这样的格式
我们每5分钟把 /home/myfile 路径下的文件打包一次放到 /home/rar 目录下
我们就可以这样写:
*/ * * * * tar czf /home/rar/myfile.tgz /home/myfile/*
然后重启服务:
daokr@DK:~/rar$ sudo service cron restart
[sudo] daokr 的密码:
利用stat 命令查看文件时间更新时间看是否已经执行成功
daokr@DK:~/rar$ stat myfile.tgz
文件:'myfile.tgz'
大小: 块: IO 块: 普通文件
设备:801h/2049d Inode: 硬链接:
权限:(/-rw-rw-r--) Uid:( / daokr) Gid:( / daokr)
最近访问:-- ::21.837168254 +
最近更改:-- ::01.897642845 +
最近改动:-- ::01.897642845 +
crontab -l 查看任务
crontab -r 删除任务
工作中用到的计划任务
CREATE OR REPLACE FUNCTION "acc_user"."p_loop_count_sheet"(inccy varchar='CNY'::character varying)
RETURNS "pg_catalog"."void" AS $BODY$
declare
--v_ccy VARCHAR();
--v_rate VARCHAR();
v_code numeric;
v_errm VARCHAR();
v_count VARCHAR();
v_s_count VARCHAR();
v_a_count VARCHAR();
v_b_count VARCHAR();
v_c_count VARCHAR();
v_d_count VARCHAR(); BEGIN raise notice 'begin call p_count_sheet1'; INSERT INTO t_errors
(code, MESSAGE, PRO_NAME, RUN_DATE)
VALUES
(, 'run', 'p_loop_count_sheet', now()); perform p_count_sheet1('CNY',''); raise notice 'begin insert into acc_user.t_acc_general_ledger_ac_his'; insert into acc_user.t_acc_general_ledger_ac_his
(br_no, gl_code, d_curr_amt, c_curr_amt, d_count, c_count)
WITH path1 AS
(SELECT ent_id as agent_id,
parent_ent_id as parent_id,
SYS_CONNECT_BY_PATH(ent_id, ',') p_child
FROM crm_user.t_enterprise
CONNECT BY ent_id = PRIOR parent_ent_id),
allpath AS
(SELECT agent_id,
SUBSTR(string_agg(p_child,','), , ) all_c_p
FROM path1
GROUP BY agent_id),
trade1 AS
(SELECT BR_NO,
GL_CODE,
AC_DATE,
d_curr_amt,
c_curr_amt,
d_count,
c_count
FROM acc_user.t_acc_general_ledger_his_temp
WHERE (ac_date) = trunc(now() - ))
SELECT allpath.agent_id,
trade1.GL_CODE,
SUM(DECODE(instr(all_c_p, trade1.BR_NO),,,nvl(d_curr_amt, ))) d_curr_amt_sum,
SUM(DECODE(instr(all_c_p, trade1.BR_NO),,,nvl(c_curr_amt, ))) c_curr_amt_sum,
SUM(DECODE(instr(all_c_p, trade1.BR_NO),,,nvl(d_count, ))) d_count_sum,
SUM(DECODE(instr(all_c_p, trade1.BR_NO),,,nvl(c_count, ))) c_count_sum
FROM allpath
inner join trade1 on instr(all_c_p, trade1.BR_NO) >
GROUP BY allpath.agent_id, trade1.GL_CODE; update t_acc_general_ledger_ac_his
set seq_no = t_acc_general_ledger_ac_his_seq_no_seq.nextval,
ccy = INCCY,
ac_date = trunc(now() - )
where ac_date is null; select count(*)
into v_s_count
from (select br_no,
sum(nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )) s_d,
sum(nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )) s_c
from t_acc_general_ledger_ac_his
where ac_date = trunc(now() - )
group by br_no)
where s_d != s_c; raise notice 'v_s_count: %', v_s_count; if (v_s_count = '') then raise notice 'begin update t_acc_general_ledger_ac_his -79'; update t_acc_general_ledger_ac_his t2
set t2.d_prev_bal =
(with kk as (select br_no,
gl_code,
ac_date,
lag(d_curr_bal::bigint, ,::bigint) over(partition by br_no, gl_code order by ac_date) d_prev_bal_next
from t_acc_general_ledger_ac_his)
select kk.d_prev_bal_next
from kk
where kk.br_no = t2.br_no
and kk.gl_code = t2.gl_code
and kk.ac_date = t2.ac_date)
where ac_date = trunc(now() - ); raise notice 'begin update t_acc_general_ledger_ac_his -95'; update t_acc_general_ledger_ac_his t2
set t2.c_prev_bal =
(with kk as (select br_no,
gl_code,
ac_date,
lag(c_curr_bal::bigint, ,::bigint) over(partition by br_no, gl_code order by ac_date) c_prev_bal_next
from t_acc_general_ledger_ac_his)
select kk.c_prev_bal_next
from kk
where kk.br_no = t2.br_no
and kk.gl_code = t2.gl_code
and kk.ac_date = t2.ac_date)
where ac_date = trunc(now() - ); raise notice 'begin update t_acc_general_ledger_ac_his -111'; update t_acc_general_ledger_ac_his t2
set d_curr_bal =
(with kk as (SELECT br_no,
t1.gl_code,
debit_credit,
t1.ac_date,
CASE
WHEN debit_credit = 'D' THEN
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, ) WHEN debit_credit = 'C' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, ) WHEN debit_credit = 'B' AND
nvl(d_prev_bal, ) = and
nvl(c_prev_bal, ) = and
(d_curr_amt - c_curr_amt) > THEN
abs(nvl(d_curr_amt,) -
nvl(c_curr_amt,)) when debit_credit = 'B' and
nvl(d_prev_bal, ) > and
(d_prev_bal + d_curr_amt -
nvl(c_curr_amt, )) > then
abs(d_prev_bal + d_curr_amt -
nvl(c_curr_amt, )) when debit_credit = 'B' and
nvl(c_prev_bal, ) > and
(c_prev_bal + c_curr_amt -
nvl(d_curr_amt, )) < then
abs(c_prev_bal + c_curr_amt -
nvl(d_curr_amt, )) --ELSE abs(c_prev_bal+c_curr_amt-nvl(d_curr_amt,d_curr_amt,))
END curr_bal
FROM t_acc_general_ledger_ac_his t1,
t_acc_subject
WHERE t1.gl_code = t_acc_subject.gl_code
and ac_date = trunc(now() - ))
select decode(kk.debit_credit,
'D',
kk.curr_bal,
'B',
kk.curr_bal,
)
from kk
where kk.br_no = t2.br_no
and kk.gl_code = t2.gl_code
and kk.ac_date = t2.ac_date
and t2.ac_date = trunc(now() - ))
where ac_date = trunc(now() - ); raise notice 'update t_acc_general_ledger_ac_his'; update t_acc_general_ledger_ac_his t2
set c_curr_bal =
(with kk as (SELECT br_no,
t1.gl_code,
debit_credit,
t1.ac_date,
CASE
WHEN debit_credit = 'D' THEN
nvl(d_prev_bal,) +
nvl(d_curr_amt,) -
nvl(c_curr_amt,) WHEN debit_credit = 'C' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, ) WHEN debit_credit = 'B' AND
nvl(d_prev_bal, ) = and
nvl(c_prev_bal, ) = and
(d_curr_amt - c_curr_amt) < THEN
abs(nvl(d_curr_amt, ) -
nvl(c_curr_amt, )) when debit_credit = 'B' and
nvl(c_prev_bal, ) > and
(c_prev_bal + c_curr_amt -
nvl(d_curr_amt, )) > then
abs(c_prev_bal + c_curr_amt -
nvl(d_curr_amt, )) when debit_credit = 'B' and
nvl(d_prev_bal, ) > and
(d_prev_bal + d_curr_amt -
nvl(c_curr_amt, )) < then
abs(d_prev_bal + d_curr_amt -
nvl(c_curr_amt, )) --ELSE abs(c_prev_bal+c_curr_amt-nvl(d_curr_amt,d_curr_amt,))
END curr_bal
FROM t_acc_general_ledger_ac_his t1,
t_acc_subject
WHERE t1.gl_code = t_acc_subject.gl_code
and ac_date = trunc(now() - ))
select decode(kk.debit_credit,
'C',
kk.curr_bal,
'B',
kk.curr_bal,
)
from kk
where kk.br_no = t2.br_no
and kk.gl_code = t2.gl_code
and kk.ac_date = t2.ac_date
and t2.ac_date = trunc(now() - ))
where ac_date = trunc(now() - ); select count(*)
into v_count
from t_acc_general_ledger_ac_his
where =
and ac_date = trunc(now() - ); raise notice 'v_count: %',v_count; if (v_count > ) then
select count(*)
into v_d_count
from t_acc_general_ledger_ac_his
where =
and d_prev_bal > ''
and ac_date = trunc(now() - );
select count(*)
into v_c_count
from t_acc_general_ledger_ac_his
where =
and c_prev_bal > ''
and ac_date = trunc(now() - );
select count(*)
into v_b_count
from t_acc_general_ledger_ac_his
where =
and ac_date = trunc(now() - )
and (d_prev_bal is null or d_prev_bal = '')
and (c_prev_bal is null or c_prev_bal = '')
and cast (d_curr_amt as numeric ) > cast (c_curr_amt as numeric);
select count(*)
into v_a_count
from t_acc_general_ledger_ac_his
where =
and ac_date = trunc(now() - )
and (d_prev_bal is null or d_prev_bal = '')
and (c_prev_bal is null or c_prev_bal = '')
and cast(d_curr_amt as numeric) < cast (c_curr_amt as numeric);
if v_d_count > then
update t_acc_general_ledger_ac_his
set d_curr_bal =
(with kk as (select br_no,
gl_code,
d_prev_bal,
c_prev_bal,
ac_date,
curr_bal
from (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
when d_prev_bal > '' then
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
and =)
where d_prev_bal > '')
select decode(sign(curr_bal), , curr_bal, )
from kk
where t_acc_general_ledger_ac_his.br_no = kk.br_no
and t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
where =
and d_prev_bal > ''
and ac_date = trunc(now() - ); update t_acc_general_ledger_ac_his
set c_curr_bal =
(with kk as (select br_no,
gl_code,
d_prev_bal,
c_prev_bal,
ac_date,
curr_bal
from (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
when d_prev_bal > '' then
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
and =)
where d_prev_bal > '')
select decode(sign(curr_bal), , , abs(curr_bal))
from kk
where t_acc_general_ledger_ac_his.br_no = kk.br_no
and t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
where =
and d_prev_bal > ''
and ac_date = trunc(now() - ); end if; if v_c_count > then
update t_acc_general_ledger_ac_his
set d_curr_bal =
(with kk as (select br_no,
gl_code,
d_prev_bal,
c_prev_bal,
ac_date,
curr_bal
from (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
when d_prev_bal > '' then
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
and =)
where c_prev_bal > '')
select decode(sign(curr_bal), , , abs(curr_bal))
from kk
where t_acc_general_ledger_ac_his.br_no = kk.br_no
and t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
where =
and c_prev_bal > ''
and ac_date = trunc(now() - ); update t_acc_general_ledger_ac_his
set c_curr_bal =
(with kk as (select br_no,
gl_code,
d_prev_bal,
c_prev_bal,
ac_date,
curr_bal
from (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
when d_prev_bal > '' then
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
and =)
where c_prev_bal > '')
select decode(sign(curr_bal), , abs(curr_bal), )
from kk
where t_acc_general_ledger_ac_his.br_no = kk.br_no
and t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
where =
and c_prev_bal > ''
and ac_date = trunc(now() - ); end if; if v_b_count > then
UPDATE t_acc_general_ledger_ac_his
SET d_curr_bal =
(WITH kk AS (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
d_curr_amt,
c_curr_amt,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
WHEN d_prev_bal > '' THEN
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = TRUNC(now() - )
AND =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND (cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) >
cast(t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)))
SELECT DECODE(SIGN(curr_bal), , curr_bal, )
FROM kk
WHERE t_acc_general_ledger_ac_his.br_no = kk.br_no
AND t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
WHERE =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) >
cast (t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)
AND ac_date = trunc(now() - ); UPDATE t_acc_general_ledger_ac_his
SET c_curr_bal =
(WITH kk AS (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
d_curr_amt,
c_curr_amt,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
WHEN d_prev_bal > '' THEN
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = TRUNC(now() - )
AND =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND (cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) >
cast(t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)))
SELECT DECODE(SIGN(curr_bal), , , ABS(curr_bal))
FROM kk
WHERE t_acc_general_ledger_ac_his.br_no = kk.br_no
AND t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
WHERE =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) >
cast(t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)
AND ac_date = trunc(now() - ); end if; if v_a_count > then
UPDATE t_acc_general_ledger_ac_his
SET c_curr_bal =
(WITH kk AS (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
d_curr_amt,
c_curr_amt,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
WHEN d_prev_bal > '' THEN
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
AND =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND (cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) <
cast(t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)))
SELECT DECODE(SIGN(curr_bal), -, ABS(curr_bal), )
FROM kk
WHERE t_acc_general_ledger_ac_his.br_no = kk.br_no
AND t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
WHERE =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) <
cast(t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)
AND ac_date = trunc(now() - ); UPDATE t_acc_general_ledger_ac_his
SET d_curr_bal =
(WITH kk AS (SELECT br_no,
gl_code,
ac_date,
d_prev_bal,
c_prev_bal,
d_curr_amt,
c_curr_amt,
CASE
WHEN c_prev_bal > '' THEN
nvl(c_prev_bal, ) +
nvl(c_curr_amt, ) -
nvl(d_curr_amt, )
WHEN d_prev_bal > '' THEN
nvl(d_prev_bal, ) +
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
ELSE
nvl(d_curr_amt, ) -
nvl(c_curr_amt, )
END curr_bal
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
AND =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND (cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) <
cast(t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)))
SELECT DECODE(SIGN(curr_bal), -, , ABS(curr_bal))
FROM kk
WHERE t_acc_general_ledger_ac_his.br_no = kk.br_no
AND t_acc_general_ledger_ac_his.gl_code = kk.gl_code)
WHERE =
AND (c_prev_bal IS NULL OR c_prev_bal = '')
AND (d_prev_bal IS NULL OR d_prev_bal = '')
AND cast(t_acc_general_ledger_ac_his.D_CURR_AMT as numeric) <
cast(t_acc_general_ledger_ac_his.C_CURR_AMT as numeric)
AND ac_date = trunc(now() - ); end if;
end if; raise notice 'begin insert t_acc_general_ledger_ac_his T1'; insert into t_acc_general_ledger_ac_his
(br_no, gl_code)
select br_no, gl_code
from t_acc_general_ledger_ac_his
where ac_date = trunc(now() - )
minus
select br_no, gl_code
from t_acc_general_ledger_ac_his
where ac_date = trunc(now() - ); UPDATE t_acc_general_ledger_ac_his t2
SET (d_prev_bal) =
(WITH kk AS (SELECT br_no,
gl_code,
ac_date,
lag(d_curr_bal::bigint, ,::bigint) over(order by ac_date) d_prev_bal_next,
lag(c_curr_bal::bigint, ,::bigint) over(order by ac_date) c_prev_bal_next
FROM t_acc_general_ledger_ac_his
WHERE (br_no, gl_code) IN
(SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
MINUS
SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )))
SELECT d_prev_bal_next
FROM kk
WHERE kk.br_no = t2.br_no
AND kk.gl_code = t2.gl_code
AND kk.ac_date IS NULL)
WHERE ac_date IS NULL
AND (br_no, gl_code) IN
(SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
MINUS
SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )); raise notice 'begin updte t_acc_general_ledger_ac_his T2'; UPDATE t_acc_general_ledger_ac_his t2
SET (c_prev_bal) =
(WITH kk AS (SELECT br_no,
gl_code,
ac_date,
lag(d_curr_bal::bigint, ,::bigint) over(partition BY br_no, gl_code order by ac_date) d_prev_bal_next,
lag(c_curr_bal::bigint, ,::bigint) over(partition BY br_no, gl_code order by ac_date) c_prev_bal_next
FROM t_acc_general_ledger_ac_his
WHERE (br_no, gl_code) IN
(SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
MINUS
SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )))
SELECT c_prev_bal_next
FROM kk
WHERE kk.br_no = t2.br_no
AND kk.gl_code = t2.gl_code
AND kk.ac_date IS NULL)
WHERE ac_date IS NULL
AND (br_no, gl_code) IN
(SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
MINUS
SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )); update t_acc_general_ledger_ac_his
set d_curr_bal = d_prev_bal, c_curr_bal = c_prev_bal
where ac_date is null; raise notice 'begin updte [last] t_acc_general_ledger_ac_his'; UPDATE t_acc_general_ledger_ac_his
SET seq_no = t_acc_general_ledger_ac_his_seq_no_seq.nextval,
d_count = '',
c_count = '',
d_curr_amt = '',
c_curr_amt = '',
ac_date = trunc(now() - ),
ccy = INCCY
WHERE ac_date IS NULL
AND (br_no, gl_code) IN
(SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - )
MINUS
SELECT br_no, gl_code
FROM t_acc_general_ledger_ac_his
WHERE ac_date = trunc(now() - ));
--commit;
else
--dbms_output.put_line('error!');
raise notice 'error!'; --for language plpgsql
end if;
raise notice 'begin call P_SUBJECT_SHEET';
perform P_SUBJECT_SHEET('CNY');
EXCEPTION
WHEN OTHERS THEN
v_code := ;
v_errm := SUBSTR(SQLERRM, , );
INSERT INTO t_errors
(code, MESSAGE, PRO_NAME, RUN_DATE)
VALUES
(v_code, v_errm, 'P_LOOP_COUNT_SHEET', now());
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE COST
; ALTER FUNCTION "acc_user"."p_loop_count_sheet"(inccy varchar) OWNER TO "acc_user";
linux的计划任务操作的更多相关文章
- Linux定时任务计划
Linux定时任务计划 在使用Linux系统时,我们有时会需要让系统在某个时间去执行特定的任务,这时就需要去了解Linux提供的定时任务功能 种类 Linux的定时任务分为两种:单一型和循环型 单一型 ...
- linux 的计划任务 定时任务
linux的计划任务,也叫做定时任务 https://www.cnblogs.com/mingforyou/p/3930636.html 名字是crond 查看linux本机的定时任务 crontab ...
- linux任务计划cron、chkconfig工具、systemd管理服务、unit和target介绍
第8周第1次课(5月14日) 课程内容: 10.23 linux任务计划cron10.24 chkconfig工具10.25 systemd管理服务10.26 unit介绍10.27 target介绍 ...
- Linux操作系统的计划任务
Linux操作系统的计划任务 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.任务计划概述 Linux任务计划.周期性任务执行 未来的某时间点执行一次任务: at: 指定时间点, ...
- 让linux好用起来--操作使用技巧
让linux好用起来--操作使用技巧 1 概述 在一个初学者眼里,linux的 CLI 界面没有图形界面那样多彩和友好,会让人产生畏难心理,但是作为一个稍微进阶的linux玩家,自然会积累不少经验 ...
- Linux Shell数组常用操作详解
Linux Shell数组常用操作详解 1数组定义: declare -a 数组名 数组名=(元素1 元素2 元素3 ) declare -a array array=( ) 数组用小括号括起,数组元 ...
- Linux任务计划
Linux任务计划: 一次性任务执行(at.batch): at:定时任务,指定一个时间执行一个任务,只能执行一次. at使用方式: 交互式:让用户在at>提示符输入多个要执行的命令: 批处理: ...
- 配置Linux任务计划
Linux有三种计划任务: at:指定一个时间执行一个任务 (适用一个或多个任务,执行一次后就不用) cron:根据一个时间表自动执行任务 (使用一个或多个任务,周期性执行) 系统级别的计划任务及其扩 ...
- Linux 基本概念和操作2
接着上一篇 "Linux 基本概念和操作" 1.删除文件 有时候我们想要删除的文件是只读文件,直接使用rm 文件名,会报错.这时使用" -f " 参数强制删除. ...
随机推荐
- Dubbo快速入门 三
3.dubbo环境搭建 3.1).[windows]-安装zookeeper 1.下载zookeeper 网址 https://archive.apache.org/dist/zookeeper/zo ...
- xxx商城之架构和功能简述
XXX商城项目简介 XXX商城项目是一套做特卖的电商系统,包括前台商城系统(App.微信版.小程序版.H5版)及后台管理系统,基于SpringBoot+SpringDataJpa+S ...
- gensim快速上手教程
1 gensim是什么? gensim是一个Python常用的的自然语言处理开发包, 主要用于词向量训练和加载词向量,以下解释其正确使用姿势. 2 正确使用姿势 from gensim. ...
- openssl jia adress
???????????????????????????????????????????openssl证IP 首先创建openssl.cnf, 内容如下. 其中organizationalUnitNam ...
- python3基础之“小练习(1)”
(一)打印3个不同的字符 # a=int("123") # b="123" # c=1.2 # print(type(a),a) # print(type(b) ...
- shell 字符串截取表达式
${var#str} 从左向右匹配,非贪婪匹配,截取并保留右边的内容 txt='123456abc123456' echo ${txt#*34} # 56abc123456 ${var##str} 从 ...
- Python——输入&输出
输入:input 在网页中有很多需要输入的点,比如:评论,用户名密码等等,这些功能在python中使用的是input模块来实现的. username = input('请输入用户名:') passwo ...
- Python——模块合集
标准库模块 ● Python——OS(系统操作模块) ● Python——MD5(加密模块) ● Python——time(时间模块) ● Python——re(正则表达式) ● Python——sy ...
- mac中git使用
配置用户名及邮箱在使用Git提交前,必须配置用户名和邮箱,这些信息会永久保存到历史记录中.git config --global user.name "xxxxxx"git con ...
- ashx 文件的运用
ASP.NET中有一种这样格式的文件ashx文件,作什么用的呢?如果你想创建一个ASP.NET文件,它不是aspx文件,它能动态的返回一个图片.XML文件或其他非HTML文件.那就使用ashx文件了. ...