在 oracle 中的以下代码中出现无效列错误。但是当我分别执行分配给游标的查询时,它工作得很好。请让我知道我在做什么错误:
CREATE OR REPLACE PROCEDURE etl_mergeEmployeeAttendee
(
v_EmployeeNumber IN VARCHAR2 DEFAULT NULL ,
v_AttendeeName OUT NVARCHAR2,
v_EmployeeAttendeeId OUT NUMBER,
v_AttendeeTitle OUT NVARCHAR2,
v_Company OUT NVARCHAR2,
v_Relationship OUT NVARCHAR2,
v_Operation OUT NUMBER,
v_Error OUT NUMBER
)
AS
v_Employee_AttendeeId NUMBER(10,0);
v_Employee_Id NUMBER(10,0);
v_Attendee_Name NVARCHAR2(50);
v_Attendee_Title NVARCHAR2(50);
v_Com_pany NVARCHAR2(50);
v_Relation_ship NVARCHAR2(50);
CURSOR sel_prod_attendee_csr
IS SELECT a.EmployeeAttendeeId ,
a.EmployeeId ,
a.AttendeeName ,
a.AttendeeTitle ,
a.Company ,
a.Relationship
FROM EmployeeAttendee a,
Employee b
WHERE b.EmployeeNumber = v_EmployeeNumber
AND a.EmployeeId = b.EmployeeId;
BEGIN
OPEN sel_prod_attendee_csr;
FETCH sel_prod_attendee_csr INTO
v_Employee_AttendeeId, v_Employee_Id,v_Attendee_Name,v_Attendee_Title,v_Com_pany,v_Relation_ship;
IF sel_prod_attendee_csr%FOUND= true THEN
/* found */
BEGIN
v_Operation := 1 ;
v_AttendeeTitle := v_Attendee_Title ;
v_Company := v_Com_pany ;
v_Relationship := v_Relation_ship ;
v_AttendeeName :=v_Attendee_Name;
END;
ELSE
v_Operation := 2 ;-- Insert
END IF;
CLOSE sel_prod_attendee_csr;
END;