Hi,
I am starting to get into pl/sql programing (version 11.2.0.4.0). I currently just create/execute queries and small scripts to collect data for reporting. I have written a couple of packages, but, have a few questions about where to declare variables.
I am currently trying to modify an existing package and trying to figure out the parameters / variable declarations.
The spec is for this package is:
CREATE OR REPLACE PACKAGE COUPI_OM_OKS_WF_DETAILS_PKG AS
PROCEDURE OM_OKS_DETAILS (
P_ERRBUF OUT VARCHAR2,
P_RETCODE OUT VARCHAR2,
P_MODE IN VARCHAR2);
PROCEDURE UPDATE_EXT_TABLE (
P_RET_CODE OUT VARCHAR2);
END COUPI_OM_OKS_WF_DETAILS_PKG;
/
P_MODE comes from a parameter when you start the package manually. You can't modify its default value and its a date.
In the body, there are these procedures:
PROCEDURE OM_OKS_DETAILS (
P_ERRBUF OUT VARCHAR2,
P_RETCODE OUT VARCHAR2,
P_MODE IN VARCHAR2,
P_DATE_FROM IN VARCHAR2)
IS...
and this one
PROCEDURE UPDATE_EXT_TABLE (
P_DATE_FROM IN DATE,
P_RET_CODE OUT VARCHAR2)
IS...
I see that P_MODE, P_RETCODE AND P_RET_CODE are in the spec and in the body. Also, P_MODE comes from the parameter screen (when you start the package and you can set the values to either FULL or UPDATE), which makes it look like the way to pass values from the parameter screen to the procedures is to define in the spec, right?
However, P_DATE_FROM is not in the spec, but, the value comes from a parameter (when you start the package). You can't change it.
- Why is P_MODE in the spec and not P_DATE_FROM?
- Don’t variables passed from the parameter screen need to be in the spec?
- Looks like it is ok to define the same variable (P_DATE_FROM) as both a varchar2 and then later as a date. This seems odd to me, why not leave it one way or the other?
thanks for your feedback and best regards
Alan