Home > database >  The stored procedure
The stored procedure

Time:10-06

great god teach genuflect is begged!!
First contact with oracle, the stored procedure was dying,,,
according to the number of different number add current want to every day, every day is the judgment of the day is the last day of this month, if is the last day of that month, according to the number add to this month's current data, judgment day is the last day of this year, according to the number add to this year's current data

Number time current parent number identifies a
100001 2016/7/11 13:02 0.1 1000 0
100001 2016/7/11 13:03 0.1 1000 0
100001 2016/7/11 13:04 0.1 1000 0
100001 2016/7/11 13:05 0.1 1000 0
100001 2016/7/11 13:06 0.1 1000 0
100001 2016/7/11 13:07 0.1 1000 0
100001 2016/7/11 13:08 0.1 1000 0
100001 2016/7/11 13:09 0.1 1000 0
100001 2016/7/11 "0.1 1000 0
100001 2016/7/11 then 0.1 1000 0
100001 2016/7/11 when 0.1 1000 0
100001 2016/7/11 0.1 1000 0
"100001 2016/7/11 remained 4.8 1000 0
100001 2016/7/11 13:15 5 1000 0
100001 2016/7/11:6.5 1000 0
100001 "2016/7/11 6.4 1000 0
100001 2016/7/11 13:18 6 1000 0
100001 2016/7/11 and 6 1000 0
100001 2016/7/11 all 6 1000 0
100002 2016/7/11 "6 1000 0
100003 2016/7/11 and 5.6 1000 0
100004 2016/7/11 but 5.8 1000 0
100005 cluster 5.6 the 2016/7/11 1000 0
100006 2016/7/11 5.6 while 1000 0
100006 2016/7/11 5.6 1000 0
"100006 2016/7/11 but 5.6 1000 0
100006 2016/7/11 13:28 5.6 1000 0
100006 2016/7/11 possession of 0, 1000
100006 2016/7/11 13:30 5.5 1000 0
100011 2016/7/11 times 5.5 1001 0
100011 2016/7/11 "0, 1001
100011 temptation 2016/7/11 5.5 1001 0
100021 2016/7/11 became 5.5 1002 0
100022 2016/7/11 "by 5.5, 1002

CodePudding user response:

Your demand is statistics for each number of monthly and yearly electricity flow combined?

CodePudding user response:

reference 1st floor ghx287524027 response:
statistics each number is your demand monthly and yearly electricity flow combined?
of statistics every day every month every year is by day/minute to collect data, and a number one day 60 * 24 data and then the data together

CodePudding user response:

refer to the second floor qq_24231461 response:
Quote: refer to 1st floor ghx287524027 response:

Your demand is statistics for each number of monthly and yearly electricity flow combined?
of statistics every day every month every year is by day/minute to collect data, and a number one day 60 * 24 data and then the data addition

 select Anderson d, a.r q, a. d. l, b.r q, b.d l, c.r q, c.d l from 
(select id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy) rq, sum (dl) dl,' FBH from TAB
Group by id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy)) a
Left the join
(select id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy - mm) rq, sum (dl) dl, Max (to_char (to_date (sj,' yyyy - mm - dd hh24: mi '), 'yyyy)) FBH from TAB
Group by id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy - mm))
bOn Anderson and a.r q=d d=b.i substr (b.r q, 1, 4)
Left the join
(select id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), '- dd yyyy - mm) rq, sum (dl) dl, Max (to_char (to_date (sj,' yyyy - mm - dd hh24: mi '), 'yyyy - mm)) FBH from TAB
Group by id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), '- dd yyyy - mm)) c
On Anderson and b.r q=d d=c.i substr (c.r q, 1, 7)
The order by id, a.r q, b.r q, c.r q

Don't know if you want the results
Time to number: id: sj: current dl father number: FBH logo: flag

CodePudding user response:

reference ghx287524027 reply: 3/f
Quote: refer to the second floor qq_24231461 response:

Quote: refer to 1st floor ghx287524027 response:

Your demand is statistics for each number of monthly and yearly electricity flow combined?
of statistics every day every month every year is by day/minute to collect data, and a number one day 60 * 24 data and then the data addition

 select Anderson d, a.r q, a. d. l, b.r q, b.d l, c.r q, c.d l from 
(select id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy) rq, sum (dl) dl,' FBH from TAB
Group by id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy)) a
Left the join
(select id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy - mm) rq, sum (dl) dl, Max (to_char (to_date (sj,' yyyy - mm - dd hh24: mi '), 'yyyy)) FBH from TAB
Group by id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), 'yyyy - mm))
bOn Anderson and a.r q=d d=b.i substr (b.r q, 1, 4)
Left the join
(select id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), '- dd yyyy - mm) rq, sum (dl) dl, Max (to_char (to_date (sj,' yyyy - mm - dd hh24: mi '), 'yyyy - mm)) FBH from TAB
Group by id, to_char (to_date (sj, 'yyyy - mm - dd hh24: mi'), '- dd yyyy - mm)) c
On Anderson and b.r q=d d=c.i substr (c.r q, 1, 7)
The order by id, a.r q, b.r q, c.r q

Don't know if you want the results
Current time number: id: sj, dl father number: FBH logo: flag



Well I need to write a stored procedure is not SQL is now statistical data to insert into the database

CodePudding user response:

reference 4 floor qq_24231461 response:
Quote: reference ghx287524027 reply: 3/f

Quote: refer to the second floor qq_24231461 response:

Quote: refer to 1st floor ghx287524027 response:

Your demand is statistics for each number of monthly and yearly electricity flow combined? nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related