,Oracle报存储过程编译异常
求助,Oracle报存储过程编译错误
创建时时是对着书上的例子来写的,对了好几次。没看出什么问题来。求助各位大神。
代码如下:
1 create or replace procedure sele_emp
2 (
3 v_id in emo.empno%type;
4 v_sal out emo.sal%type;
5 )
6 as
7 begin
8 select sal into v_sal from emp where empno=v_id;
9 end;
10 declare
11 v1 emp.sal%type;
12 begin
13 sele_emp(7788,v1);
14 dbms_output.put_line('所得税金额':||v1);
15* end;
16 /
警告: 创建的过程带有编译错误。
QL> create or replace procedure last1_emp(id number,on_flag out number)
2 is
3 begin
4 select comm into on_flag from emp where empno=id;
5 end;
6 declare
7 v1 emp.comm%type;
8 begin
9
10 last1_emp(7566,v1);
11 dbms_output.put_line('工资级别:'||v1);
12 end;
13 /
警告: 创建的过程带有编译错误。
------解决方案--------------------
你贴的语句要分为两部分执行。
到第一个end结束为存储过程。
declare到end为对存储过程的测试过程。。
建议先在sql窗口创建存储过程。
再在测试窗口测试存储过程。
------解决方案--------------------
先创建存储过程,SCOTT为用户。
create or replace procedure sele_emp(v_id in scott.emp.empno%type,
v_sal out scott.emp.sal%type) as
begin
select sal into v_sal from scott.emp where empno = v_id;
end;
调用存储过程:
declare
v1 scott.emp.sal%type;
begin
sele_emp(7788,v1);
dbms_output.put_line('所得税金额:'
------解决方案--------------------
v1);
end;
create or replace procedure last1_emp(id number, on_flag out number) is
begin
select comm into on_flag from scott.emp where empno = id;
end;
declare
v1 scott.emp.comm%type;
begin
last1_emp(7566, v1);
dbms_output.put_line('工资级别:'
------解决方案--------------------
v1);
end;
/
创建时时是对着书上的例子来写的,对了好几次。没看出什么问题来。求助各位大神。
代码如下:
1 create or replace procedure sele_emp
2 (
3 v_id in emo.empno%type;
4 v_sal out emo.sal%type;
5 )
6 as
7 begin
8 select sal into v_sal from emp where empno=v_id;
9 end;
10 declare
11 v1 emp.sal%type;
12 begin
13 sele_emp(7788,v1);
14 dbms_output.put_line('所得税金额':||v1);
15* end;
16 /
警告: 创建的过程带有编译错误。
QL> create or replace procedure last1_emp(id number,on_flag out number)
2 is
3 begin
4 select comm into on_flag from emp where empno=id;
5 end;
6 declare
7 v1 emp.comm%type;
8 begin
9
10 last1_emp(7566,v1);
11 dbms_output.put_line('工资级别:'||v1);
12 end;
13 /
警告: 创建的过程带有编译错误。
------解决方案--------------------
你贴的语句要分为两部分执行。
到第一个end结束为存储过程。
declare到end为对存储过程的测试过程。。
建议先在sql窗口创建存储过程。
再在测试窗口测试存储过程。
------解决方案--------------------
先创建存储过程,SCOTT为用户。
create or replace procedure sele_emp(v_id in scott.emp.empno%type,
v_sal out scott.emp.sal%type) as
begin
select sal into v_sal from scott.emp where empno = v_id;
end;
调用存储过程:
declare
v1 scott.emp.sal%type;
begin
sele_emp(7788,v1);
dbms_output.put_line('所得税金额:'
------解决方案--------------------
v1);
end;
create or replace procedure last1_emp(id number, on_flag out number) is
begin
select comm into on_flag from scott.emp where empno = id;
end;
declare
v1 scott.emp.comm%type;
begin
last1_emp(7566, v1);
dbms_output.put_line('工资级别:'
------解决方案--------------------
v1);
end;
/