How to use %ROWTYPE when inserting into Oracle table with identity column?
问题 I have an Oracle 12c database with a table containing an identity column: CREATE TABLE foo ( id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, bar NUMBER ) Now I want to insert into the table using PL/SQL. Since in practice the table has many columns, I use %ROWTYPE : DECLARE x foo%ROWTYPE; BEGIN x.bar := 3; INSERT INTO foo VALUES x; END; However, it give me this error: ORA-32795: cannot insert into a generated always identity column ORA-06512: at line 5 Since it is very good for code