摘要: #静态游标指的是程序执行的时候不需要再去解析sql语言,对于sql语句的解析在编译的时候就可以完成的。 动态游标由于含有参数,对于sql语句的解析必须要等到参数确定的时候才能完成。 从这个角度来说,静态游标的效率也比动态游标更高一些。 #游标的相关概念: 定义: 游标它是一个服务器端的存储区,这个区 阅读全文
posted @ 2017-05-13 22:03 九號栈長 阅读(570) 评论(0) 推荐(0)
摘要: select * from user_constraints s where s.TABLE_NAME=upper('emp') and s.CONSTRAINT_TYPE='P'; 阅读全文
posted @ 2017-05-13 22:01 九號栈長 阅读(278) 评论(0) 推荐(0)
摘要: 循环原则: 如果循环内部必须执行一次,则使用基本循环 如果知道循环次数,则使用FOR循环 如果必须在每次循环开始时判断条件,则使用WHILE循环 1、基本循环 SQL> declare 2 i number := 0; 3 begin 4 loop 5 dbms_output.put_line(i) 阅读全文
posted @ 2017-05-13 20:22 九號栈長 阅读(288) 评论(0) 推荐(0)
摘要: 语法: CASE selector WHEN exp1 then res1 WHEN exp2 then res2 WHEN exp3 then res3 ... [ELSE resN] end; SQL> declare 2 mygrade char(1):='A'; 3 res varchar2 阅读全文
posted @ 2017-05-13 19:54 九號栈長 阅读(2450) 评论(0) 推荐(1)
摘要: 简单条件判断语句 SQL> declare 2 myage number := 10; 3 begin 4 if myage < 11 then 5 dbms_output.put_line('I am a child'); 6 end if; 7 end; 8 / I am a child PL/ 阅读全文
posted @ 2017-05-13 19:05 九號栈長 阅读(724) 评论(0) 推荐(0)
摘要: SQL> select * from dept1 where deptno=20; DEPTNO DNAME LOC 20 RESEARCH DALLAS SQL> declare 2 v_deptno dept.deptno%TYPE :=20; 3 V_loc dept.loc%TYPE :=' 阅读全文
posted @ 2017-05-13 14:23 九號栈長 阅读(1202) 评论(0) 推荐(0)
摘要: MYSQL:rename table table1 to table2;SQL SERVER:EXEC sp_rename 'table1', 'table2';Oracle:alter table table1 rename to table2db2:rename table table1 to 阅读全文
posted @ 2017-05-13 14:05 九號栈長 阅读(338) 评论(0) 推荐(0)
摘要: [oracle@enmo1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Sat May 13 12:00:23 2017 Copyright (c) 1982, 2013, Oracle. All rights 阅读全文
posted @ 2017-05-13 13:56 九號栈長 阅读(2245) 评论(0) 推荐(0)