Loading

摘要: ```sql --定义可被SQL语句调用的子程序 create or replace function getempdept( p_empno emp.empno%type )return varchar2 as v_dname dept.dname%TYPE; begin select b.dname into v_dname from emp a,dept b where... 阅读全文
posted @ 2018-04-08 21:43 火柴天堂 阅读(807) 评论(0) 推荐(0)
摘要: 1 --定义包中函数的纯度级别 2 create or replace package purityTest is 3 type dept_typ is table of dept%rowtype index by binary_integer; 4 dept_tab dept_typ; 5 procedure newdept( 6 p... 阅读全文
posted @ 2018-04-08 21:42 火柴天堂 阅读(405) 评论(0) 推荐(0)
摘要: 1 --动态SQL 2 create or replace function get_table_count 3 (table_name in varchar2) return pls_integer 4 is 5 sql_query varchar2(32767):='select count(*) from '||table_name; 6 l_retu... 阅读全文
posted @ 2018-04-08 21:40 火柴天堂 阅读(254) 评论(0) 推荐(0)
摘要: 1 --触发器 2 drop table emp_log 3 create table emp_log( 4 empno number, 5 log_date date, 6 new_salary number, 7 action varchar2(20) --动作记录 8 ); 9 create ... 阅读全文
posted @ 2018-04-08 21:39 火柴天堂 阅读(452) 评论(0) 推荐(1)
摘要: 1 --创建一个函数,用来根据部门编号返回调薪幅度 2 create or replace function get_ratio_by_dept(deptno varchar2) 3 return number is 4 n_salaryratio number(10,2); --调薪比率返回值变量 5 begin 6 case... 阅读全文
posted @ 2018-04-08 21:37 火柴天堂 阅读(1926) 评论(0) 推荐(0)
摘要: 1 ---PLSQL 调试授权 2 GRANT debug any procedure, debug connect session TO scott; 3 --定义变量 4 declare 5 part_number number(6); --SQL类型 6 part_name varchar2(20); --SQL类型 7 ... 阅读全文
posted @ 2018-04-08 21:26 火柴天堂 阅读(654) 评论(0) 推荐(0)