Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create flexable package
Message
From
24/09/2004 04:27:39
 
 
To
23/09/2004 11:29:53
General information
Forum:
Oracle
Category:
Packages
Miscellaneous
Thread ID:
00940366
Message ID:
00945640
Views:
26
This message has been marked as a message which has helped to the initial question of the thread.
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
Map
View

Click here to load this message in the networking platform