展开全部
|
CREATE OR REPLACE PROCEDURE select_emp
(v_emp_no IN emp.empno%type)
IS
v_emp_name emp.ename%type;
v_dept_name dept.dname%type;
BEGIN
SELECT EMP.ENAME,DEPT.DNAME
INTO v_emp_name, v_dept_name
FROM EMP,DEPT
WHERE EMP.DEPTNO=DEPT.DEPTNO AND EMPNO = v_emp_no;
DBMS_OUTPUT.PUT_LINE(v_emp_name||e68a8462616964757a686964616f31333365643536' '||v_dept_name);
END select_emp;
/
EXECUTE select_emp(7654);
CREATE OR REPLACE TRIGGER update_dept_to_emp
AFTER UPDATE ON DEPT FOR EACH ROW
BEGIN
IF UPDATING
THEN
UPDATE EMP SET DEPTNO = :new.DEPTNO
WHERE DEPTNO=:old.DEPTNO;
END IF;
END update_dept_to_emp;
/