--全部小写 全部大写 全部首字母大写
select lower('ATGUIGUJAVA'),UPPER('ATGUIGU Java'),initcap('ATGUIGU Java')
from dual
--

运行结果

--转换为小写查询
select * from employees
where lower(last_name)='king'

运行结果

字符控制函数

--拼接      截取   长度
select
CONCAT('hello','world'), SUBSTR('helloworld',2,4), LENGTH('helloworld')
from dual;

运行结果

--判断字符的位置 没有返回0
select instr('helloworld','w') from dual

运行结果

--座对齐 输出十位 不足*号补齐 左端补齐
select employee_id,last_name,lpad(salary,10,'*') from employees;

运行结果

--在字符里面取出 去除首尾h
select trim('h'from 'hhellhoworldh') from dual

运行结果

--替换所有的a
select replace('abcgavc','a','c') from dual

运行结果


--保留数
select round(435.35,2),round(435.35),round(435.35,-2) from dual

运行结果


--保留数 截断
select trunc(435.35,2),trunc(435.35),trunc(435.35,-2) from dual

运行结果

--员工工作天数
select employee_id,last_name,trunc(sysdate-hire_date) worked_days
from employees;

运行结果

--员工工作月数
select employee_id,last_name,(sysdate-hire_date)/30,months_between(sysdate,hire_date)
from employees;

运行结果

--加上月数2月 减去三月 下个周日
select add_months(sysdate,2),add_months(sysdate,-3),next_day(sysdate,'星期日')
from dual

运行结果

--每个月倒数第二天来的员工
select last_name,hire_date from employees where hire_date=last_day(hire_date)-1

运行结果

--日期函数  按照月份 日期
select round(sysdate,'month'),round(sysdate,'mm'),trunc(sysdate,'hh')
from dual

运行结果

隐式类型转换

--转换
select '12'+2 from dual;

运行结果

显式转换

--进行日期转换
select employee_id,hire_date from employees
--where hire_date='7-06月-94'
where to_char(hire_date,'yyyy-mm-dd')='1994-06-07'

运行结果

--进行日期转换
select employee_id, to_char(hire_date,'yyyy"年"mm"月"dd"日"') from employees
--where hire_date='7-06月-94'
where to_char(hire_date,'yyyy"年"mm"月"dd"日"')='1994年06月07日'

运行结果

--转换
select to_char(1234567.89,'999,999,999,99') from dual;

运行结果

--员工工资
select to_char(1234567.89,'$999,999,999,99') from dual;

员工工资

oracle之单行函数1相关推荐

  1. Oracle(二)单行函数

    Oracle(二)单行函数 --单行函数 ---字符函数 select upper('yes') from dual;--YES select lower('YES') from dual;--yes ...

  2. ORACLE:单行函数

    目录 一.函数介绍 二.函数分类 2.1 字符函数 lower.upper.initcap concat.substr.length.instr.lpad.rpad.trim.replace 2.2 ...

  3. 数据库 day60,61 Oracle入门,单行函数,多表查询,子查询,事物处理,约束,rownum分页,视图,序列,索引

    1.    oracle介绍 ORACLE数据库系统是美国ORACLE公司(甲骨文)提供的以分布式数据库为核心的一组软件产品,是目前最流行的客户/服务器(CLIENT/SERVER)或B/S体系结构的 ...

  4. oracle之单行函数之分组函数之课后练习

    33. 查询 employees 表中有多少个部门select count(distinct department_id)from employees 34. 查询全公司奖金基数的平均值(没有奖金的人 ...

  5. oracle之单行函数之分组函数

    --分组函数 select avg(salary),max(salary),min(salary),sum(salary) from employees 运行结果 --判断大小 select max( ...

  6. oracle之单行函数之多表查询值之课后练习

    26. 多表连接查询时, 若两个表有同名的列, 必须使用表的别名对列名进行引用, 否则出错!27. 查询出公司员工的 last_name, department_name, cityselect la ...

  7. oracle之单行函数之课后练习

    18. 打印出 "2009年10月14日 9:25:40" 格式的当前系统的日期和时间.select to_char(sysdate, 'YYYY"年"MM&q ...

  8. oracle之单行函数之子查询课后练习2

    1. 查询和Zlotkey相同部门的员工姓名和雇用日期 a) select last_name,hire_date b) from employees c) where department_id = ...

  9. oracle之单行函数之子查询之课后练习

    /*************************************************************************************************/ ...

最新文章

  1. strtok(), strtok_s() 字符串分割函数
  2. AOP的MethodBeforeAdvice
  3. php课设报告致谢_PHP学生管理系统毕业论文设计.doc
  4. TCP源端口选择算法与列维模型
  5. 多媒体基础:动画和视频知识笔记
  6. 2019牛客多校第七场E Find the median 权值线段树+离散化
  7. php 转发邮件,PHP Email();我不接收转发的电子邮件
  8. c语言int超出范围溢出处理_整数溢出是怎么回事?Python和Numpy的整数为何不一样?...
  9. 计算机网络学习socket--day3
  10. 51nod-1337:翻转游戏
  11. 乘风破浪,遇见未来新能源汽车(Electric Vehicle)之特斯拉提车必须知道的十个流程
  12. 常用css样式大全以及css属性代码大全
  13. 开源控件My97DatePicker的基本用法
  14. D511 外置功放软件烧录方法
  15. 阿里云ECS云服务器配置项目
  16. LPC1768 关于延时Delay时间与不同等级的优化对比
  17. winform做的单机登录界面和账号注册界面
  18. 51nod 1509 加长棒 插板法
  19. 启动WIFI时:equest firmware failed with error 0xfffffffe ifconfig: SIOCSIFFLAGS: Operation not permitted
  20. 软件测试入职第一天应该做什么?

热门文章

  1. 1009 产生数 2002年NOIP全国联赛普及组
  2. 雷观(六):码农值千金
  3. 中国软件20年,向金山和中国软件英雄致敬!
  4. 什么是SSID/ESSID/BSSID
  5. 搜索引擎的十大秘密(收藏)
  6. html5 audio api 录音,如何使用HTML5 Web Audio API录制我的声音
  7. php system 返回值127,php system 返回值 1
  8. mysql 搭建日志服务器_一、架构01-搭建日志服务器Rsyslog
  9. SHELL test [ 命令用法
  10. linux中断pollselcet按键处理机制