1.首先创建包头:
create or replace package pa_test_cursor is
-- Author : ADMINISTRATOR
-- Created : 2012-8-30 下午 02:52:24
-- Purpose :
-- Public type declarations
function getCall return varchar2;
procedure caculateCallFee(cur_in_call in sms_temp%rowtype,result out varchar );
end pa_test_cursor;
2.然后是包体
create or replace package body pa_test_cursor is
-- Function and procedure implementations
function getCall return varchar2 is
temp_cur sms_temp%rowtype;
result varchar2(20);
cursor cur_sms_temp is
select * from SMS_TEMP;
begin
open cur_sms_temp;
fetch cur_sms_temp into temp_cur;
while cur_sms_temp%found
loop
caculateCallFee(temp_cur,result);
fetch cur_sms_temp into temp_cur;
result:='success';
end loop;
close cur_sms_temp;
return result;
end;
procedure caculateCallFee(cur_in_call in sms_temp%rowtype,result out varchar )
is
begin
dbms_output.put_line(cur_in_call.id||';'||cur_in_call.msg_content);
end;
end pa_test_cursor;