|
|
|
Re: how to call package using persistant package variable [message #609714 is a reply to message #609684] |
Tue, 11 March 2014 07:57 |
Solomon Yakobson
Messages: 3273 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
And now in plain english - what's the problem? You don't want "static approach"? So why did you create globval package variable? Get rid of it alnog with default FooLib.empNo and the only way would be passing empno directly. However, keep in mind package scope is session, so that "static approach" affects just current session. Also, talking about following standards, you have getter but no setter. You should make empNo private and create SetEmpno procedure.
SY.
|
|
|
|
|
|
Re: how to call package using persistant package variable [message #609793 is a reply to message #609774] |
Wed, 12 March 2014 06:59 |
Solomon Yakobson
Messages: 3273 Registered: January 2010 Location: Connecticut, USA
|
Senior Member |
|
|
vslabs wrote on Wed, 12 March 2014 04:51Hijack?
Downloaded, and had a look, at the sample code attachment, spotted the lonely and unused static, and extrapolated from, given the OP's subject, what the OP was actually asking.
Or did I rub my crystal ball too hard?
Downloaded what? This is attachment from OP's post:
CREATE OR REPLACE PACKAGE update_planned_hrs
IS
Planned_hours NUMBER(4);
PROCEDURE set_new_planned (p_emp_id IN NUMBER, p_project_id IN NUMBER, p_hours IN NUMBER);
FUNCTION existing_planned (p_emp_id IN NUMBER, p_project_id IN NUMBER) RETURN NUMBER;
END update_planned_hrs;
/
CREATE OR REPLACE PACKAGE BODY update_planned_hrs
IS
PROCEDURE set_new_planned (p_emp_id IN NUMBER, p_project_id IN NUMBER, p_hours IN NUMBER)
IS
BEGIN
UPDATE employee_on_activity ea
SET ea.ea_planned_hours = p_hours
WHERE
ea.ea_emp_id = p_emp_id
AND ea.ea_proj_id = p_project_id;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR (-20100, 'No such employee or project');
END set_new_planned;
FUNCTION existing_planned (p_emp_id IN NUMBER, p_project_id IN NUMBER) RETURN NUMBER
IS
existing_hours NUMBER(4);
BEGIN
SELECT ea.ea_planned_hours INTO existing_hours
FROM employee_on_activity ea
WHERE
ea.ea_emp_id = p_emp_id
AND ea.ea_proj_id = p_project_id;
RETURN (existing_hours);
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR (-20100, 'No such employee or project');
END existing_planned;
END update_planned_hrs;
So rub your crystal ball harder and try to find any resemblance with what you posted.
SY.
|
|
|
Re: how to call package using persistant package variable [message #609925 is a reply to message #609793] |
Thu, 13 March 2014 23:49 |
|
vslabs
Messages: 26 Registered: March 2014 Location: Cape Town
|
Junior Member |
|
|
What, you do not see the static and unused variable in that code, and associated it with the question "how to call package using persistant package variable"?
The example I posted is thus very specific to how to put that static variable to use, within the context of the thread's topic.
Hijacking? Bullshit.
|
|
|