[转]Oracle 中计算时间间隔的SQL 语句
select sysdate - interval '' second as TSec from dual -- 计算 60秒 前的时间 select sysdate - interval '' minute as TMin from dual -- 计算 10分 前的时间 select sysdate - interval '' hour as UTCTime from dual -- 计算 8小时 前的时间
select sysdate - / as UTCTime from dual -- 计算 8小时 前的时间 select sysdate - interval '8 2' day to hour as UTCTime from dual -- 计算 8天2小时 前的时间
select sysdate - interval '8 2:5:1.2222' day to second as UTCTime from dual -- 计算 8天2小时5分1.2222秒 前的时间 select sysdate - interval '' day as TDay from dual -- 计算 1天 前的时间
select sysdate - as TDay from dual -- 计算 1天 前的时间 select sysdate - interval '' month as TMonth from dual -- 计算 1月 前的时间 select sysdate - interval '' year as TYear from dual -- 计算 5年 前的时间
select sysdate - interval '' year() as TYear from dual -- 计算 1995年 前的时间
select trunc(sysdate) as Now from dual -- 得到当前日期 -- 更多参考:https://www.cnblogs.com/ChinazhouWang/p/4896151.html
[转]Oracle 中计算时间间隔的SQL 语句的更多相关文章
- SqlServer和Oracle中一些常用的sql语句9 SQL优化
--SQL查询优化 尽量避免使用or,not,distinct运算符,简化连接条件 /*Or运算符*/ use db_business go select * from 仓库 where 城市='北京 ...
- SqlServer和Oracle中一些常用的sql语句5 流程控制语句
--在sql语句中 begin...end 用来设定一个程序块 相关于c#中的{} declare @yz real,@w int --声明变量 set @w=120 --为变量赋值 if @w< ...
- SqlServer和Oracle中一些常用的sql语句10 特殊应用
--482, ORACLE / SQL SERVER --订购数量超过平均值的书籍 WITH Orders_Book AS ( SELECT Book_Name, SUM(Qty) Book_Qty ...
- SqlServer和Oracle中一些常用的sql语句7 游标
declare db_cursor4 scroll cursor for select * from 供应商 --声明游标 open db_cursor4 --打开游标 fetch first fro ...
- SqlServer和Oracle中一些常用的sql语句8 触发器和事务
--创建和执行事后触发器 --更新仓库备份表中记录时自动创建数据表且插入三条记录 create trigger db_trigger1 on 仓库备份 for update as begin if E ...
- SqlServer和Oracle中一些常用的sql语句3 行列转换
--217, SQL SERVER SELECT Cust_Name , MAX(CASE WHEN Order_Date ='2009-08-01' THEN AR END) "2009- ...
- SqlServer和Oracle中一些常用的sql语句6 存储过程
--不带参数的存储过程 CREATE procedure proc_sql1 as begin declare @i int set @i=0 while @i<26 begin print c ...
- SqlServer和Oracle中一些常用的sql语句4 局部/全局变量
--把wh1仓库号中姓名含有"平"字的职工工资在原来的基础上加288 update 职工备份 set 工资=工资+288 where 仓库号='wh1' and 姓名 like ' ...
- Oracle中的一些基本sql语句
--新建表create table table1 (id varchar(300) primary key,name varchar(200) not null);--插入数据insert into ...
随机推荐
- Python 编程核心知识体系-模块|面向对象编程(三)
模块 面向对象编程
- SWIFT中获取当前经伟度
很多的APP中都会用到用户的当前位置信息,本文将实现这个小功能 import UIKit import CoreLocation //添加引用 class ViewController: UIView ...
- P1001 第K极值
P1001 第K极值 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 成成第一次模拟赛 第一道 描述 给定一个长度为N(0<n<=10000)的序 ...
- Qt 获取组合键 键盘按住某键 鼠标组合实现
#include "mainwindow.h" #include <QDebug> #include <QKeyEvent> #include <QM ...
- SVM核技巧之终极分析
参考文献: http://www.blogjava.net/zhenandaci/archive/2009/03/01/257237.html http://www.cnblogs.com/jerry ...
- TI AM335x Linux MUX hacking
/********************************************************************************************* * TI ...
- .Protobuf,GRpc,Maven项目出现UnsatisfiedDependencyException、ClassNotFoundException、BuilderException等异常
异常如下: Error starting ApplicationContext. To display the auto-configuration report re-run your applic ...
- php MySQL()函数
1.mysql_query() 函数执行一条 MySQL 查询:mysql_query(query,connection) 2.mysql_fetch_array() 函数 3.mysql_fetch ...
- Codeforces123E. Maze【树形dp】【概率dp】【证明题】
LINK 题目大意 一棵树,上面的每个点都有一定概率成为起点和终点 从起点出发,随机游走,并按照下列规则统计count: DFS(x) if x == exit vertex then finish ...
- C#中IDisposable的用法
在Net中,由GC垃圾回收线程掌握对象资源的释放,程序员无法掌控析构函数的调用时机.对于一些非托管资源,比如数据库链接对象等,需要实现IDisposable接口进行手动的垃圾回收.那么什么时候使用Id ...