编写PLSQL语句

编写PLSQL语句,第1张

CREATE OR REPLACE PROCEDURE get_dept (p_deptno IN VARCHAR2, p_dname OUT VARCHAR2, p_loc OUT VARCHAR2)

IS

l_rate NUMBER

BEGIN

BEGIN

SELECT dname, loc

INTO p_dname, p_loc

FROM scott.dept

WHERE deptno = p_deptno

EXCEPTION

WHEN NO_DATA_FOUND

THEN

p_dname := NULL

p_loc := NULL

DBMS_OUTPUT.put_line ('该部门不存在')

END

CASE

WHEN p_deptno = '10'

THEN

l_rate := 0.1

WHEN p_deptno = '20'

THEN

l_rate := 0.08

WHEN p_deptno = '30'

THEN

l_rate := 0.05

ELSE

l_rate := 0.03

END CASE

UPDATE scott.emp

SET sal = sal * l_rate

WHERE deptno = p_deptno

END

declare

v_count number := 1

v_sumnumber := 0

begin

for v_count in 1..100

loop

if mod(v_count,2) = 0 then

v_sum := v_sum + v_count

end if

end loop

dbms_output.put_line(v_sum)

end


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/8178690.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-14
下一篇 2023-04-14

发表评论

登录后才能评论

评论列表(0条)

保存