问个容易的存储过程

问个简单的存储过程
create  procedure my_test is
   begin 
     select * from  A where rownum<=11;
   end;



exec my_test;为什么报错  invalid sql statement
------解决方案--------------------
pl/sql中语法不是这样的
select 要与into 配对使用,并且select的记录必须是1条记录

如果select的结果需要是多条的话,需要使用游标来实现

------解决方案--------------------
过程里的select 缺少into语句。查询出来的数据要存到变量。
不然不可能由过程查询出来返回
create  procedure my_test is
    v_conunt number;
    begin 
      select count(*) into v_conunt  from  A where rownum<=11;
    dbms_output.put_line(v_conunt);
    end;
------解决方案--------------------
pl/sql中的语法应该是这样的
select c1 , c2 , c3 into v1 , v2 , v3 from table where c = xxx;
需要将select出来的字段放入变量中,且须保证仅返回一条,否则会出现异常。

如果你需要返回多行,可以定义一个游标,还是建议楼主找点PL/SQL的入门资料系统的学习一下。