|
|
发表于 2006/11/17 17:40:08
|
显示全部楼层
一个独力运行的存储过程和一个请求的存储过程是有区别的,请注意红色部分的区别。
errbuf OUT VARCHAR2, retcode OUT NUMBER这两个参数一定要有。
- create or replace package cux_other01_report is
- -- Author : Wanjun Hu
- -- Created : 2004-7-9 下午 01:44:57
- -- Purpose : other01 用户,职责表
- procedure do(errbuf OUT VARCHAR2, retcode OUT NUMBER);
- end cux_other01_report;
- /
- create or replace package body cux_other01_report is
- cursor cursor_user_role is
- select c.user_name as login_name,
- d.full_name as employee_name,
- f.name as department_name,
- a.user_id as user_id,
- a.responsibility_id as responsibility_id,
- b.RESPONSIBILITY_NAME as RESPONSIBILITY_NAME
- from FND_USER_RESP_GROUPS a,
- FND_RESPONSIBILITY_VL b,
- fnd_user c,
- hr_employees d,
- per_assignments_f e,
- hr_all_organization_units_tl f
- where a.user_id = c.user_id
- and c.employee_id = d.employee_id
- and c.employee_id = e.PERSON_ID
- and e.ORGANIZATION_ID = f.organization_id
- and a.responsibility_id = b.RESPONSIBILITY_ID
- and sysdate > e.EFFECTIVE_START_DATE
- and sysdate < e.EFFECTIVE_END_DATE
- order by c.description, c.user_name, a.responsibility_id
-
- ;
- -- Author : Wanjun Hu
- -- Created : 2004-8-24 下午 01:47:23
- -- Purpose : 在控制台输出和在报表中输出
- procedure print(content varchar2) is
- begin
- dbms_output.put_line(content);
- fnd_file.put_line(fnd_file.output, content);
- end print;
- procedure do(errbuf OUT VARCHAR2, retcode OUT NUMBER) is
- p_row_cursor_user_role cursor_user_role%rowtype;
- begin
-
- open cursor_user_role;
- loop
- --循环
- fetch cursor_user_role
- into p_row_cursor_user_role;
- EXIT WHEN cursor_user_role%NOTFOUND OR cursor_user_role%NOTFOUND IS NULL;
- print(p_row_cursor_user_role.login_name || ',' ||
- replace(p_row_cursor_user_role.employee_name, ',', '') || ',' ||
- p_row_cursor_user_role.department_name || ',' ||
- p_row_cursor_user_role.user_id || ',' ||
- p_row_cursor_user_role.responsibility_id || ',' ||
- p_row_cursor_user_role.RESPONSIBILITY_NAME);
-
- end loop;
-
- close cursor_user_role;
-
- end do;
- end cux_other01_report;
- /
-
复制代码 |
|