zoukankan      html  css  js  c++  java
  • Oracle操作6

    --查询数据库的时区,默认是世界时区+00:00
    select DBTIMEZONE from dual;
    --查询当前会话的时区,默认是你计算机(服务器)的时区(北京时区+08:00)
    select SESSIONTIMEZONE from dual;
    --设置会话的时区
    alter session set time_zone='+09:00'
    --to_char() FM作用:去除因为9999引发的空格
    select to_char(0.596,'FM99900.00') from dual
    --regexp_replace()利用指定的正则表达式来进行替换
    --start参数:从第几个开始查找,默认从头,也就是1
    --occu参数:替换第几个匹配的项,默认为0,全部替换,1表示将匹配到的第一个进行替换,后面再有匹配的则不在替换
    --match_opt:匹配模式(例如忽略大小写模式)
    select e.ename, regexp_replace(e.ename,'S','-',2 ,0,'i') from emp e
    --表连接查询都可以用子查询替换,但反过来说却不一定
    --连接查询的效率要远远高于子查询
    select * from emp e inner join dept d on e.deptno=d.deptno;
    --bug无法看到dept表中的列
    select e.*,
           (select d.deptno from dept d where e.deptno = d.deptno) deptno,
           (select d.dname from dept d where e.deptno = d.deptno) dname,
           (select d.loc from dept d where e.deptno = d.deptno) loc
      from emp e
     where e.deptno in (select d.deptno from dept d)
  • 相关阅读:
    C# SendKeys用法
    Winform的高DPI问题
    CefSharp在高DPI的屏幕上出现黑边(winform)
    CefSharp支持flash
    CeSharp支持MP4
    C#加密解密总览
    Eclipse 调试Bug之使用断点的七大技巧
    详解Eclipse断点
    怎样编写高质量的java代码
    Quartz任务调度基本使用
  • 原文地址:https://www.cnblogs.com/qilin20/p/12462179.html
Copyright © 2011-2022 走看看