-
create or replace procedure queryinform(eno in number, pename out varchar2, psal out number, pjob out varchar2) as begin select ename,sal,job into pename,psal,pjob from emp where empno=eno; end;查看全部
-
set linesize 200查看全部
-
create or replace function queryempincome(eno in number) return number as psal emp.sal%type; pcomm emp.comm%type; begin select sal ,comm into pasl,pcomm from emp where empno=eno; return psal*12+pcomm; end;查看全部
-
sqlplus / as sysdba show user grant to scott;查看全部
-
d: sqlplus scott/tiger@192.168.1.50:1521/ORACLZHENG host cls set serveroutput on exec sayhello(); begin sayhello; sayhello; end;查看全部
-
create or replace procedure sayhello as begin dbms_output.put_line('hello world'); end; excu sayhello(); begin查看全部
-
create or replace procedure raisesal(eno in number) as psal emp.sal%type; begin select sal into psal from emp where empno=eno; update emp set sal=sal+100 where empno=eno; dbms_output.put_line('漲前:'||pasl||'漲后:'(psal+100)); end; begin raisesal(7026); raisesal(5555); commit; end;查看全部
-
看看查看全部
-
存儲過程可以通過return返回查看全部
-
調(diào)用存儲過程查看全部
-
存儲過程和存儲函數(shù):指存儲在數(shù)據(jù)庫中提供所有用戶程序調(diào)用的子程序叫存儲過程、存儲函數(shù)。 相同點:完成特定功能的程序。 區(qū)別:是否用return語句返回值。查看全部
-
一般不再存儲過程或存儲函數(shù)中提交或回滾(可以這么做但是通常不這樣),而是在調(diào)用處做查看全部
-
可以學習查看全部
-
Junit-java查看全部
-
存儲過程和存儲函數(shù)定義:指存儲在數(shù)據(jù)庫中供所有用戶程序調(diào)用的子程序叫做存儲過程、存儲函數(shù)。 相同點:完成特定功能的程序。 區(qū)別:是否用return語句返回值。 語法: create [or replace] procedure 過程名(參數(shù)列表) as plsql程序體 create or replace procedure sayhelloworld as --說明部分 begin dbms_output.put_line('Hello World'); end; 調(diào)用存儲過程: 1.exec sayhelloworld(); 2.begin sayhelloworld(); sayhelloworld(); end; 1 exec 存儲過程名();2 begin 存儲過程名();end / 創(chuàng)建帶參數(shù)的存儲過程: -- 給指定的員工漲100塊錢的工資,并且打印漲前后漲后的薪水 eno:員工號 create or replace procedure raisesalary(eno in number) -- in 這是一個輸入?yún)?shù) as -- 定義一個變量保存漲前的薪水 psal emp.sal%type; begin -- 得到員工漲前的薪水 select sal into psal from emp where empno=eno; -- 給該員工漲100塊錢 update emp set sal=sal+100 where empno=eno; -- 一般,這里不需要 commit ! 也不需要 rollback -- 注意:一般不在存儲過程或者存儲函數(shù)中,commit 和 rollback -- 打印 dbms_output.put_line('漲前:'||psal||',漲后:'||(psal+100)); end; / -- 調(diào)用: begin raisesalary(7839); raisesalary(7566); end; / 一般不在存儲過程中提交或者回滾,大多時間是在調(diào)用一次或者多次的時候提交或者回滾,這樣會防止出現(xiàn)意外情況。查看全部
舉報
0/150
提交
取消