怎么文章内容都显示不全的?
问题是
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
请问能这样插入的吗?

解决方案 »

  1.   

    sigh.....我用的是Oracle 8.0.5那就更不行了?
      

  2.   

    不知道有没有好的解决方法?我有一个赋好值得%ROWTYPE,如何在insert 中使用?有知道的吗?
      

  3.   

    A %ROWTYPE declaration cannot include an initialization clause. However, there are
    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
      

  4.   

    在9i下可以用以下语句,但在8i下出错:
    v_record  tbl_base%ROWTYPE;
    insert into tbl_base values v_record;
    应该是8i没有此功能