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

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
Jina AI
Jina AI
博客园_首页
J
Java Code Geeks
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
L
Lohrmann on Cybersecurity
Forbes - Security
Forbes - Security
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News
Y
Y Combinator Blog
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
N
News | PayPal Newsroom
S
Security Archives - TechRepublic
量子位
Cisco Talos Blog
Cisco Talos Blog
V
V2EX
C
Cisco Blogs
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog
L
LangChain Blog
Scott Helme
Scott Helme
S
Securelist
Security Latest
Security Latest
爱范儿
爱范儿
TaoSecurity Blog
TaoSecurity Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
I
Intezer
L
LINUX DO - 最新话题
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Check Point Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
美团技术团队
Know Your Adversary
Know Your Adversary
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
PCI Perspectives
PCI Perspectives
月光博客
月光博客
T
Tailwind CSS Blog
Cloudbric
Cloudbric
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
K
Kaspersky official blog
D
DataBreaches.Net
博客园 - 【当耐特】
有赞技术团队
有赞技术团队

博客园 - K3

什么是URL,URI或URN? 软件设计思想的一些文章 (持续补充中) Mac OS X 上Lua的安装方法 Objective C - 4 - 下载图片并且加载到View Objective C - 3 - 实现一个计算器 Objective C - 2 - 随机数,可变字符串,字符串,SubString Objective C - 1 - 实现一个MessageBox.Show List connected users–similar to task manager How to compose namespaces? Hide/Show running Console Calculate drive total/free/available space C# list installed softwares How to: Modify a Project System So That Projects Load in Multiple Versions of Visual Studio PS:WINRAR制作32位安装程序和64位安装程序选项 使用WINRAR来制作安装程序 impersonate a user VBScript - CUD registry key and value mysql script for dynamic running sql script XmlElement可以避免由XmlSerializer多余生成的代码
MySQL 存储过程,游标,临时表创建
K3 · 2014-04-04 · via 博客园 - K3
-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `filter_record_time`(startTime timestamp, endTime timestamp, pointIndex int)
BEGIN  
        declare _recordtime timestamp;
        declare _pointIndex smallint;
        declare _value double;
        declare _result text;
        declare _previoustime timestamp;
        DECLARE done INT DEFAULT FALSE;
        

        declare fetchSeqCursor cursor for select distinct RecordTime,PointIndex,Value
                                            from flow_record 
                                           where recordtime >= startTime 
                                             and recordtime < endTime
                                             and pointIndex = pointIndex 
                                             and recordtime is not null
                                        order by recordtime;
        
        DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;

        create table if not exists filter_record_time_temp(timeFrom timestamp, timeTo timestamp, times int);
    
        open fetchSeqCursor;
        
        
        seq_loop:loop
            fetch fetchSeqCursor into _recordtime, _pointIndex, _value;

            IF done THEN
                LEAVE seq_loop;
            END IF;

            if _previoustime is null then
                if _recordtime <> startTime then
                    insert into filter_record_time_temp select startTime timefrom, _recordtime timeto, 
                            cast((unix_timestamp(_recordtime) - unix_timestamp(startTime) - 120) / 120 as signed)  times;
                end if;
            else 
                if unix_timestamp(_previoustime) + 120 < unix_timestamp(_recordtime) then
                    insert into filter_record_time_temp select _previoustime timefrom, _recordtime timeto,
                            cast((unix_timestamp(_recordtime) - unix_timestamp(_previoustime) - 120) / 120 as signed) times;
                end if;
            end if;

            set _previoustime = _recordtime;
        end loop;

        close fetchSeqCursor; 

        if unix_timestamp(_previoustime) + 120 < unix_timestamp(endTime) then
            insert into filter_record_time_temp select _previoustime timefrom, endTime timeto,
                            cast((unix_timestamp(endTime) - unix_timestamp(_previoustime) - 120) / 120 as signed) times;
        end if;

        select * from filter_record_time_temp;

        drop table if exists filter_record_time_temp;

END

真尼玛烦人,各个数据库sql语法都不一致,写一点东西查半天资料,耽误时间.