【常用Oracle操作语句】教程文章相关的互联网学习教程文章

oracle 语句创建表空间、用户、授权

/*分为四步 */ /*第1步:创建临时表空间 */ create temporary tablespace yuhang_temp tempfile ‘D:\oracledata\yuhang_temp.dbf‘ size 50m autoextend on next 50m maxsize 20480m extent management local; /*第2步:创建数据表空间 */ create tablespace yuhang_data logging datafile ‘D:\oracledata\yuhang_data.dbf‘ size 50m autoextend on next 50m maxsize 20480m extent management local; /...

shell编程中如何执行oracle语句

shell编程中如果向oracle中插入数据之类的,需要先把执行语句放到文件中,然后再@这个文件执行有如下俩种方式供参考:SQL=`sqlplus user/pwd@orains <<EOF@SqlfileexitEOF`或者echo "exit"|sqlplus user/pwd@orains @sqlfile 原文:https://www.cnblogs.com/watertaro/p/9220807.html

Oracle 数据库连接查询SQL语句

内连接(inner join)。 外连接: 全连接(full join)、左连接(left join)、右连接(right join)。 交叉联接(cross join)。 外连接与内连接不一样,外连接返回的查询结果中不仅包含符合条件的行,还包括左表(左外连接),右表(右外连接)或者两个连接表(全外连接)中的所有不符合条件的数据行。 1.左连接 (left [outer] join) 左外连接就是将左表的所有数据分别于右表的每条数据进行连接组合,返回的结果除内连接的数据外,还有左表...

oracle case where 复杂sql语句【代码】

update hr_user u set u.is_approve=(casewhen u.curr_org_id in(select t.org_idfrom hr_organization tstart with t.org_id =10001263connect by prior org_id = t.org_id_parent) then‘N‘ELSE‘Y‘END);update hr_user u set u.is_approve=(casewhen u.curr_org_id in(select t.org_idfrom hr_organization tstart with t.org_id =10001263connect by prior org_id = t.org_id_parent) then‘N‘ELSE‘Y‘END) where u.EMP_NU...

Oracle 中文字段进行排序的sql语句

1)按笔画排序 select * from Table order by nlssort(columnName,‘NLS_SORT=SCHINESE_STROKE_M‘) 2)按部首排序 select * from Table order by nlssort(columnName,‘NLS_SORT=SCHINESE_RADICAL_M‘) 3)按拼音排序 select * from Table order by nlssort(columnName,‘NLS_SORT=SCHINESE_PINYIN_M‘);原文:http://www.jb51.net/article/20161.htm

oracle创建表空间语句分解

1 create tablespace db_name2 datafile ‘D:\oracle\product\10.2.0\oradata\orcl\db_name_.dbf‘ size 200M3 autoextend on next 10M maxsize unlimited logging4 extent management local autoallocate5 segment space management auto;解释: 1. 创建表空间,名称为db_name; 2. 表空间有一个数据文件*.dbf,大小为200MB; 3. 允许表空间自动扩展(autoextends),每次增长10MB(next 10M),并且不限制最大大小; 4. 说明表空间本...

遇见的oracle数据库和mysql数据库对于一个sql语句的不同支持情况【代码】

# SQL_ASELECT*FROM t_dept t JOIN t_emp e JOIN t_salary s ON t.id=e.`deptId` AND e.`id` = s.`eid`比如上面这个sql,这种 JOIN JOIN ON AND的语法在oracle中是不被支持的,它支持的是JOIN ON JOIN ON的语法,正确写法如下# SQL_BSELECT*FROM t_dept t JOIN t_emp e ON t.id=e.`deptId` JOIN t_salary s ON e.`id` = s.`eid`但是在Mysql中,SQL_A这样的语句是可以执行的,这种语法是被支持的,而且SQL_A和SQL_B语句在mysql中执...

Oracle-18-select语句初步&amp;SQL中用算术表达式&amp;别名的使用&amp;连接运算符%distinct&amp;where子句【图】

一、一般SELECT语句的格式例如以下:1.查询指定表的全部列select * from 表名 [where 条件] [group by 分组列名] [having?聚合函数] [order by 排序列名?ASC| DESC]在表名地方,能够写多个表?2.查询指定表的部分列:select {[distinct]列名。列名,…}from 表名 [where 条件] [group by 分组列名] [having?聚合函数] [order by 排序列名?ASC| DESC]当中keyworddistinct表示去除部分列中反复数据,仅仅是在查询的时候去除,而该表内...

不同数据库oracle mysql SQL Server DB2 infomix sybase分页查询语句

在不同数据库中的使用的分页查询语句:当前页:currentpage 页大小:pagesize 1. Oracle数据库 select * from (select A.*,rownum rn from ( QUERY_SQL ) A ) where rn <= ((currentpage+1)*pagesize) and rn > (currentpage*pagesize)注:QUERY_SQL为查询sql语句。或select * from (select rownum rn,id from TABLENAME where rownum <=((currentpage+1)*pagesize) ) A where A.rn >= (currentpage*pagesize)2. Infomix数据库sel...

oracle中sql语句

1.数据库中查询字段名:select column_name,data_type ,data_length,data_precision,data_scale from    user_tab_columns where table_name=‘表名‘; *表名必须大写。2.数据库中查询所有用户信息:select * from dba_users;3.数据库当前用户角色:select * from user_role_privs;4.pl/sql中输出开关打开:set serveroutput on;5.数据库中权限语句 : grant 权限 to 用户;  grant create sessio...

Oracle 查询(SELECT)语句(二)【图】

? 简介在前面的 Oracle 查询 SELECT 语句(一)中介绍了 SELECT 常用的一些基本查询语法,接下来再来看 SELECT 更深入的一些查询功能和技巧,包括以下内容:1. All 与 Any 运算符2. 分页查询(rownum)3. 集合操作符(UNION、UNION ALL、INTERSECT、MINUS) 1. All 与 Any 运算符1) All 运算符,表示满足给出列表中的所有值。通常用于以下场景:1. 查出大于30号部门所有员工最高工资的员工姓名、工资--使用ALLSELECT enam...

Oracle 和 mysql 的批量操作Sql语句 的区别

正确的oracle批量新增的sql是:方法 1:<insert id="insertAttractionsBatch" parameterType="java.util.List">insert into ATTRACTIONS (ID, NAME, LONGITUDE, LATITUDE, UPDATE_TIME) <foreach collection="list" item="item" index="index" separator="union all" > (select #{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.longitude,jdbcType=DECIMAL}, #{item.updateTime,jdbcType=TIMESTAMP}...

简单的oracle分页语句

SELECT * FROM ( SELECT rownum rn,te.* FROM (SELECT * FROM tb_enterprise) te WHERE rownum <= 10) WHERE rn>11、先通过rownum查询出数据小于最大记录数,同时把rownum查询出来2、外层通过sql再通过rownum取最小范围原文:http://www.cnblogs.com/lijiale/p/6186167.html

Oracle学习之简单查询语句【代码】

--以特定格式显示日期select ename,to_char(hiredate,‘YYYY"年"MM"月"DD"日"‘) from emp; --排除重复行selectdistinct deptno,job from emp; select deptno,job from emp; --使用nvl函数处理NULLselect ename ,sal,comm,nvl(comm,0.00),sal+nvl(comm,0) from emp; --使用nvl2处理NULLselect ename,sal,comm,nvl2(comm,sal+comm,sal) from emp;--如果comm为NULL则返回sal的值,如果comm不为null则返回sal+comm的值 --连接字符串se...

Oracle中常用的命令语句

Oracle中常用的命令语句1.创建用户 create user 用户名 identified by 密码 注意:用户名和密码最好是英文 如:create user sms identified by sms;2.创建表空间 create tablespace 表空间名 datafile ‘存放路径‘ size 大小 如:create tablespace ts_sms datafile ‘F:\quanxianguanliruanjian\oracle\tablespace\sms.dbf‘ size 100m;3.把表空间赋值给刚创建的用户 alter user 用户 default tablespace 表空间 如:al...