Mega Code Archive

 
Categories / Oracle PLSQL / PL SQL
 

This block shows legal and illegal record assignments

SQL> SQL> DECLARE   2    TYPE t_Rec1Type IS RECORD (   3      Field1 NUMBER,   4      Field2 VARCHAR2(5));   5    TYPE t_Rec2Type IS RECORD (   6      Field1 NUMBER,   7      Field2 VARCHAR2(5));   8    v_Rec1 t_Rec1Type;   9    v_Rec2 t_Rec2Type;  10  BEGIN  11    v_Rec1 := v_Rec2;  12  13    v_Rec1.Field1 := v_Rec2.Field1;  14    v_Rec2.Field2 := v_Rec2.Field2;  15  END;  16  /   v_Rec1 := v_Rec2;             * ERROR at line 11: ORA-06550: line 11, column 13: PLS-00382: expression is of wrong type ORA-06550: line 11, column 3: PL/SQL: Statement ignored SQL> SQL>