怎么文章内容都显示不全的?
问题是
declare
v_record table1%ROWTYPE;
begin
...
insert into table1 values (v_record);
end;
sql worksheet中编译出错:
125/26 PLS-00382: expression is of wrong type
125/1 PL/SQL: SQL Statement ignored
请问能这样插入的吗?
问题是
declare
v_record table1%ROWTYPE;
begin
...
insert into table1 values (v_record);
end;
sql worksheet中编译出错:
125/26 PLS-00382: expression is of wrong type
125/1 PL/SQL: SQL Statement ignored
请问能这样插入的吗?
two ways to assign values to all fields in a record at once. First, PL/SQL allows
aggregate assignment between entire records if their declarations refer to the same
table or cursor. For example, the following assignment is allowed:
DECLARE
dept_rec1 dept%ROWTYPE;
dept_rec2 dept%ROWTYPE;
CURSOR c1 IS SELECT deptno, dname, loc FROM dept;
dept_rec3 c1%ROWTYPE;
BEGIN
...
dept_rec1 := dept_rec2;
However, because dept_rec2 is based on a table and dept_rec3 is based on a
cursor, the following assignment is not allowed:
dept_rec2 := dept_rec3; -- not allowed
Second, you can assign a list of column values to a record by using the SELECT or
FETCH statement, as the example below shows. The column names must appear in
the order in which they were defined by the CREATE TABLE or CREATE VIEW
statement.
DECLARE
dept_rec dept%ROWTYPE;
...
BEGIN
SELECT * INTO dept_rec FROM dept WHERE deptno = 30;
...
END;
However, you cannot assign a list of column values to a record by using an
assignment statement. So, the following syntax is not allowed:
record_name := (value1, value2, value3, ...); -- not allowed
v_record tbl_base%ROWTYPE;
insert into tbl_base values v_record;
应该是8i没有此功能