Hi Mike,
I dont know what the problem is from looking at it but heres a suggestion to find the problem:
CREATE TABLE SQLDEBUG (x VARCHAR2(4000));
CREATE OR REPLACE PACKAGE BODY Get_Emp_Combo_List AS
Procedure ReturnEmpComboList(
pnEmpHireNo IN NUMERIC,
pnTypeNo IN NUMERIC,
pdCurrDate IN EMP.OUT_DT%TYPE,
pCursor OUT RetCursor)
IS
lcWhereString VARCHAR2(150);
BEGIN
-- The user wants ALL employees
IF pnEmpHireNo = 1 THEN
lcWhereString := '';
-- The user wants only ACTIVE employees
ELSIF pnEmpHireNo = 2 THEN
lcWhereString := ' AND (EMP.OUT_DT IS NULL OR EMP.OUT_DT >= pdCurrDate) ';
-- The user wants only FORMER employees
ELSIF pnEmpHireNo = 3 THEN
lcWhereString := ' AND (EMP.OUT_DT IS NOT NULL AND EMP.OUT_DT < pdCurrDate) ';
-- The user wants only Current & Former who worked in last 2 weeks.
ELSE
lcWhereString := ' AND (EMP.OUT_DT IS NULL OR EMP.OUT_DT > pdCurrDate) ';
END IF;
-- The user wants Unionized Shop employees.
IF pnTypeNo = 1 THEN
lcWhereString := lcWhereString || ' AND EMP.HRS_BASE = 1 AND EMP.UNION_EMP = 1 ';
-- The user wants NON-Unionized Shop employees.
ELSIF pnTypeNo = 2 THEN
lcWhereString := lcWhereString || ' AND EMP.HRS_BASE = 1 AND EMP.UNION_EMP = 0 ';
-- The user wants Office employees.
ELSE
lcWhereString := lcWhereString || ' AND EMP.HRS_BASE = 0 ';
END IF;
insert into sqldebug values( 'SELECT RTRIM(PERS.LAST_NAME) ||' || ''', ''' || '|| RTRIM(PERS.FIRST_NAME) AS EMP_NAME,' ||
' PERS.PERS_NO ' ||
'FROM EMP,' ||
' PERS ' ||
'WHERE EMP.PERS_NO = PERS.PERS_NO ' || lcWhereString ||
'ORDER BY 1' );
End;
END;
/
Then after you run it check the table sqldebug:
select * from sqldebug;
Inside there you get the sql statement.
Copy and paste the sqlstatement and try to run it. I think you'll quickly see the problem.
Usually the above error means that one of the column names does not exist in the table so maybe you misspelled a column name or refered to the wrong table.
HTH
Tim
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only