日期:2014-05-17  浏览次数:20811 次

请问,如何调用带输入参数的过程
create or replace
procedure upall (ddatet String,o11 float,t11 float,o12 float,t12 float,c1 number,c2 number)
is
begin
  update bank set combank=o11,gobank=t11 where com=101 and ddate=to_date(ddatet,'yyyy-mm-dd');
  update bank set combank=o12,gobank=t12 where com=102 and ddate=to_date(ddatet,'yyyy-mm-dd');
end;

call upall to_date('2012-01-02','yyyy-mm-dd') 1.1 1.1 2.1 2.1 101 101
1\请问如何在控制台来调用这个存储过程,我好想方式写错个
2\如何调用带返回结果集的过程
create or replace
package mypackage as
type test_cursor is ref cursor;
end mypackage;

create or replace
procedure myprocedure (p_cursor out mypackage.test_cursor ) is
begin
 open p_cursor for select * from test;
end;

call myprocedure

错误提示SQL 错误: ORA-06576: 不是有效的函数或过程名

------解决方案--------------------
SQL code

create or replace package mypackage as
  type test_cursor is ref cursor;
end mypackage;

create or replace
procedure myprocedure (p_cursor out mypackage.test_cursor ) is
begin
 open p_cursor for select * from emp;
end;

declare
  cur_emp mypackage.test_cursor;
  v_emp   emp%rowtype;
begin
  myprocedure(cur_emp);
  loop
    fetch cur_emp
      into v_emp;
    exit when cur_emp%notfound;
    dbms_output.put_line(v_emp.ename);
  end loop;
  close cur_emp;
end

SMIT H1
ALLE N
WARD 
JONE S
MART IN
BLAK E
CLAR K
SCOT T
KING 
TURN ER
ADAM S
JAME S
FORD 
MILL ER
 
PL/SQL procedure successfully completed
 ;