1.%TYPE
DECLARE DNAME DEPT.DNAME%TYPE; --动态的定义变量的类型,跟随着dept表中dname字段的类型变化而变化滴呀 BEGIN SELECT DNAME INTO DNAME FROM DEPT WHERE DEPTNO=50; DBMS_OUTPUT.PUT_LINE(DNAME); END;
2.%ROWTYPE
DECLARE V_ROW DEPT%ROWTYPE; --和dept表中的每一列数据类型都相同滴呀 BEGIN SELECT * INTO V_ROW FROM DEPT WHERE DEPTNO=50; DBMS_OUTPUT.PUT_LINE(V_ROW.DNAME); END;
可以用在游标和我们的表中滴呀;
v_row1 表%rowtype;
v_row2 游标%rowtype;