declare
table2 table1%rowtype;
begin
select * into table2 from (select * from table1 group by field1,field2);
.....
end;
table2 table1%rowtype;
begin
select * into table2 from (select * from table1 group by field1,field2);
.....
end;
2、select必须要查询出一条记录,如果多于一条,则出现too_mang_rows错误,如果没有查询到记录,则返回no_data_found错误。例子:DECLARE
v_field1 table2.field1%TYPE;
v_field2 table2.field2%TYPE;
BEGIN
SELECT field1,fiedl2 INTO v_field1,v_field2
FROM table2
WHERE ROWNUM=1;
EXCEPTION WHEN no_data_found THEN
v_field1=null;
v_field2=null;
END;
/