Package/procedure/function calls done with in a package
Hi Experts,
Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
It would be great if we can provide a tree like structure of the objects being called/used.
btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
Appreciate your time..
Thanks
Manju
manjukn wrote:
Hi Experts,
Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
It would be great if we can provide a tree like structure of the objects being called/used.
btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
Appreciate your time..What database version do you have?
11g I think provides some sort of fine grained dependency information which can detail packages, but prior to 11g you can only get dependencies on the database objects themselves of which functions/procedures within a package are not, as the package itself is the object.
I don't think there's any easy way to find out from any tables or views and I think third party tools would have to parse the code to determine such things themselves, so that may be one of your only options.
Similar Messages
-
Can Advanced Action functions be done with JS?
Is it possible to use JavaScript to perform Advanced Action functions like "show", "hide", "assign", etc? If so, is there an applicable reference doc?
Thanks,
BobThe SWF JS API does not support show/hide... only assign. HTML5 JS API supports show/hide and assign.
To assign a vairable regardless of Output, you can look at this article:
http://captivatedev.com/2012/12/17/display-the-students-name-from-your-lms-using-adobe-cap tivate-6-x/
If you want to show/hide in HTML5, you can use
cp.hide("ItemNameHere");
cp.show("ItemNameHere"); -
Parameter index move while executing PL/SQL stored procedure/function
Hello, community.
Have a question for you. It looked like very easy to write some small JDBC-wrapper to handle stored procedure/functions call for Oracle.
Here is the code snippet of it:
import java.io.Serializable;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import javax.sql.DataSource;
import oracle.jdbc.driver.OracleTypes;
import org.apache.log4j.Logger;
public class SmallHelper {
public static final int CALL_TYPE__PROCEDURE = 1;
public static final int CALL_TYPE__FUNCTION = 2;
public static final int PARAMETER__IN = 1;
public static final int PARAMETER__OUT = 2;
private static final Logger log = Logger.getLogger(SmallHelper.class);
private Connection con = null;
private CallableStatement statement = null;
private String name;
private int type;
private int resultType;
private HashMap arguments = new HashMap();
* Creates connection using data source as parameter.
* @param ds - data source
* @throws EhlApplicationException
public SmallHelper(DataSource ds) throws Exception {
try {
con = ds.getConnection();
catch (SQLException e) {
ExceptionHelper.process(e);
public void registerProcedure(String name) {
this.name = name;
this.type = CALL_TYPE__PROCEDURE;
public void registerFunction(String name, int resultType) {
this.name = name;
this.resultType = resultType;
this.type = CALL_TYPE__FUNCTION;
* NB! When You're dealing with stored function index should start with number 2!
public void registerArgument(int index, Object value, int type, int inOutType) {
arguments.put(new Long(index), new CallableStatementArgument(value, type, inOutType));
private String getSQL() {
StringBuffer str = new StringBuffer("{ call ");
if ( type == CALL_TYPE__FUNCTION )
str.append(" ? := ");
str.append(name).append("( ");
for ( Iterator i = arguments.values().iterator(); i.hasNext(); ) {
i.next();
str.append("?");
if ( i.hasNext() )
str.append(", ");
str.append(") }");
return str.toString();
public void execute() throws SQLException{
String query = getSQL();
statement = con.prepareCall(query);
if ( type == CALL_TYPE__FUNCTION )
statement.registerOutParameter(1, resultType);
for ( Iterator i = arguments.keySet().iterator(); i.hasNext(); ) {
Long index = (Long) i.next();
CallableStatementArgument argument = (CallableStatementArgument) arguments.get(index);
int type = argument.getType();
if ( argument.getInOutType() == PARAMETER__OUT )
statement.registerOutParameter(index.intValue(), type);
else if ( type != OracleTypes.CURSOR )
statement.setObject(index.intValue(), argument.getValue(), type);
log.info("Executing SQL: "+query);
statement.execute();
public CallableStatement getStatement() {
return statement;
public void close() throws EhlApplicationException {
try {
if (statement != null)
statement.close();
if (con != null)
con.close();
catch (SQLException e) {
EhlSqlExceptionHelper.process(e);
private class CallableStatementArgument implements Serializable{
private Object value;
private int type;
private int inOutType;
public CallableStatementArgument(Object value, int type, int inOutType) {
this.value = value;
this.type = type;
this.inOutType = inOutType;
public int getType() {
return type;
public Object getValue() {
return value;
public int getInOutType() {
return inOutType;
}It was really done in 10-15 mins, so don't be very angry at code quality :)
Here is the problem.:
helper.registerProcedure("pkg_diagnosis.search_diagnosis");
helper.registerArgument(1, null, OracleTypes.CURSOR, EhlJdbcCallableStatementHelper.PARAMETER__OUT);
helper.registerArgument(2, pattern, OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
helper.registerArgument(3, lang, OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
helper.registerArgument(4, EhlSqlUtil.convertSetToString(langs, ","), OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
helper.registerArgument(5, EhlSqlUtil.convertSetToString(diagnosisClass, ","), OracleTypes.VARCHAR, EhlJdbcCallableStatementHelper.PARAMETER__IN);
helper.registerArgument(6, parentId, OracleTypes.NUMBER, EhlJdbcCallableStatementHelper.PARAMETER__IN);
helper.execute();
ResultSet rs = ((OracleCallableStatement) helper.getStatement()).getCursor(1);
procedure definition:
procedure search_diagnosis (l_res OUT dyna_cur,
in_search_string IN VARCHAR2,
in_search_lang IN VARCHAR2,
in_lang_list IN VARCHAR2,
in_diag_class_list IN VARCHAR2,
in_parent_id IN NUMBER) Procedure call has inner check that fail because of som strange reason:
in_search_string has 2 as index, that is correct. but procedure recieves is as number 3 in parameter list (what is in_search_lang). Other parameters are moved to. It seems like a cursor takes 2 places in definition. It's clear that if I put in_search_string as 1 parameter and cursor as 0 I'll get invalid parametr bindong(s) exception. So... any ideas why 2nd parameter is actually 3rd?
Thanks beforehand.hmm...moreover:
if we change procedure to function and call it in a simple way:
CallableStatement stmnt = helper.getConnection().prepareCall("begin ? := pkg_diagnosis.search_diagnosis(?,?,?,?,?); end;");
stmnt.registerOutParameter(1, OracleTypes.CURSOR);
stmnt.setString(2, pattern);
stmnt.setString(3, lang);
stmnt.setString(4, langs);
stmnt.setString(5, diagnosisClass);
stmnt.setObject(6, parentId, OracleTypes.NUMBER);
stmnt.execute();
ResultSet rs = (ResultSet) stmnt.getObject(1);the exception is:
[BEA][Oracle JDBC Driver][Oracle]ORA-06550: line 1, column 14:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredif we return some string or number - it works. but when we want cursor back - it fails.
cursor is defined like ordinary dynamic cursor:
TYPE dyna_cur IS REF CURSOR; -
Intermittent Runtime error - pure virtual function call
I have an intermittent runtime error - pure virtual function call & don't know what cause it? Since It only occurs & crashes once awhile therefore it's difficult to trap it for debugging.I suspect it come from TestStand ActiveX API which I use in my User Interface Application project but I'm not really sure.
Does anyone experience this kind of problem when working with TestStand API ? If so any
suggestion? I have noticed in the TestStand API header file teapi.tlh contain many raw_.... function defined as pure virtual function. What are these raw_... function ? I don't think I use any of these function in my project.
Many thanks!Danh,
I don't believe that your problem can be solved with the information you have provided unless someone else has experienced the same symtpoms which coincidentally have the same cause as in your case.
Is there any other information you can provide that can help localize the problem?
1) What is happening when the error occurs?
2) Does the error always occur in the same place?
3) Does it always occur with use of certain resources (e.g. DAQ, GPIB, VISA, printer)?
4) Does it occur when using the sequence editor?
5) Does it occur when using one of the shipping operator interfaces?
6) Does it occur only when using your operator interfaces?
7)Is it related to a specific sequence or any sequence?
8) Does it happen when you executed your sequence with/without a process model entr
y point (i.e. Execute>>Test UUTs, Execute>>Singal Pass or Execute>>Run MainSequence)?
9) How often does it happen?
10) What version of TestStand are you using?
11) With what language (include versions) are you programming your code modules?
12) With what language (include versions) are you programming your operator interface?
13) Is there any error code reported with this error message?
14) Is this error reported in a TS run-time error dialog or is it reported directly 1by the operating system?
15) Have you searched the web for related errors? For example, the following link describes a particular programming mistake that can lead to this error
http://support.microsoft.com/support/kb/articles/Q125/7/49.asp
By investigating answers to the above questions you may be able to narrow the cause of this error, which might allow you or others to help solve the problem. -
Photoshop CC r6025 pure virtual function call
I recently signed up for Creative Cloud and shortly after that I started to recieve the r6025 pure virtual function call error with PS CC crashing. This will happen with both the x86 and x64 versions of PS CC. It does not happen every time, only about 30%-40% of the time. Usually, but not always, a restart of the program solved the problem.I performed an unstall of PS CC but that did not solve my problem. Prior to switching to Creative Cloud I had no problems whatsoever with PS CS6. This issue started after installing CC and updating PS CS6 to Photoshop CC. I do not think this is a hardware or OS problem but FGOS I an running the following:
OS - Windows 8 Pro x64
RAM - 16GB DDR3
Video - NVIDIA GeForce GT 640 with 2048 MB of VRAM
CPU - Intel Core i7 2600
Plug-ins - onOne, Nik, Imagenomic, Topaz Labs, Alien Skin, Unified Color and a few others. All of these were installed and running fine before the CC switch.
Does anyone have any ideas as this has become very frustrating for me.
ThanksThanks guys. I'll reply to your messages in the above order.
System Log -
For all these photoshop.exe is the faulting application both x86 and 64-bit. I havent seperated them out (x86 vs x64) but casn do that if you want. I mostly use the x86 version of Photoshop simply because a couple of my favorite plug=ins don't work in the 64-bit version.
Faulting modules -
unknown - 2 times
MSVCR100.dll - 9 times
KERNELBASE.dll - 3 times
MultiProcessorService.8BX_unloaded - 1 time
CreativeCloud.exe showed up once as the faulting application and the faulting module was VulcanWrapper.exe.
FGFOS the above are a mix of Photoshop CS6 and Photoshop CC. That came about because I was running PS CS6 when I signed up for Creative Cloud and my version of CS6 was upgraded to the Extended version. About a week ago I uninstalled then reinstalled Photoshop and this time the version was Photoshop CC.
With regard to the plug-ins I use the vendor's installation program. I have a few others that are just an *.8bf file that I copied to Photoshop's plug-in directory. Most, if not all, of this type of plug-in are my oldest plug-ins and are only used with Photoshop x86. I'll move these from Photoshop's plug-in directory first just because they will be the easiest to work with. If I get a crash while they are gone then I'll remove my other plug-ins.
Again, thanks guys I do appreciate this. I've never run into this particular issue before so it a good, albeit frustrating, learning process. -
How to get a called procedure/function name within package?
Hi folks,
is it possible to obtain a called procedure/function name within package?
For a measuring and tracing purpose, I would like to store an info at the beginning of each procedure/function in package with timestamp + additional details if needed.
For example:
CREATE OR REPLACE PACKAGE BODY "TEST_PACKAGE" IS
PROCEDURE proc_1 IS
BEGIN
api_log.trace_data(sysdate, 'START.' || ???????);
api_log.trace_data(sysdate, 'END.' || ???????);
END;
PROCEDURE proc_2 IS
BEGIN
api_log.trace_data(sysdate, 'START.' || ???????);
proc_1;
api_log.trace_data(sysdate, 'END.' || ???????);
END;
END; I would like to replace "???????" with a function which would return a name of called procedure, so result of trace data after calling TEST_PACKAGE.proc_2 would be:
11.1.2013 09:00:01 START.*TEST_PACKAGE.proc_2*
11.1.2013 09:00:01 START.*TEST_PACKAGE.proc_1*
11.1.2013 09:00:01 END.*TEST_PACKAGE.proc_1*
11.1.2013 09:00:01 END.*TEST_PACKAGE.proc_2*I tried to use "dbms_utility.format_call_stack" but it did not return the name of procedure/function.
Many thanks,
Tomas
PS: I don't want to use an hardcodingYou've posted enough to know that you need to provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
is it possible to obtain a called procedure/function name within package?
For a measuring and tracing purpose, I would like to store an info at the beginning of each procedure/function in package with timestamp + additional details if needed.
>
I usually use this method
1. Create a SQL type for logging information
2. Put the package name into a constant in the package spec
3. Add a line to each procedure/function for the name.
Sample package spec
* Constants and package variables
gc_pk_name CONSTANT VARCHAR2(30) := 'PK_TEST';Sample procedure code in package
PROCEDURE P_TEST_INIT
IS
c_proc_name CONSTANT VARCHAR2(80) := 'P_TEST_INIT';
v_log_info TYPE_LOG_INFO := TYPE_LOG_INFO(gc_pk_name, c_proc_name); -- create the log type instance
BEGIN
NULL; -- code goes here
EXCEPTION
WHEN ??? THEN
v_log_info.log_code := SQLCODE; -- add info to the log type
v_log_info.log_message := SQLERRM;
v_log_info.log_time := SYSDATE;
pk_log.p_log_error(v_log_info);
raise;
END P_PK_TEST_INIT;Sample SQL type
DROP TYPE TYPE_LOG_INFO;
CREATE OR REPLACE TYPE TYPE_LOG_INFO AUTHID DEFINER AS OBJECT (
* NAME: TYPE_LOG_INFO
* PURPOSE: Holds info used by PK_LOG package to log errors.
* Using a TYPE instance keeps the procedures and functions
* independent of the logging mechanism.
* If new logging features are needed a SUB TYPE can be derived
* from this base type to add the new functionality without
* breaking any existing code.
* REVISIONS:
* Ver Date Author Description
* 1.00 mm/dd/yyyy me Initial Version.
PACKAGE_NAME VARCHAR2(80),
PROC_NAME VARCHAR2(80),
STEP_NUMBER NUMBER,
LOG_LEVEL VARCHAR2(10),
LOG_CODE NUMBER,
LOG_MESSAGE VARCHAR2(1024),
LOG_TIME TIMESTAMP,
CONSTRUCTOR FUNCTION type_log_info (p_package_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_proc_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_step_number IN NUMBER DEFAULT 1,
p_LOG_level IN VARCHAR2 DEFAULT 'Uninit',
p_LOG_code IN NUMBER DEFAULT -1,
p_LOG_message IN VARCHAR2 DEFAULT 'Uninitialized',
p_LOG_time IN DATE DEFAULT SYSDATE)
RETURN SELF AS RESULT
) NOT FINAL;
DROP TYPE BODY TYPE_LOG_INFO;
CREATE OR REPLACE TYPE BODY TYPE_LOG_INFO IS
CONSTRUCTOR FUNCTION type_log_info (p_package_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_proc_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_step_number IN NUMBER DEFAULT 1,
p_LOG_level IN VARCHAR2 DEFAULT 'Uninit',
p_LOG_code IN NUMBER DEFAULT -1,
p_LOG_message IN VARCHAR2 DEFAULT 'Uninitialized',
p_LOG_time IN DATE DEFAULT SYSDATE)
RETURN SELF AS RESULT IS
BEGIN
self.package_name := p_package_name;
self.proc_name := p_proc_name;
self.step_number := p_step_number;
self.LOG_level := p_LOG_level;
self.LOG_code := p_LOG_code;
self.LOG_message := p_LOG_message;
self.LOG_time := p_LOG_time;
RETURN;
END;
END;
SHO ERREdited by: rp0428 on Jan 11, 2013 10:35 AM after 1st cup of coffee ;) -
Function call in procedure within Package Body
I am a novice in PL/SQL so that I can't find out where the problem is. I am testing a function call in procedure within a Package Body.
But the PL/SQL Complier doesn't compile the package body but I don't know what I do wrong. Plz let me know how to call a function in procedure within a Package Body?
Here are the Packaget test programs..
CREATE OR REPLACE PACKAGE manage_students
IS
PROCEDURE find_sname;
PROCEDURE find_test;
PROCEDURE find_test_called;
FUNCTION GET_LASTMT
RETURN SEQUENCE_TEST.SEQ_NO%TYPE;
END manage_students;
CREATE OR REPLACE PACKAGE BODY manage_students AS
v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
PROCEDURE find_sname
IS
BEGIN
BEGIN
SELECT MAX(SEQ_NO)
INTO v_max_nbr
from SEQUENCE_TEST;
DBMS_OUTPUT.PUT_LINE('MAX NUMBER is : '||v_max_nbr);
EXCEPTION
WHEN OTHERS
THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
RETURN;
END;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
END find_sname;
PROCEDURE find_test
IS
BEGIN
BEGIN
DBMS_OUTPUT.PUT_LINE('MAX NUMBER Called from another procedure : '||v_max_nbr);
EXCEPTION
WHEN OTHERS
THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
RETURN;
END;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
END find_test;
FUNCTION GET_LASTMT
RETURN SEQUENCE_TEST.SEQ_NO%TYPE
IS
v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
BEGIN
SELECT MAX(SEQ_NO)
INTO v_max_nbr
from SEQUENCE_TEST;
RETURN v_max_nbr;
EXCEPTION
WHEN OTHERS
THEN
DECLARE
v_sqlerrm VARCHAR2(250) :=
SUBSTR(SQLERRM,1,250);
BEGIN
RAISE_APPLICATION_ERROR(-20003,
'Error in instructor_id: '||v_sqlerrm);
END;
END GET_LASTMT;
PROCEDURE find_test_called
IS
BEGIN
BEGIN
V_max := Manage_students.GET_LASTMT;
DBMS_OUTPUT.PUT_LINE('MAX_NUMBER :'|| V_max);
EXCEPTION
WHEN OTHERS
THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
RETURN NULL;
END;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
END find_test_called;
END manage_students;
DECLARE
v_max SEQUENCE_TEST.SEQ_NO%TYPE;
BEGIN
manage_students.find_sname;
DBMS_OUTPUT.PUT_LINE ('Student ID: Execute.');
manage_students.find_test;
manage_students.find_test_called;
END;
-----------------------------------------------------------------------------------------------Hi,
Welcome to the forum!
You'll find that there are a lot of people willing to help you.
Are you willing to help them? Whenever you have a problem, post enough for people to re-create the problem themselves. That includes CREATE TABLE and INSERT statements for all the tables you use.
Error messages are very helpful. Post the complete error message you're getting, including line number. (It looks like your EXCEPTION sections aren't doing much, except hiding the real errors. That's a bad programming practice, but probably not causing your present problem - just a future one.)
Never post unformatted code. Indent the code to show the extent of each procedure, and the blocks within each one.
When posting formatted text on this site, type these 6 characters:
\(all small letters, inside curly brackets) before and after each section of formatted test, to preserve the spacing.
For example, the procedure find_test_called would be a lot easier to read like this:PROCEDURE find_test_called
IS
BEGIN
BEGIN
V_max := Manage_students.GET_LASTMT;
DBMS_OUTPUT.PUT_LINE ('MAX_NUMBER :' || V_max);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
RETURN NULL;
END;
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
END find_test_called;
It's much easier to tell from the code above that you're trying to return NULL from a procedure. Only functions can return anything (counting NULL); procedures can have RETURN statements, but that single word"RETURN;" is the entire statement. -
Help with Oracle packaged procedures/functions in JDBC
Up to this point I've pretty much used vanilla SQL calls for Oracle (with the JDBC thin driver).
However, I just received a PL/SQL script (that I didn't write) which I need to execute in a Java application (and get a result set). So I started looking at the Callable object. However, I'm having problems:
I'm trying to execute the following, piece by piece:
exec pay_balance_pkg.set_context('TAX_UNIT_ID','143') ;
select /*+ ORDERED */
ppf.employee_number,
ppf.full_name,
pdb.balance_name,
ppa.effective_date,
pay_balance_pkg.get_value(pdb.defined_balance_id, paa.assignment_action_id) amount
from
lots more SQL
Using a Callable statement, I can run the pay_balance_pkg.set_context('TAX_UNIT_ID','143') as "{call pay_balance_pkg.set_context(?,?)}" and set up the input parameters. It runs.
But the pay_balance_pkg.get_value(pdb.defined_balance_id, paa.assignment_action_id) attempt generates errors because of the implicit parameters (pdb.defined_balance_id, paa.assignment_action_id). I was assuming the previous call set up the "context" for these parameters. But it doesn't seem to in JDBC.
What's the solution for this?
Is there a way to just "run" the .sql file via JDBC or JDeveloper? Or do I literally have to parse out the PL/SQL and SQL from the file?Thanks for the reply.
It turned out that within that "large chunk of SQL", there was a package call that wasn't returning the expected results... which mucked up the rest of the SQL call.
Apparently it was a permissions issue in that the package didn't like to be called from JDBC; but would work fine out of SQL*Plus. Have you heard of this?
I ended up just throwing the first package call into an an anonymous PL/SQL block, and then doing the SQL call... both in SQLJ. Only because the app is throw-away. Otherwise I agree: it would have been better in a stored procedure/function. -
SSRS with Oracle Stored Procedures, Functions and Packages
Hi,
I am working on a BI project. Here we are using PowerPivot to access data from Oracle DB and generate reports. Currently Client generates Few reports using Oracle Stored Procedures, Functions and Packages. We need to move everything to PowerPivot, so
that user can generate all reports using same platform. But PowerPivot doesn'e support Oracle Stored Procedures, Functions and Packages. So we have decided to try those reports using SSRS.
I have no knowledge about using SSRS which will call Oracle function/stored procedures/packages for generating reports.
Can anybody help me in getting exact steps?
Please let me know if my question is not clear enough.
Thanks and Regards,
SSHi Visakh,
Thanks for the detailed steps. My next question is:
Is there any other way to develop such reports without using any development tool like Visual Studio? Our aim is to provide a self-serviced reporting platform where user don't need any technical knowledge.
I am sorry I have no knowledge about SSRS and Oracle DB.Can you please have a look at my Oracle function and let me know whether it's possible to execute this using SSRS? (I am pasting one by one as there is a character limit.
CREATE OR REPLACE TYPE obj_special_pass_cases
AS OBJECT
CLAIM_ID NUMBER(12),
claim_ref_no VARCHAR2(20),
OFFICER_NAME VARCHAR2(201),
SUBMIT_DT VARCHAR2(10),
ACC_DT VARCHAR2(10),
SP_ISSUE_DT VARCHAR2(10),
STATUS VARCHAR2(30),
SUB_STATUS VARCHAR2(30),
STATUS_LAST_UPDATE_DATE VARCHAR2(10),
SP_EXP_DT VARCHAR2(10),
INDUSTRY_CODE VARCHAR2(8),
EMP_SSIC VARCHAR2(8),
rel VARCHAR2(4),
WPNo VARCHAR2(20),
FIN VARCHAR2(9),
PASSPORT_NO VARCHAR2(16),
SPNo VARCHAR2(20),
VictimName VARCHAR2(100),
SP_EXT_PURPOSE VARCHAR2(100),
ISSUE_SYSTEM VARCHAR2(4),
REPATRIATION_DATE VARCHAR2(10),
SP_STATUS VARCHAR2(30),
SP_ISSUE_PURPOSE VARCHAR2(500)
CREATE OR REPLACE TYPE tbl_special_pass_cases
AS TABLE OF obj_special_pass_cases
CREATE OR REPLACE TYPE obj_special_pass_casesNew
AS OBJECT
CLAIM_ID NUMBER(12),
claim_ref_no VARCHAR2(20),
OFFICER_NAME VARCHAR2(201),
SUBMIT_DT VARCHAR2(10), /*Case Registration Date*/
ACC_DT VARCHAR2(10),
SP_ISSUE_DT VARCHAR2(10),
calc_sp_issue_dt VARCHAR2(10),
calc_sp_issue_dt_month VARCHAR2(2),
calc_sp_issue_dt_year VARCHAR2(4),
calc_Duration_Of_Stay VARCHAR2(4),
STATUS VARCHAR2(30),
SUB_STATUS VARCHAR2(30),
STATUS_LAST_UPDATE_DATE VARCHAR2(10),
lastUpdateDtMonth varchar2(2),
lastUpdateDtYear varchar2(4),
DurationOfUpdateDt VARCHAR2(4),
SP_EXP_DT VARCHAR2(10),
INDUSTRY_CODE VARCHAR2(8),
EMP_SSIC VARCHAR2(8),
rel VARCHAR2(4),
WPNo VARCHAR2(20), /* New columns from here - SR */
FIN VARCHAR2(9),
PASSPORT_NO VARCHAR2(16),
SPNo VARCHAR2(20),
VictimName VARCHAR2(100),
workerNationality VARCHAR2(20),
employName VARCHAR2(200),
reportType VARCHAR2(10),
SP_EXT_PURPOSE VARCHAR2(100),
ISSUE_SYSTEM VARCHAR2(4), /*IWPS, EIDS*/
REPATRIATION_DATE VARCHAR2(10),
SP_STATUS VARCHAR2(30),
SP_ISSUE_PURPOSE VARCHAR2(500)
CREATE OR REPLACE TYPE tbl_special_pass_casesNew
AS TABLE OF obj_special_pass_casesNew
FUNCTION getListOfSpecialPassCases(
vRepatriationDateFrom VARCHAR2,
vRepatriationDateTo VARCHAR2,
vIncludeRepatriationDate VARCHAR2)
RETURN tbl_special_pass_cases
IS
TYPE cur_typ IS REF CURSOR;
SPECIAL_PASS_CASES_CUR cur_typ;
vSQL1 VARCHAR2(4000);
--vSQL1 VARCHAR2(4000) := 'SELECT DISTINCT(A.CLAIM_ID), A.CLAIM_REF_NO, A.STATUS, A.SUB_STATUS, A.OFFICER_NAME, A.SUBMIT_DT, A.ACC_DT, A.vLatestUpdatedDate, A.INDUSTRY_CODE, A.ID_NO, A.vWorkerName, B.vSPWPNO, B.vFIN, B.vSPPassportNo,
B.vSPIssueDate, B.vSPExpiryDate, B.vSPNo, DECODE(B.vSPExtensionPurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''13'',''FMMD'',''14'',''TMB
PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION (SB-F)'') vSPExtensionPurpose, B.vIssueSystem, B.vSPActualDepartDate, B.vSPStatus, DECODE(B.vSPIssuePurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE
RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''11'',''PENDING DOCUMENT VERIFICATION'',''12'',''LATE ERENEWAL'',''13'',''FMMD'',''14'',''TMB PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION
(SB-F)'') vSPIssuePurpose FROM (SELECT vSPWPNO, vFIN, vSPPassportNo, vSPIssueDate, vSPExpiryDate, vSPNo, vSPExtensionPurpose, vIssueSystem, vSPActualDepartDate, vSPStatus, vSPIssuePurpose FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSActiveSpecialPass) WHERE
(vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B JOIN (SELECT WC.CLAIM_ID CLAIM_ID, WC.CLAIM_REF_NO CLAIM_REF_NO, WC.STATUS STATUS, WC.SUB_STATUS SUB_STATUS, TAS.LAST_NAME ||'' ''|| TAS.FIRST_NAME OFFICER_NAME, to_char(trunc(IRN.SUBMIT_DT), ''dd/MM/yyyy'')
SUBMIT_DT, TO_CHAR(trunc(decode(wc.assessmt_type,''OD-PI'',EV.OD_CONSULT_DT,''OD-TI'',ev.od_consult_dt,ECASE.acc_dt)), ''dd/MM/yyyy'') ACC_DT, (SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), ''dd/MM/yyyy'') STATUS_LAST_UPDATE_DATE FROM WIC_CLAIM_STATUS WCS WHERE
WCS.CLAIM_ID=WC.CLAIM_ID) vLatestUpdatedDate, EC.INDUSTRY_CODE INDUSTRY_CODE, EP.ID_NO ID_NO, EP.NAME vWorkerName FROM EVENT_PERSON EP, WIC_CLAIMS WC, TBL_AA_SUBJECT TAS, EVENT_COMPANY EC,EVENT_CASE ECASE,event_victim ev WHERE EP.ID_NO IS NOT NULL AND EP.DELETE_IND
= ''F'' AND EP.INVOLVEMENT = ''VICTIM'' AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID AND ep.event_person_id = ev.event_person_id (+) AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID AND EC.EVENT_CASE_NO=WC.EVENT_CASE_NO AND
EC.INVOLVEMENT in (''EMPLOYER'',''EMPLOYER_OCCUPIER'') AND ECASE.EVENT_CASE_NO=WC.EVENT_CASE_NO AND EC.DELETE_IND = ''F'') A ON (B.vFIN = A.ID_NO OR B.vSPPassportNo = A.ID_NO)';
vSQL2 VARCHAR2(4000);
--vSQL2 VARCHAR2(4000) := 'SELECT DISTINCT(A.CLAIM_ID),A.CLAIM_REF_NO,A.STATUS,A.SUB_STATUS,A.OFFICER_NAME,A.SUBMIT_DT,A.ACC_DT,A.vLatestUpdatedDate,A.INDUSTRY_CODE,A.ID_NO,A.vWorkerName,B.vSPWPNO,B.vFIN,B.vSPPassportNo,B.vSPIssueDate,B.vSPExpiryDate,B.vSPNo,DECODE(B.vSPExtensionPurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE
RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''13'',''FMMD'',''14'',''TMB PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION (SB-F)'') vSPExtensionPurpose,B.vIssueSystem,B.vSPActualDepartDate,B.vSPStatus,DECODE(B.vSPIssuePurpose,''1'',''WICB'',''2'',''RE-APPLICATION'',''3'',''POLICE'',''4'',''REPATRIATION'',''5'',''LRD'',''6'',''LATE
RENEWAL'',''9'',''OTHERS'',''10'',''LATE EISSUANCE'',''11'',''PENDING DOCUMENT VERIFICATION'',''12'',''LATE ERENEWAL'',''13'',''FMMD'',''14'',''TMB PENDING REPATRIATION'',''15'',''TMB REPATRIATION'',''16'',''PENDING REPATRIATION (SB-F)'',''17'',''REPATRIATION
(SB-F)'') vSPIssuePurpose FROM (SELECT vSPWPNO,vFIN,vSPPassportNo,vSPIssueDate,vSPExpiryDate,vSPNo,vSPExtensionPurpose,vIssueSystem,vSPActualDepartDate,vSPStatus,vSPIssuePurpose FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSDepartedSpecialPass(''' || vRepatriationDateFrom
|| ''', ''' || vRepatriationDateTo || ''')) WHERE (vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B JOIN (SELECT WC.CLAIM_ID CLAIM_ID, WC.CLAIM_REF_NO CLAIM_REF_NO, WC.STATUS STATUS,WC.SUB_STATUS SUB_STATUS, TAS.LAST_NAME ||'' ''|| TAS.FIRST_NAME OFFICER_NAME,
to_char(trunc(IRN.SUBMIT_DT), ''dd/MM/yyyy'') SUBMIT_DT,TO_CHAR(trunc(decode(wc.assessmt_type,''OD-PI'',EV.OD_CONSULT_DT,''OD-TI'',ev.od_consult_dt,ECASE.acc_dt)), ''dd/MM/yyyy'') ACC_DT, (SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), ''dd/MM/yyyy'') STATUS_LAST_UPDATE_DATE
FROM WIC_CLAIM_STATUS WCS WHERE WCS.CLAIM_ID=WC.CLAIM_ID) vLatestUpdatedDate, EC.INDUSTRY_CODE INDUSTRY_CODE, EP.ID_NO ID_NO, EP.NAME vWorkerName FROM EVENT_PERSON EP, WIC_CLAIMS WC, TBL_AA_SUBJECT TAS, EVENT_COMPANY EC,EVENT_CASE ECASE, IR_NOTIFICATION IRN,event_victim
ev WHERE EP.ID_NO IS NOT NULL AND EP.DELETE_IND = ''F'' AND EP.INVOLVEMENT = ''VICTIM'' AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID and ep.event_person_id = ev.event_person_id (+) AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID
AND EC.EVENT_CASE_NO=WC.EVENT_CASE_NO AND EC.INVOLVEMENT in (''EMPLOYER'',''EMPLOYER_OCCUPIER'') AND ECASE.EVENT_CASE_NO=WC.EVENT_CASE_NO AND IRN.REF_NO(+) = ECASE.IR_REF_NO AND IRN.SUBMIT_TYPE IN (''SI'',''SE'') AND EC.DELETE_IND = ''F'') A ON (B.vFIN = A.ID_NO
OR B.vSPPassportNo = A.ID_NO)';
SPECIAL_PASS_CASES_TBL tbl_special_pass_cases := tbl_special_pass_cases();
cursor sp_pass_settle_cur is
SELECT DISTINCT (A.CLAIM_ID),
A.CLAIM_REF_NO,
A.STATUS,
A.SUB_STATUS,
A.OFFICER_NAME,
A.SUBMIT_DT,
A.ACC_DT,
A.vLatestUpdatedDate,
A.INDUSTRY_CODE,
A.ID_NO,
A.vWorkerName,
B.vSPWPNO,
B.vFIN,
B.vSPPassportNo,
B.vSPIssueDate,
B.vSPExpiryDate,
B.vSPNo,
DECODE(B.vSPExtensionPurpose,
'1',
'WICB',
'2',
'RE - APPLICATION',
'3',
'POLICE',
'4',
'REPATRIATION',
'5',
'LRD',
'6',
'LATE RENEWAL',
'9',
'OTHERS',
'10',
'LATE EISSUANCE',
'13',
'FMMD',
'14',
'TMB PENDING REPATRIATION',
'15',
'TMB REPATRIATION',
'16',
'PENDING REPATRIATION(SB - F)',
'17',
'REPATRIATION(SB - F)') vSPExtensionPurpose,
B.vIssueSystem,
B.vSPActualDepartDate,
B.vSPStatus,
DECODE(B.vSPIssuePurpose,
'1',
'WICB',
'2',
'RE - APPLICATION',
'3',
'POLICE',
'4',
'REPATRIATION',
'5',
'LRD',
'6',
'LATE RENEWAL',
'9',
'OTHERS',
'10',
'LATE EISSUANCE',
'11',
'PENDING DOCUMENT VERIFICATION',
'12',
'LATE ERENEWAL',
'13',
'FMMD',
'14',
'TMB PENDING REPATRIATION',
'15',
'TMB REPATRIATION',
'16',
'PENDING REPATRIATION(SB - F)',
'17',
'REPATRIATION(SB - F)') vSPIssuePurpose
FROM (SELECT vSPWPNO,
vFIN,
vSPPassportNo,
vSPIssueDate,
vSPExpiryDate,
vSPNo,
vSPExtensionPurpose,
vIssueSystem,
vSPActualDepartDate,
vSPStatus,
vSPIssuePurpose
FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSActiveSpecialPass)
WHERE (vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B
JOIN (SELECT WC.CLAIM_ID CLAIM_ID,
WC.CLAIM_REF_NO CLAIM_REF_NO,
WC.STATUS STATUS,
WC.SUB_STATUS SUB_STATUS,
TAS.LAST_NAME ||''|| TAS.FIRST_NAME OFFICER_NAME,
'' SUBMIT_DT,
TO_CHAR(trunc(decode(wc.assessmt_type,
'OD-PI',
EV.OD_CONSULT_DT,
'OD-TI',
ev.od_consult_dt,
ECASE.acc_dt)),
'dd/MM/yyyy') ACC_DT,
(SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), 'dd/MM/yyyy') STATUS_LAST_UPDATE_DATE
FROM WIC_CLAIM_STATUS WCS
WHERE WCS.CLAIM_ID = WC.CLAIM_ID) vLatestUpdatedDate,
EC.INDUSTRY_CODE INDUSTRY_CODE,
EP.ID_NO ID_NO,
EP.NAME vWorkerName
FROM EVENT_PERSON EP,
WIC_CLAIMS WC,
TBL_AA_SUBJECT TAS,
EVENT_COMPANY EC,
EVENT_CASE ECASE,
event_victim ev
WHERE EP.ID_NO IS NOT NULL
AND EP.DELETE_IND = 'F'
AND EP.INVOLVEMENT = 'VICTIM'
AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO
AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID
AND ep.event_person_id = ev.event_person_id(+)
AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID
AND EC.EVENT_CASE_NO = WC.EVENT_CASE_NO
AND EC.INVOLVEMENT in ('EMPLOYER', 'EMPLOYER_OCCUPIER')
AND ECASE.EVENT_CASE_NO = WC.EVENT_CASE_NO
AND EC.DELETE_IND = 'F') A ON (B.vFIN = A.ID_NO OR B.vSPPassportNo = A.ID_NO);
sp_pass_settle_rec sp_pass_settle_cur%rowtype;
cursor sp_details_with_dt_cur is
SELECT DISTINCT (A.CLAIM_ID),
A.CLAIM_REF_NO,
A.STATUS,
A.SUB_STATUS,
A.OFFICER_NAME,
A.SUBMIT_DT,
A.ACC_DT,
A.vLatestUpdatedDate,
A.INDUSTRY_CODE,
A.ID_NO,
A.vWorkerName,
B.vSPWPNO,
B.vFIN,
B.vSPPassportNo,
B.vSPIssueDate,
B.vSPExpiryDate,
B.vSPNo,
DECODE(B.vSPExtensionPurpose,'1','WICB', '2','RE - APPLICATION','3','POLICE','4','REPATRIATION','5','LRD','6','LATE RENEWAL','9','OTHERS','10','LATE EISSUANCE',
'13','FMMD','14','TMB PENDING REPATRIATION','15','TMB REPATRIATION','16','PENDING REPATRIATION(SB - F)','17','REPATRIATION(SB
- F)') vSPExtensionPurpose,
B.vIssueSystem,
B.vSPActualDepartDate,
B.vSPStatus,
DECODE(B.vSPIssuePurpose,
'1','WICB','2','RE - APPLICATION','3','POLICE','4','REPATRIATION','5','LRD','6','LATE RENEWAL','9','OTHERS', '10', 'LATE EISSUANCE','11','PENDING
DOCUMENT VERIFICATION',
'12','LATE ERENEWAL','13','FMMD','14','TMB PENDING REPATRIATION','15','TMB REPATRIATION','16','PENDING REPATRIATION(SB - F)','17','REPATRIATION(SB
- F)') vSPIssuePurpose
FROM (SELECT vSPWPNO,
vFIN,
vSPPassportNo,
vSPIssueDate,
vSPExpiryDate,
vSPNo,
vSPExtensionPurpose,
vIssueSystem,
vSPActualDepartDate,
vSPStatus,
vSPIssuePurpose
FROM TABLE(IOSH_WIC_EXT_INTERFACE_PKG.getIWPSDepartedSpecialPass(''|| vRepatriationDateFrom ||'', ''|| vRepatriationDateTo ||''))
WHERE (vSPWPNO IS NOT NULL OR vFIN IS NOT NULL)) B
JOIN (SELECT WC.CLAIM_ID CLAIM_ID,
WC.CLAIM_REF_NO CLAIM_REF_NO,
WC.STATUS STATUS,
WC.SUB_STATUS SUB_STATUS,
TAS.LAST_NAME ||''|| TAS.FIRST_NAME OFFICER_NAME,
to_char(trunc(IRN.SUBMIT_DT), 'dd/MM/yyyy') SUBMIT_DT,
TO_CHAR(trunc(decode(wc.assessmt_type,
'OD - PI',
EV.OD_CONSULT_DT,
'OD - TI',
ev.od_consult_dt,
ECASE.acc_dt)),
'dd/MM/yyyy') ACC_DT,
(SELECT TO_CHAR(MAX(WCS.STATUS_START_DT), 'dd/MM/yyyy') STATUS_LAST_UPDATE_DATE
FROM WIC_CLAIM_STATUS WCS
WHERE WCS.CLAIM_ID = WC.CLAIM_ID) vLatestUpdatedDate,
EC.INDUSTRY_CODE INDUSTRY_CODE,
EP.ID_NO ID_NO,
EP.NAME vWorkerName
FROM EVENT_PERSON EP,
WIC_CLAIMS WC,
TBL_AA_SUBJECT TAS,
EVENT_COMPANY EC,
EVENT_CASE ECASE,
IR_NOTIFICATION IRN,
event_victim ev
WHERE EP.ID_NO IS NOT NULL
AND EP.DELETE_IND = 'F'
AND EP.INVOLVEMENT = 'VICTIM'
AND WC.EVENT_CASE_NO = EP.EVENT_CASE_NO
AND WC.EVENT_PERSON_ID = EP.EVENT_PERSON_ID
and ep.event_person_id = ev.event_person_id(+)
AND WC.ASSIGN_OFFICER_ID = TAS.SUBJECT_ID
AND EC.EVENT_CASE_NO = WC.EVENT_CASE_NO
AND EC.INVOLVEMENT in ('EMPLOYER', 'EMPLOYER_OCCUPIER')
AND ECASE.EVENT_CASE_NO = WC.EVENT_CASE_NO
AND IRN.REF_NO(+) = ECASE.IR_REF_NO
AND IRN.SUBMIT_TYPE IN ('SI', 'SE')
AND EC.DELETE_IND = 'F') A ON (B.vFIN = A.ID_NO OR B.vSPPassportNo = A.ID_NO);
sp_details_with_dt_rec sp_details_with_dt_cur%rowtype;
/*vSQL VARCHAR2(4000);
vFIN VARCHAR2(9);
vSPPassportNo VARCHAR2(16);
vSPWPNO VARCHAR2(20);
vSPIssueDate VARCHAR2(10);
vSPExpiryDate VARCHAR2(10);
vSPNo VARCHAR2(20);
vSPExtensionPurpose VARCHAR2(100);
vIssueSystem VARCHAR2(4);
vSPActualDepartDate VARCHAR2(10);
vSPStatus VARCHAR2(30);
vSPIssuePurpose VARCHAR2(500);
CLAIM_ID NUMBER(12);
CLAIM_REF_NO VARCHAR2(20);
STATUS VARCHAR2(30);
SUB_STATUS VARCHAR2(30);
OFFICER_NAME VARCHAR2(201);
SUBMIT_DT VARCHAR2(10);
ACC_DT VARCHAR2(10);
vLatestUpdatedDate VARCHAR2(10);
INDUSTRY_CODE VARCHAR2(8);
ID_NO VARCHAR2(50);
vWorkerName VARCHAR2(100);*/
BEGIN
if vIncludeRepatriationDate = 'Y' then
for sp_details_with_dt_rec in sp_details_with_dt_cur
loop
SPECIAL_PASS_CASES_TBL.EXTEND;
SPECIAL_PASS_CASES_TBL(SPECIAL_PASS_CASES_TBL.LAST) := obj_special_pass_cases(sp_details_with_dt_rec.CLAIM_ID,sp_details_with_dt_rec.CLAIM_REF_NO,sp_details_with_dt_rec.OFFICER_NAME,sp_details_with_dt_rec.SUBMIT_DT,sp_details_with_dt_rec.ACC_DT,sp_details_with_dt_rec.vSPIssueDate,sp_details_with_dt_rec.STATUS,sp_details_with_dt_rec.SUB_STATUS,sp_details_with_dt_rec.vLatestUpdatedDate,sp_details_with_dt_rec.vSPExpiryDate,sp_details_with_dt_rec.INDUSTRY_CODE,sp_details_with_dt_rec.INDUSTRY_CODE,'a',sp_details_with_dt_rec.vSPWPNO,sp_details_with_dt_rec.vFIN,sp_details_with_dt_rec.vSPPassportNo,sp_details_with_dt_rec.vSPNo,sp_details_with_dt_rec.vWorkerName,sp_details_with_dt_rec.vSPExtensionPurpose,sp_details_with_dt_rec.vIssueSystem,sp_details_with_dt_rec.vSPActualDepartDate,sp_details_with_dt_rec.vSPStatus,sp_details_with_dt_rec.vSPIssuePurpose);
end loop;
else
for sp_pass_settle_rec in sp_pass_settle_cur
loop
SPECIAL_PASS_CASES_TBL.EXTEND;
SPECIAL_PASS_CASES_TBL(SPECIAL_PASS_CASES_TBL.LAST) := obj_special_pass_cases(sp_pass_settle_rec.CLAIM_ID,sp_pass_settle_rec.CLAIM_REF_NO,sp_pass_settle_rec.OFFICER_NAME,sp_pass_settle_rec.SUBMIT_DT,sp_pass_settle_rec.ACC_DT,sp_pass_settle_rec.vSPIssueDate,sp_pass_settle_rec.STATUS,sp_pass_settle_rec.SUB_STATUS,sp_pass_settle_rec.vLatestUpdatedDate,sp_pass_settle_rec.vSPExpiryDate,sp_pass_settle_rec.INDUSTRY_CODE,sp_pass_settle_rec.INDUSTRY_CODE,'a',sp_pass_settle_rec.vSPWPNO,sp_pass_settle_rec.vFIN,sp_pass_settle_rec.vSPPassportNo,sp_pass_settle_rec.vSPNo,sp_pass_settle_rec.vWorkerName,sp_pass_settle_rec.vSPExtensionPurpose,sp_pass_settle_rec.vIssueSystem,sp_pass_settle_rec.vSPActualDepartDate,sp_pass_settle_rec.vSPStatus,sp_pass_settle_rec.vSPIssuePurpose);
end loop;
end if ;
RETURN SPECIAL_PASS_CASES_TBL;
END getListOfSpecialPassCases;
Thanks,
SS -
Calling a procedure from Calculation View with Debug function
Is it possible to call a debuggable hana procedure in a calculation view?
I just saw the video HANA Academy - HANA Native Development Workshop: SQL Script Editor - YouTube for HANA Native Development workshop and got the debug functionality to work for a file Procedure.
But I am unable to call this procedure from a Calculation View.
Below is the code I am using for the SQLScript Calculation View. Can someone tell me if this is correct?
/********* Begin Procedure Script ************/
BEGIN
call "_SYS_BIC"."test-package.RF.SalesOrders.procedures/get_sls_ordtype"(SalesDocNo => '0070004105', SalesDocTypes => ?) ;
var_out = CE_PROJECTION(:SalesDocTypes, ["SALESDOCNO" , "SALESDOCTYPE", "ORDVALUE"] );
END /********* End Procedure Script ************/Hello,
Just provide the out parameter in the call:
Declare
amount number; -- OUT number argument populated by the procedure
Begin
-- call the X procedure --
x( amount ) ;
End;Francois -
Sql Developer - View source code of procedures, functions & packages in another schema
Our developers need the ability to view procedures, function, packages etc. in the production database (using SQL DEVELOPER). They don't have access to sign on as the owner of these
objects in Production. They must use their own limited access UserID for this purpose.
This limited access UserID has been granted select privilege on DBA_SOURCE & DBA_OBJECTS. The developers need the ability to view the source of these object via
the tree view in SQL DEV. They should be able to click on "other users" in the SQL DEV tree view and see a listing of the owner schema objects. Then they should
be able to select the desired object and view the source code. These developers are used to using GUI interfaces. Selecting from DBA_SOURCE would not be an
option for them.
I understand that if the limited user is granted SELECT ANY DICTIONARY or SELECT_CATALOG_ROLE then this functionality will work. The problem is those
privileges/roles provide much more access than should be granted to these limited access users. Granting DBA to these users is also not an option.
In TOAD and other end-user tools this functionality works when only select privilege on DBA_SOURCE & DBA_OBJECTS has been granted. We need this same functionality
in SQL DEV.
While searching this forum and the internet, I see that other installations have this same issue.
Please enhance SQL Developer with this functionality.
Thank you, ellenJust to double check that I'm interpreting the problem correctly, is the following true:
select * from all_objects where object_name = 'DBA_SOURCE'
returns nothing
select * from dba_source where name = your PL/SQL module
returns all the code -
How can I create packages procedure & function in user-define Library
hi.
i am already created packages procedure & function in database and use so on.
now i would like to create these in library file.
please anyone give me example of any procedure or function to store in library.
thanks
Ali<FONT FACE="Arial" size=2 color="2D0000">> please send me one simple example for create library
then create any function in library.
2nd is any package can be create in library or not??
Thanks S.K
AliHave you checked the link?
A simple example is provided.
I think What I understood from your post is that, you want to put function/ Proc and want to call that as Library ..
Which is not possible.
For exampel an external routine is a third-generation language procedure stored in a
dynamic link library (DLL), registered with PL/SQL, and called by the DBA to perform
special-purpose processing.
In Unix a dynamic link library is known as a shared object (so).
At run time, PL/SQL loads the library dynamically, then calls the routine as if it were a
PL/SQL subprogram. To safeguard our database, the routine runs in a separate address
space, but it participates fully in the current transaction. Furthermore, the routine can
make a call back to the database to perform SQL operations.
To identify a DLL we have to use CREATE LIBRARY command.
The CREATE LIBRARY command is used to create a schema object, library, which
represents an operating-system shared library, from which SQL and PL/SQL can call
external third-generation-language (3GL) functions and procedures.
Learn something more on External Procedures
-SK
</FONT> -
Exp/imp procedures, functions and packages question
Hi
I've a 9i R2 version Oracle database. I would like to export procedures, functions and packages from a schema. How do I do that?
Is there any script or command lines can provide?
ThanksHello user12259190.
You can do an export of the user itself, excluding table data as inH:\>exp
Export: Release 10.2.0.1.0 - Production on Tue Dec 22 11:22:52 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: db_user@db_sid
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options
Enter array fetch buffer size: 4096 >
Export file: EXPDAT.DMP >
(2)U(sers), or (3)T(ables): (2)U > 2
Export grants (yes/no): yes > no
Export table data (yes/no): yes > no
Compress extents (yes/no): yes > no
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
server uses UTF8 character set (possible charset conversion)
Note: table data (rows) will not be exported
Note: grants on tables/views/sequences/roles will not be exported
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user DB_USER
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user DB_USER
About to export DB_USER's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export DB_USER's tables via Conventional Path ...
. . exporting table TABLE_NAMEs
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.Unfortunately, you can't export just the objects you want to unless they are tables.
Using import (imp) you can list the content of your packages, procedures, functions, views, etc. and perhaps that will give you what you need.
Another choice would be to useSELECT * FROM user_source ORDER BY 2, 1, 3;to list the code.
Hope this helps,
Luke -
Package,procedure,functions
Iam having one requirement. i.e. i want know which package,procedure,function is calling....?
for ex:
procedure a
-- p1
call_procedure_b;
-- p2
call_procedure_c;
at p1,p2 i want to know which is being called?
is there any possibiliyt like that?
can anybody help me on this?user632359 wrote:
can u please provide me with an example?Here's some code someone posted a while back (can't remember who), but I saved it for a rainy day...
create or replace procedure who_called_me( owner out varchar2,
name out varchar2,
lineno out number,
caller_t out varchar2 )
as
call_stack varchar2(4096) default dbms_utility.format_call_stack;
n number;
found_stack BOOLEAN default FALSE;
line varchar2(255);
cnt number := 0;
begin
loop
n := instr( call_stack, chr(10) );
exit when ( cnt = 3 or n is NULL or n = 0 );
line := substr( call_stack, 1, n-1 );
call_stack := substr( call_stack, n+1 );
if ( NOT found_stack ) then
if ( line like '%handle%number%name%' ) then
found_stack := TRUE;
end if;
else
cnt := cnt + 1;
-- cnt = 1 is ME
-- cnt = 2 is MY Caller
-- cnt = 3 is Their Caller
if ( cnt = 3 ) then
lineno := to_number(substr( line, 13, 6 ));
line := substr( line, 21 );
if ( line like 'pr%' ) then
n := length( 'procedure ' );
elsif ( line like 'fun%' ) then
n := length( 'function ' );
elsif ( line like 'package body%' ) then
n := length( 'package body ' );
elsif ( line like 'pack%' ) then
n := length( 'package ' );
elsif ( line like 'anonymous%' ) then
n := length( 'anonymous block ' );
else
n := null;
end if;
if ( n is not null ) then
caller_t := ltrim(rtrim(upper(substr( line, 1, n-1 ))));
else
caller_t := 'TRIGGER';
end if;
line := substr( line, nvl(n,1) );
n := instr( line, '.' );
owner := ltrim(rtrim(substr( line, 1, n-1 )));
name := ltrim(rtrim(substr( line, n+1 )));
end if;
end if;
end loop;
end;
create or replace function who_am_i return varchar2
is
l_owner varchar2(30);
l_name varchar2(30);
l_lineno number;
l_type varchar2(30);
begin
who_called_me( l_owner, l_name, l_lineno, l_type );
return l_owner || '.' || l_name;
end;
/ -
Package interpeting function call as variable call
When I try to compile my package the compiler mistakes the function calls in this collection for variables.:
type dayonelist IS TABLE OF NUMBER;
dayone dayonelist := dayonelist(wkdaysminusone(), sadaysminusone(), sudaysminusone());
I get this error message:
Error(244,35): PLS-00306: wrong number or types of arguments in call to 'WKDAYSMINUSONE'
Anyone know how I can correct this?rthakur-
I'm a beginner at this and looking for help and not smart comments. I may not have your experience but I have a little more courtesy than you. Here's the package code:
CREATE OR REPLACE
package accessreports is
vc_FirstofMonth DATE;
vc_CurrentPick date;
PROCEDURE PICK_DATE
(p_first_of_month IN DATE);
PROCEDURE EXEC_REPORTS(p_first_of_month IN DATE);
PROCEDURE PRODUCTIVITY_INSERT
(p_first_of_month IN DATE);
PROCEDURE AVERAGE_BOARDINGS
(p_first_of_month IN DATE);
end accessreports;
CREATE OR REPLACE PACKAGE BODY accessreports IS
/*Below are all functions that provide variables for calulations and WHERE
clauses. All functions are at the top of the package for visibility to all procs and
convenience*/
FUNCTION curpick RETURN DATE IS p_current_pick DATE;
BEGIN
SELECT MAX(pick) AS
pick
INTO p_current_pick
FROM bus_picks;
RETURN p_current_pick;
END curpick;
FUNCTION wkdays(p_first_of_month IN DATE)
RETURN NUMBER IS p_wk NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(service_date) AS
wk
INTO p_wk
FROM
(SELECT DISTINCT service_date
FROM bus_daily_rides
WHERE to_char(service_date,'MM-YYYY') = to_char(vc_firstofmonth,'MM-YYYY')
AND day_type = 'W')
RETURN p_wk;
END wkdays;
FUNCTION sadays (p_first_of_month IN DATE)
RETURN NUMBER IS p_sa NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(service_date) AS
sa
INTO p_sa
FROM
(SELECT DISTINCT service_date
FROM bus_daily_rides
WHERE to_char(service_date, 'MM-YYYY') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'A')
RETURN p_sa;
END sadays;
FUNCTION sudays(p_first_of_month IN DATE)
RETURN NUMBER IS p_su NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(service_date) AS
su
INTO p_su
FROM
(SELECT DISTINCT service_date
FROM bus_daily_rides
WHERE to_char(service_date, 'MM-YYYY') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'U')
RETURN p_su;
END sudays;
FUNCTION wkdaysminusone(p_first_of_month IN DATE)
RETURN NUMBER IS p_wkone NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
wkone
INTO p_wkone
FROM
(SELECT DISTINCT to_char(add_months(service_date, -12), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'W')
RETURN p_wkone;
END wkdaysminusone;
FUNCTION sadaysminusone(p_first_of_month IN DATE)
RETURN NUMBER IS p_saone NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
saone
INTO p_saone
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'A')
RETURN p_saone;
END sadaysminusone;
FUNCTION sudaysminusone(p_first_of_month IN DATE)
RETURN NUMBER IS p_suone NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
suone
INTO p_suone
FROM
(SELECT DISTINCT to_char(add_months(service_date, -12), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'U')
RETURN p_suone;
END sudaysminusone;
FUNCTION wkdaysminustwo(p_first_of_month IN DATE)
RETURN NUMBER IS p_wktwo NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
wktwo
INTO p_wktwo
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_FirstofMonth, 'MM-YYYY')
AND day_type = 'W')
RETURN p_wktwo;
END wkdaysminustwo;
FUNCTION sadaysminustwo(p_first_of_month IN DATE)
RETURN NUMBER IS p_satwo NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
satwo
INTO p_satwo
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'A')
RETURN p_satwo;
END sadaysminustwo;
FUNCTION sudaysminustwo(p_first_of_month IN DATE)
RETURN NUMBER IS p_sutwo NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
sutwo
INTO p_sutwo
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'U')
RETURN p_sutwo;
END sudaysminustwo;
/*PICK_DATE determines if the report being provided takes place during a pick month.*/
PROCEDURE pick_date(p_first_of_month IN DATE)
AS
BEGIN
vc_firstofmonth := p_first_of_month;
vc_currentpick := curpick();
IF to_char(vc_firstofmonth, 'MM-YYYY') <> to_char(vc_currentpick, 'MM-YYYY') THEN
accessreports.exec_reports(p_first_of_month);
ELSE
NULL;
/*This procedure being built*/
END IF;
END pick_date;
/*EXEC_REPORTS executes the procs below it with two input vars.*/
PROCEDURE exec_reports(p_first_of_month IN DATE)
IS
BEGIN
accessreports.productivity_insert(p_first_of_month);
accessreports.average_boardings(p_first_of_month);
END;
/*Last two procs use dynamic SQL to rotate through the different day types and
pls_integer of days for each day type.*/
PROCEDURE productivity_insert(p_first_of_month DATE)
AS
TYPE daylist IS TABLE OF VARCHAR2(1);
DAYS daylist := daylist('W', 'A', 'U');
TYPE countlist IS TABLE OF NUMBER;
counts countlist := countlist(wkdays(), sadays(), sudays());
BEGIN
FOR i IN 1 .. 3 LOOP
EXECUTE IMMEDIATE 'INSERT INTO RFC_BUS' || DAYS(i) || 'PRODUCTIVITY(ROUTE,PPPH)
SELECT a.route, ((sr05 / sy05)/' || counts(i) || ') AS "RATIO"
FROM (SELECT route,
SUM (DECODE (TO_CHAR (pick, "MM-YYYY"),
to_char(vc_FirstofMonth, "MM-YYYY"), platform_hours, null)) AS sy05
FROM bus_platformhours
WHERE day_type =' || DAYS(i) || ' and platform_hours > 0
GROUP BY route) a,
(SELECT route,
SUM (DECODE (TO_CHAR (service_date, "mm-yyyy"),
to_char(vc_FirstofMonth, "MM-YYYY"), rides, null)) AS sr05
FROM bush_daily_rides
WHERE day_type = ' || DAYS(i) || 'GROUP BY route) b
WHERE a.route = b.route
ORDER BY a.route
VALUES(
p_route,
p_ratio
) USING days(i), counts(i)';
END LOOP;
END productivity_insert;
PROCEDURE average_boardings(p_first_of_month DATE)
AS
type daylist IS TABLE OF VARCHAR2(1);
DAYS daylist := daylist('W', 'A', 'U');
type countlist IS TABLE OF NUMBER;
counts countlist := countlist(wkdays(), sadays(), sudays());
type dayonelist IS TABLE OF NUMBER;
dayone dayonelist := dayonelist(wkdaysminusone(), sadaysminusone(), sudaysminusone());
type daytwolist IS TABLE OF NUMBER;
daytwo daytwolist := daytwolist(wkdaysminustwo(), sadaysminustwo(), sudaysminustwo());
BEGIN
vc_firstofmonth := p_first_of_month;
FOR i IN 1 .. 3 LOOP
EXECUTE IMMEDIATE 'INSERT INTO RFC' || DAYS(i) || 'BUSAVG_RIDES_AND_PROD(ROUTE, THIRD_YEAR, SECOND_YEAR, PRESENT_YEAR,
PER_DIFF_THIRDTOPRESENT, PER_DIFF_SECONDTOPRESENT, ROUTETWO, PASS_PLAT_HOUR)
select r.*,
t2.*
from (
select *
from (select route,
sum(y04)/' || counts(i) || ' y04,
sum(y05)/' || dayone(i) || ' y05,
sum(y06)/' || daytwo(i) || ' y06,
decode(sum(y04),0,0,(sum(y06)-sum(y04))/sum(y04)*100) Percent_difference_04to06,
decode(sum(y05),0,0,(sum(y06)-sum(y05))/sum(y05)*100) Percent_difference_05to06
from (select route,
decode(to_char(service_date,"yy"),"04",Rides,0) y04,
decode(to_char(service_date,"yy"),"05",Rides,0) y05,
decode(to_char(service_date,"yy"),"06",Rides,0) y06
from bus_daily_rides
where TO_CHAR(service_date, "YY") IN ("04","05", "06")
AND TO_CHAR(SERVICE_DATE,"MM")=TO_CHAR(vc_FirstofMonth, "MM")
AND day_type=' || DAYS(i) || '
group by route
WHERE ROWNUM > 0
) r,
' || DAYS(i) || '"_"Route_productivity t2
where t2.route = r.route
VALUES(p_route,
p_third_year,
p_second_year,
p_present_year,
p_thirdtopresent,
p_secondtopresent,
p_routetwo,
p_ppph) USING counts(i), days(i), daysone(i), daystwo(i)';
END LOOP;
END;
END accessreports;
Maybe you are looking for
-
5th Gen Ipod not recognized by windows or itunes. Have tried it all. Any Ideas?
Hello everyone. I have a 5th generation Ipod I recently purchased that I'm having what seems to be an common issue. When I connect the ipod to my computer via USB, the Ipod is not recognized in windows or Itunes. Occasionally the Ipod will charge whe
-
My new ipod touch is not recognised in itunes or Windows 7 on any of my computers/laptops. I've followed the online advice and still no luck. Help much appreciated!
-
Ipod Not recognized 3rd generation
Ok so yesterday i had an ipod nano that wa snew and i had already had itunes downloaded on the computer. I found out that itunes could not recognize the drive and i had to reformat and update my ipod to get it to recognize. Well it worked. The proble
-
Why is WEBDAV so slow????
My hosting provider (HostGator) allows me to access my website via a WebDisk (perhaps unusual) but a nice feature. However it seems to takes to open files or move files. Why is this? I got much faster speeds on my old Performa 6360 transferring files
-
Clarification in item category determination based on Usage
Hi We are having one quotation document (ZXYZ) and the item category determination we maintained is as below SALES Doc + ITEM.C . Group + USAGE + H.L.ITEM = ITEM Category ZXYZ + NORM + SENI + - = AES ZXYZ + NORM +