3,491
社区成员
发帖
与我相关
我的任务
分享
----参考下吧
function GetTimeMargin
#########format GetTimeMargin "$firsttime $secondtime"##################
{
sqlplus /nolog <<_EOF_ |grep "###" >tmp.ini
connect $userid
set serveroutput on ;
set head off;
set linesize off;
declare
v_result number(12);
begin
select abs(ceil((to_date('$1','yyyymmddhh24miss') - to_date('$2','yyyymmddhh24miss'))*1440))
into v_result from dual;
dbms_output.put_line('###'||v_result);
end ;
/
_EOF_
echo `more tmp.ini|awk '{print substr($0,index($0,"###")+3,length($0)-index($0,"###")-2)}'`
rm tmp.ini
}