- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
oracle教程PLSQL常用方法汇总
关键字: oracle plsql常用方法汇总
在SQLPLUS下,实现中-英字符集转换alter session set nls_language=AMERICAN;alter session set nls_language=SIMPLIFIED CHINESE; 主要知识点:一、有关表的操作1)建表
create table test as select * from dept; --从已知表复制数据和结构create table test as select * from dept where 1=2; --从已知表复制结构但不包括数据2)插入数据:insert into test select * from dept;
二、运算符算术运算符:+ - * / 可以在select 语句中使用连接运算符:|| select deptno|| dname from dept; 比较运算符: = = != = like between is null in逻辑运算符:not and or 集合运算符: intersect ,union, union all, minus 要求:对应集合的列数和数据类型相同查询中不能包含long 列列的标签是第一个集合的标签使用order by时,必须使用位置序号,不能使用列名例:集合运算符的使用:intersect ,union, union all, minus select * from emp intersect select * from emp where deptno=10 ;select * from emp minus select * from emp where deptno=10;select * from emp where deptno=10 union select * from emp where deptno in (10,20); --不包括重复行 select * from emp where deptno=10 union all select * from emp where deptno in (10,20); --包括重复行
三,常用 ORACLE 函数sysdate为系统日期 dual为虚表一)日期函数[重点掌握前四个日期函数]1,add_months[返回日期加(减)指定月份后(前)的日期]select sysdate S1,add_months(sysdate,10) S2,add_months(sysdate,5) S3 from dual;2,last_day [返回该月最后一天的日期] select last_day(sysdate) from dual; 3,months_between[返回日期之间的月份数]select sysdate S1, months_between(1-4月-04,sysdate) S2,months_between(1-4月-04,1-2月-04) S3 from dual4,next_day(d,day): 返回下个星期的日期,day为1-7或星期日-星期六,1表示星期日 select sysdate S1,next_day(sysdate,1) S2,next_day(sysdate,星期日) S3 FROM DUAL 5,round[舍入到最接近的日期](day:舍入到最接近的星期日)select sysdate S1,round(sysdate) S2 ,round(sysdate,year) YEAR,round(sysdate,month) MONTH ,round(sysdate,day) DAY from dual6,trunc[截断到最接近的日期] select sysdate S1,trunc(sysdate) S2,trunc(sysdate,year) YEAR,trunc(sysdate,month) MONTH ,trunc(sysdate,day) DAY from dual7,返回日期列表中最晚日期select greatest(01-1月-04,04-1月-04,10-2月-04) from dual
二)字符函数(可用于字面字符或数据库列)1,字符串截取select substr(abcdef,1,3) from dual2,查找子串位置select instr(abcfdgfdhd,fd) from dual3,字符串连接select HELLO||hello world from dual;4, 1)去掉字符串中的空格select ltri
文档评论(0)