摘要:
开始--INDEX BY TableSET SERVEROUTPUT ON;DECLARE TYPE enm_tab_type IS TABLE OF emp.ename%TYPE INDEX BY BINARY_INTEGER; enm_table enm_tab_type;BEGIN enm_table(1):='ABCD'; IF enm_table.EXISTS(1) THEN dbms_output.put_line( enm_table(1)); ELSE dbms_output.put_line( 'not exists(1)... 阅读全文
摘要:
开始DECLARE v_cnt NUMBER:=0; v_out_ext BOOLEAN:=FALSE; v_in_ext BOOLEAN:=FALSE;BEGIN <<Outer_loop>> LOOP EXIT WHEN v_cnt>20; <<Inner_loop>> LOOP dbms_output.put_line(v_cnt); v_cnt:=v_cnt+1; IF v_cnt>5 THEN v_in_ext:=TRUE; ... 阅读全文
摘要:
开始DECLARE v_lower NUMBER :=1; v_upper NUMBER :=10;BEGIN FOR i IN v_lower .. v_upper LOOP dbms_output.put_line('i is: '|| i); END LOOP;END;要注意,i 并没有进行事前定义。运行的结果是:anonymous block completedi is: 1i is: 2i is: 3i is: 4i is: 5i is: 6i is: 7i is: 8i is: 9i is: 10结束 阅读全文
摘要:
开始&加变量,为的是在运行前给出提示,要求用户输入数据。看例子:DECLARE v_grade CHAR(1) := UPPER( '&grade'); v_app VARCHAR2(20); BEGIN v_app := CASE WHEN v_grade='A' THEN 'Excellent' WHEN v_grade='B' THEN 'Very Good' ELSE 'No such grade' END; DBMS_OUTPUT.put_line('Grade:& 阅读全文
摘要:
开始VARIABLE rows_deleted varchar2(30)DECLARE v_empno emp_cpy.empno%TYPE:=7900;BEGIN DELETE FROM emp_cpy WHERE empno=v_empno; :rows_deleted:=(SQL%ROWCOUNT || 'row deleted.');END;/PRINT rows_deleted运行结果:anonymous block completedROWS_DELETED-------------1row deleted.结束 阅读全文
摘要:
开始PL/SQL 的培训例子有问题。我的验证如下:SQL> select empno, ename from emp_cpy; EMPNO ENAME ---------- ---------- 7900 gaoxx 7902 jianxx SQL> SQL> select empno, ename from emp; EMPNO ENAME---------- ---------- 7369 SMITH 7499 ... 阅读全文
摘要:
开始set serveroutput on; DECLARE v_ename emp.ename%TYPE; BEGIN select ename into v_ename from emp where empno=7369; dbms_output.put_line('ename is:'||v_ename); END;结束 阅读全文
摘要:
开始set serveroutput on;<<outer>> DECLARE birthdate DATE; BEGIN birthdate:=TO_DATE('2012-05-18','YYYY-MM-DD'); DECLARE birthdate DATE; BEGIN birthdate:=TO_DATE('2012-01-15','YYYY-MM-DD'); dbms_output.put_line('inner date is:' || birthdate); dbms_ou.. 阅读全文
摘要:
开始学习网上文章:http://blog.csdn.net/linwaterbin/article/details/7823519我自己所作的实验。首先根据网络上搜索的结论,DBWR会在如下几种情况下写数据:什么时候dbwr会把数据写入数据文件呢?下面这几种情况:1.当Buffer Cache中的Dirty List长度达到阀值:DBWR将Dirty List中的Dirty Buffer写入磁盘(userServerProcess在LRU List中查找free buffer时将碰到的dirty blocks移入Dirty List)2.当user Server Process在Buffer 阅读全文
摘要:
开始set serveroutput ondefine p_annual=6000declare v_sal number(7,2):=&p_annual;begin v_sal := v_sal/12; dbms_output.put_line('the monthly salary is ' || v_sal);end;script output 窗口可以看出:anonymous block completedthe monthly salary is 500结束 阅读全文