用oracle 9i中创建一个过程do_commissions用pl/sql developer工具的命令窗口执行 EXECUTE do_commissions系统输出如下错误,请问为什么?多谢SQL> execute do_commissions;
begin do_commissions; end;
ORA-06550: 第 2 行, 第 7 列:
PLS-00905: 对象 SYSTEM.DO_COMMISSIONS 无效
ORA-06550: 第 2 行, 第 7 列:
PL/SQL: Statement ignored
begin do_commissions; end;
ORA-06550: 第 2 行, 第 7 列:
PLS-00905: 对象 SYSTEM.DO_COMMISSIONS 无效
ORA-06550: 第 2 行, 第 7 列:
PL/SQL: Statement ignored
解决方案 »
- select 2>1 from dual 报错
- oracle,查询的时候遇到的诡异问题
- ORACLE如何判断列里面值的长度
- 一个简单的SQL查询语句,但是……请各位大虾帮帮俺,谢谢。
- oracle中 数据库实例不可用 怎么解决
- package 如何定义游标,package body 怎么使用游标,package 是否可以接受日期型的输入参数
- Report乱码问题
- Oracle一张表最多能容纳多少行?
- 怎么在oracle中一次只查询30条记录。40分求助!
- 怎样让一个用户能够访问另外一个用户的数据?
- VB oracle ORA-00936 :missing expression
- 求语句,在线等......
-- something
end do_commissions;
execute do_commission;
会自动转换成begin
-- something
end do_commissions;
形式的;
下面是执行结果,还是不行
************************
SQL> begin
2 do_commissions;
3 end;
4 /
begin
do_commissions;
end;
ORA-06550: 第 3 行, 第 1 列:
PLS-00905: 对象 SYSTEM.DO_COMMISSIONS 无效
ORA-06550: 第 3 行, 第 1 列:
PL/SQL: Statement ignored
***********************
我不明白为什么会在do_commissions前面加了一个system作用域?
“
PLS-00905: 对象 SYSTEM.DO_COMMISSIONS 无效
”
创建do_commissions的过程头说明如下:
create or replace procedure do_commissions is *******
因为我在定义过程的文件的前面写了一个定义table的sql语句,把这段sql语句移到单独的*.sql中在重新编译过程,执行就通过了我是新手,不知道在命令窗口执行的输出的内容应该在哪个窗口?
过程定义如下:
*********************************
create or replace procedure do_commissions is commission_rate number :=2;
total_sale number :=0;
current_person varchar2(3):='';
next_person varchar2(3);
quantity_sold number :=0;
item_price number :=0;
cursor sales_cur is
select *
from test_pro
order by salesperson;
begin open sales_cur;
loop
fetch sales_cur into
next_person,quantity_sold,item_price;
while(next_person=current_person and sales_cur%found)
loop
total_sale :=total_sale+(quantity_sold*item_price);
fetch sales_cur into
next_person,quantity_sold,item_price;
end loop;
if (sales_cur%found)
then
if(current_person=next_person)
then
if(current_person!='') then dbms_output.put_line(current_person ||''||total_sale
||''||total_sale*commission_rate/100);
end if;
total_sale :=quantity_sold*item_price;
current_person :=next_person;
end if;
else if (current_person !='')
then
dbms_output.put_line(current_person ||''||total_sale
||''||total_sale*commission_rate/100);
end if;
end if;
exit when sales_cur%notfound;
end loop;
close sales_cur;
end do_commissions;
*************************************************表的定义如下:
*************************************************
drop table test_pro;
create table test_pro(salesperson varchar2(3),quantity number,product_price number);insert into test_pro (salesperson,quantity,product_price)
values('a',1,2);
insert into test_pro (salesperson,quantity,product_price)
values('b',2,3);
insert into test_pro (salesperson,quantity,product_price)
values('c',1,2);
insert into test_pro (salesperson,quantity,product_price)
values('a',4,2);
insert into test_pro (salesperson,quantity,product_price)
values('a',6,7);
insert into test_pro (salesperson,quantity,product_price)
values('a',8,9);
***********************************************************
命令窗口执行如下:
SQL> execute do_commissions;
PL/SQL procedure successfully completed
SQL>
***********************************************************
请问
如下语句的输出应该在哪里看到?多谢dbms_output.put_line(current_person ||''||total_sale
||''||total_sale*commission_rate/100);