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 " 参数强制删除. ...
随机推荐
- .net core使用ocelot---第八篇 Consul
简介 .net core使用ocelot---第一篇 简单使用 .net core使用ocelot---第二篇 身份验证使用 .net core使用ocelot---第三篇 日志记录 .net ...
- FireWolf OS X PE
FireWolf OS X PE FireWolf OS X PE 9 使用手册 https://pe.firewolf.app/manual/ https://pe.firewolf.app/m ...
- Java调用WebService方法总结(9,end)--Http方式调用WebService
Http方式调用WebService,直接发送soap消息到服务端,然后自己解析服务端返回的结果,这种方式比较简单粗暴,也很好用:soap消息可以通过SoapUI来生成,也很方便.文中所使用到的软件版 ...
- 【转载】 C#使用Math.Abs返回数值的绝对值
在C#的数值运算中,有时候我们需要计算值类型对象的绝对值,此时需要用到C#的数值计算类Math类中的Abs绝对值函数,Math.Abs绝对值函数一共有7个重载类型,支持decimal.double.f ...
- 学习笔记之MongoDB
MongoDB - Wikipedia MongoDB is a cross-platform document-oriented database program. Classified as a ...
- ABAP-Eclipse ADT中创建ABAP CDS视图
Create an ABAP Project in ABAP Development Tools (ADT): https://developers.sap.com/tutorials/abap-cr ...
- Django ORM整理
字段类型 # 自增长 Auto = models.AutoField() BigAuto = models.BigAutoField() # 二进制 Binary = models.BinaryFie ...
- python3 中的try 异常调试与 raise 异常抛出
一.什么是异常? 异常即是一个事件,该事件会在程序执行过程中发生,影响了程序的正常执行. 一般情况下,在Python无法正常处理程序时就会发生一个异常. 异常是Python对象,表示一个错误. 当Py ...
- iPhone的xib与iPad的xib相互转换
1. xib转换 iPhone版本APP开发完成后需要再开发iPad版本的APP,需要把iPhone版本的xib文件添加到iPad项目中去,但是Xcode中iPhone和iPad使用的xib格式不能完 ...
- vue项目配置Mock.js
扯在前面 最近一直在忙跳槽的事情,博客也好久没有更新了,上次更新还是去年,不出意外的话,从今天起继续今年的博客之旅. 今天继续完善我之前的项目架构,从零开始搭建vue移动端项目到上线,有需要的同学可以 ...