一个简单的过程

[复制链接]
查看11 | 回复9 | 2014-2-19 11:55:14 | 显示全部楼层 |阅读模式
set serveroutput on
create or replace procedure dwkiller.pageprocedure(pagestart in dwkiller.tc_operator.oper_id%type,
pageend in dwkiller.tc_operator.oper_id%type) as
begin
select rownum,oper_id,oper_name from dwkiller.tc_operator where rownum>=pagestart and rownum复制代码
警告: 创建的过程带有编译错误。
请帮下忙,以上代码有什么问题
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
你不贴出错误信息来么?
首先我要告诉你的是
你的这个语句得不到你想要的结果
select rownum,oper_id,oper_name from dwkiller.tc_operator where rownum>=pagestart and rownum复制代码
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
有收获!


回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
也可以这样写,数据量大时 速度可能快一些
select rn,oper_id,oper_name from
(
select rownum rn,oper_id,oper_name from dwkiller.tc_operator where rownum=pagestart;
另外,创建的过程带有编译错误
可能是你的 rownum 错误使用造成的,rownum 不认大于号,不要想当然!
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
最初由 sdusun 发布
[B]也可以这样写,数据量大时 速度可能快一些
select rn,oper_id,oper_name from
(
select rownum rn,oper_id,oper_name from dwkiller.tc_operator where rownum=pagestart;
另外,创建的过程带有编译错误
可能是你的 rownum 错误使用造成的,rownum 不认大于号,不要想当然! [/B]

嗯,这样写效率更高一些哈
ps:编译错误原因不在rownum使用不当,而是select没有into
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
谢谢各位,今天晚上回去试下。另外 我只有这个错误信息,没有别的了~~~~~~
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
sqlplus下用show err查看具体错误信息
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
我 家的pl/sql不知道怎么回事用不了了,重装也用不了了
另外我就写一个最简单的select * from tc_operator
都抱错
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
sqlplus就可以啊。。。
回复

使用道具 举报

千问 | 2014-2-19 11:55:14 | 显示全部楼层
另外我就写一个最简单的 select * from tc_operator
都抱错

setserveroutput on
create or replace procedure dwkiller.pagep(
startpage in dwkiller.tc_operator.oper_id%type,
endpage in dwkiller.tc_operator.oper_id%type
)
as
begin
select * from dwkiller.tc_operator;
end;
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行