惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Palo Alto Networks Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
S
Schneier on Security
S
Securelist
酷 壳 – CoolShell
酷 壳 – CoolShell
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cyberwarzone
Cyberwarzone
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
GbyAI
GbyAI
Security Latest
Security Latest
Last Week in AI
Last Week in AI
Microsoft Security Blog
Microsoft Security Blog
云风的 BLOG
云风的 BLOG
Recorded Future
Recorded Future
Webroot Blog
Webroot Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
C
Cisco Blogs
博客园 - 【当耐特】
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
B
Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Attack and Defense Labs
Attack and Defense Labs
The Last Watchdog
The Last Watchdog
U
Unit 42
阮一峰的网络日志
阮一峰的网络日志
Project Zero
Project Zero
WordPress大学
WordPress大学
L
LINUX DO - 最新话题
F
Fortinet All Blogs
L
LINUX DO - 热门话题
PCI Perspectives
PCI Perspectives
Simon Willison's Weblog
Simon Willison's Weblog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
MongoDB | Blog
MongoDB | Blog
Latest news
Latest news
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
The Hacker News
The Hacker News
爱范儿
爱范儿
O
OpenAI News
J
Java Code Geeks
T
The Exploit Database - CXSecurity.com
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - 左少白

oracle 找回DROP掉的表 求解,工作流点通过时,弹出窗口让用户录入审核意见 oracle 游标 c# 多态 sqlserver 按五分钟分组 c# 继承 查询行转列 SqlParameter序列化的问题 oracle oracle trunc (date,dd )函数 oracle 游标 对象集合转换为datatable 用C# 正则 提取HTML标签中的值? oracle decode 与 case when ,空的处理 oracle select for update sql1 Oracle Index 相關知識 玩转DevExpress.XtraGrid.view.gridview oracle索引 在Oracle中进行大小写不敏感的查询2
同期进度,完成率
左少白 · 2010-02-21 · via 博客园 - 左少白

PROCEDURE P_DailyReport

            (v_StatisticsDate IN varchar2, v_BranchFlag IN VARCHAR2,cur_name OUT t_cursor)

IS

   i_year  INTEGER :=0;--年份

   i_month INTEGER  :=0;--月份

   i_day   INTEGER  :=0;--天数

   i_monthdays INTEGER :=0;--本月天数

   i_alldays   INTEGER  :=0;--全年天数

   d_firstday DATE;--本月第一天

   d_yearfirstday DATE;--本年第一天

   i_pastdays INTEGER  :=0;--当年已过天数

   d_lastyearfirstday DATE;--去年第一天

   d_lasttoday DATE;--去年今天

   d_StatisticsDate DATE;

BEGIN

    i_year  :=to_number(substr(v_statisticsdate,1,4));

    i_month :=to_number(substr(v_statisticsdate,6,2));

    i_day   :=to_number(substr(v_statisticsdate,9,2));

    d_StatisticsDate:=to_date(v_StatisticsDate,'yyyy-mm-dd');

    --本月第一天,总天数

    SELECT MIN(thedate),MAX(theday)

      INTO d_firstday,i_monthdays

      FROM dim_date

     WHERE theyear=i_year AND themonth=i_month;

     --全年天数

     SELECT COUNT(1),MIN(thedate)

       INTO i_alldays,d_yearfirstday

       FROM dim_date

      WHERE theyear=i_year;

     --当年已过天数

     SELECT COUNT(1)

       INTO i_pastdays

       FROM dim_date

      WHERE theyear=i_year AND thedate<=d_StatisticsDate;

     --去年第一天

     SELECT MIN(thedate)

       INTO d_lastyearfirstday

       FROM dim_date

      WHERE theyear=i_year-1;

     --去年今天

     SELECT thedate

       INTO d_lasttoday

       FROM dim_date

      WHERE theyear=i_year-1 AND themonth=i_month AND theday=i_day;

OPEN cur_name FOR

     SELECT  c.branchabbr,d.TARGET,

             round(d.TARGET/i_alldays*i_monthdays,2) monthtarget, --月指标

             round(SUM(e.amount)/100000000,4) xshje,

             round(SUM(e.amount)/(d.TARGET/i_alldays*i_day*100000000),4),--当月进度

             round(SUM(f.amount)/100000000,4) ndxshje,

             round(SUM(f.amount)/(d.TARGET/i_alldays*i_pastdays*100000000),4),--年同期进度

             round(d.TARGET/i_alldays*i_monthdays-SUM(e.amount)/100000000,4),  --月度差额

             round(SUM(g.amount)/100000000,4),

             round((SUM(f.amount)- SUM(g.amount))/ SUM(g.amount),4)

       FROM ( SELECT a.branchabbr,a.branchflag,b.branchflag branchflag3

                FROM(SELECT branchabbr,branchflag

                       FROM t_jzt_common_branch

                      WHERE isactive=1

                        AND branchlevel=2 AND branchflag<>'ZDA' AND branchflag<>'FDY'

                     ) a

                INNER JOIN(SELECT branchflag,higherbranchflag

                             FROM t_jzt_common_branch

                            WHERE isactive=1 AND branchflag<>'ZDA'

                           )b ON a.branchflag=b.higherbranchflag

            ) c

       LEFT JOIN  t_report_TARGET d ON d.statisticsdate=i_year

                                    AND d.branchflag=c.branchflag

                                    AND d.TARGETType='销售指标'

       LEFT JOIN (SELECT branchflag,sum(amount) amount--月度

                    FROM t_bi_dailysalereport

                   WHERE orderdate >=d_firstday AND orderdate<=d_StatisticsDate

                   GROUP BY branchflag

                 ) e ON e.branchflag=c.branchflag3

       LEFT JOIN (SELECT branchflag,sum(amount) amount--年度

                    FROM t_bi_dailysalereport

                   WHERE orderdate>=d_yearfirstday AND orderdate<=d_StatisticsDate

                   GROUP BY branchflag

                 ) f ON f.branchflag=c.branchflag3

       LEFT JOIN (SELECT branchflag,sum(amount) amount --去年

                    FROM t_bi_dailysalereport

                   WHERE orderdate >=d_lastyearfirstday AND orderdate<=d_lasttoday

                   GROUP BY branchflag

                 )g ON g.branchflag=c.branchflag3

       GROUP BY c.branchabbr,d.TARGET

       ORDER BY c.branchabbr,d.TARGET;

END P_DailyReport;