这个存储过程有什么问题呢

xiedi1209 2010-09-29 04:31:41

create or replace package testproc2
is type type2 is ref cursor;
procedure proc2(usercode in number,userlist out type2);
end testproc2;

Create or replace package body testproc2
procedure proc2(usercode in number,userlist out type2)
as
begin
open userlist for
select * from lduser where rownum <= usercode;
end proc2;
end testproc2;

...全文
157 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
minitoy 2010-09-29
  • 打赏
  • 举报
回复
你不会是放一起编译的吧.先编译包头,再编译包体.[Quote=引用 3 楼 xiedi1209 的回复:]
Compilation errors for PACKAGE EAPP.TESTPROC2

Error: PLS-00103: 出现符号 "CREATE"
Line: 6
Text: Create or replace package body testproc2 is

加上之前和之后 都提示我这个 不知道原因
[/Quote]
心中的彩虹 2010-09-29
  • 打赏
  • 举报
回复
[Quote=引用楼主 xiedi1209 的回复:]
SQL code

create or replace package testproc2
is type type2 is ref cursor;
procedure proc2(usercode in number,userlist out type2);
end testproc2;

Create or replace package body testproc2
proc……
[/Quote]
--先有包头 在有包体 不可没包体但决定不能没包头
create or replace package testproc2
is type type2 is ref cursor;
procedure proc2(usercode in number,userlist out type2);
end testproc2;

/

Create or replace package body testproc2 as
procedure proc2(usercode in number,userlist out type2)
as
begin
open userlist for
select * from lduser where rownum <= usercode;
end proc2;
end testproc2;







gelyon 2010-09-29
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 xiedi1209 的回复:]

Compilation errors for PACKAGE EAPP.TESTPROC2

Error: PLS-00103: 出现符号 "CREATE"
Line: 6
Text: Create or replace package body testproc2 is

加上之前和之后 都提示我这个 不知道原因
[/Quote]

这样,你第一个packeage执行后 要加一个“/”
即:
create or replace package testproc2
is type type2 is ref cursor;
procedure proc2(usercode in number,userlist out type2);
end testproc2;
/

Create or replace package body testproc2 is
procedure proc2(usercode in number,userlist out type2)
as
begin
open userlist for
select * from lduser where rownum <= usercode;
end proc2;
end testproc2;
crazylaa 2010-09-29
  • 打赏
  • 举报
回复
就是查一段数据。条件是<=usercode的行数(rownum伪列)
gelyon 2010-09-29
  • 打赏
  • 举报
回复
少了个is 吧

Create or replace package body testproc2 is
。。。。
。。。
xiedi1209 2010-09-29
  • 打赏
  • 举报
回复
Compilation errors for PACKAGE EAPP.TESTPROC2

Error: PLS-00103: 出现符号 "CREATE"
Line: 6
Text: Create or replace package body testproc2 is

加上之前和之后 都提示我这个 不知道原因
minitoy 2010-09-29
  • 打赏
  • 举报
回复
没大问题.Create or replace package body testproc2后面少了个is.
写as也可以.
minitoy 2010-09-29
  • 打赏
  • 举报
回复
create or replace package testproc2
is type type2 is ref cursor;
procedure proc2(usercode in number,userlist out type2);
end testproc2;

Create or replace package body testproc2 is
procedure proc2(usercode in number,userlist out type2)
as
begin
open userlist for
select * from lduser where rownum <= usercode;
end proc2;
end testproc2;

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧