-
存儲(chǔ)過程和存儲(chǔ)函數(shù)查看全部
-
創(chuàng)建存儲(chǔ)函數(shù)的語法查看全部
-
create or replace procedure add_emp(emp_name in temp_salary.tempname%type,emp_salary in temp_salary.tempsalary%type) as count1 int; id2 int; begin select aq1.nextval-1 into id2 from dual; insert into temp_salary(tempname,tempsalary)values(emp_name,emp_salary); select count(*)into count1 from temp_salary where temp_id=id2; if count1=1 then dbms_output.put_line('姓名:'||emp_name||',工號:'||(aq1.nextval-1)||'插入成功!'); else dbms_output.put_line('插入失敗!'); end if; end;查看全部
-
--創(chuàng)建表結(jié)構(gòu) create table Temp_salary( id int primary key , TempName varchar2(50) , Salary int default 15000) --添加序列 create sequence aq1 start with 1 increment by 1 --建立觸發(fā)器 create or replace trigger frist_trigger before insert on Temp_salary for each row begin select aq1.nextval into:new.id from daul; end ;查看全部
-
create or replace procedure import(temp_id1 in number,addsalary in temp_salary.tempsalary%type) as --psql保存漲前薪水 psal temp_salary.tempsalary%type; pname temp_salary.tempname%type; begin --保存漲前工資到Psal select tempsalary into psal from temp_salary where temp_id=temp_id1; select tempname into pname from temp_salary where temp_id=temp_id1; --增加工資 update temp_salary set tempsalary=tempsalary+addsalary where temp_id=temp_id1; --打印漲前漲后工資 dbms_output.put_line('姓名:'||pname||',漲前工資:'||psal||',漲后工資:'||(psal+addsalary)); end; begin import(1002,5000); end查看全部
-
包體:create or replace package bogy mypackage as procedure queryEmplist(dno in number, empList out empcusor ) as bebin open empList form select * from empo where deptno=tno; end queryEmpList; end mypackage;查看全部
-
在out 參數(shù)中使用光標(biāo) 包頭: create or replace package myoackage as type empcursor is ref cursor; procedure queryEmpList(dno in number, empList out empcursor); end mypasckage;查看全部
-
區(qū)別:是否用return語句返回值查看全部
-
相同點(diǎn):完成特定功能的程序查看全部
-
存儲(chǔ)過程和存儲(chǔ)函數(shù):指存儲(chǔ)在數(shù)據(jù)庫中供所有用戶程序調(diào)用的子程序叫存儲(chǔ)過程、存儲(chǔ)函數(shù)。查看全部
-
存儲(chǔ)過程是指存儲(chǔ)在數(shù)據(jù)庫中供所有用戶調(diào)用 的子程序叫存儲(chǔ)過程查看全部
-
dbms 數(shù)據(jù)庫管理系統(tǒng)查看全部
-
存儲(chǔ)過程和存儲(chǔ)函數(shù)的相同點(diǎn):完成特定功能的程序。 區(qū)別:是否用return語句返回值。查看全部
-
如果遇到空值,返回就是空值。查看全部
-
1.存儲(chǔ)過程可以有返回值也可以沒有返回值,但是存儲(chǔ)函數(shù)必須要有存儲(chǔ)函數(shù)查看全部
舉報(bào)
0/150
提交
取消