我编写了以下存储过程来检索要发送到我的 C# 应用程序的 DataSet 的数据。
您能否为我的存储过程建议一个更健壮的设计?我假设这不是返回记录集的最佳方式。
CREATE OR REPLACE PROCEDURE GET_EMPLOYEE_DATA
(
EMPLOYEE_EMAIL IN VARCHAR2,
EMP_RECORD_SET1 OUT SYS_REFCURSOR,
EMP_RECORD_SET2 OUT SYS_REFCURSOR,
EMP_RECORD_SET3 OUT SYS_REFCURSOR,
EMP_RECORD_SET4 OUT SYS_REFCURSOR
) AS
BEGIN
OPEN EMP_RECORD_SET1 FOR
SELECT EMPLOYEENAME AS EMP_NAME,
EMPLOYEELASTNAME AS EMP_LAST_NAME,
EMPLOYEEFIRSTNAME AS EMP_FIRST_NAME
FROM EMP.EMPLOYEES
WHERE EMP_EMAIL = EMPLOYEE_EMAIL
;
OPEN EMP_RECORD_SET2 FOR
SELECT EMPLOYEEADD AS EMP_ADDRESSESS,
EMPLOYEECITY AS EMP_CITY,
EMPLOYEE_STATE AS EMP_STATE
FROM EMP.EMPLOYEES_ADDRESSES
WHERE EMP_EMAIL = EMPLOYEE_EMAIL;
OPEN EMP_RECORD_SET3 FOR
SELECT EMPLOYEEPHONE AS EMP_PHONE,
EMPLOYEEEXTENSION AS EMP_EXTENSION
FROM EMP.EMPLOYEES_CONTACTS
WHERE EMP_EMAIL = EMPLOYEE_EMAIL
;
OPEN EMP_RECORD_SET4 FOR
SELECT EMPLOYEEJOB AS EMP_JOB,
EMPLOYEERESPONSIBILITIES AS EMP_RESPONSIBILITIES
FROM EMP.EMPLOYEES_DATA
WHERE EMP_EMAIL = EMPLOYEE_EMAIL
;
END GET_PROTOCOL_INFO_SP;
我需要知道我的语法是否正确以及是否应该关闭游标。我有 4 个不同的表,在应用程序中调用数据。