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.

Similar Messages

  • 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,
    SS

    Hi 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

  • 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.

  • 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;
    /

  • Encryption of pl/sql package/procedures/function code

    Is it possible to make the code inside a package/procedure/function un readable to other users.
    As is some of the api package body code in portal ?
    thanks in anticipation.
    SD,

    PL/SQL Wrap Utilityhttp://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm#LNPLS016
    Note, however that you cannot revert back to original un-wrapped code from a code that has been wrapped. You would need access to the original source files to get the original source 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>

  • Idea for package/procedure/function distribution ??

    Hi all
    We have multilple databases (10.2.0.3). And we have a lot of "utility" packages for both appl. util and for DBA utils.
    We have created a XXXUTIL schema on each database.
    How do we keep those schemas in sync automatically - apart from doing export/import? We will name on "master" and all other should be in sync with this one schema (packages/procedures/functions/views)
    Is there a smarter way of doing this, a pull or push replication solotiuon. We are on the 10g Enterprise verison.
    Ideas appreciated
    best regards
    Mette

    Hi,
    As you said you got a lot of utility Packages, I think you can directly compile those scripts one you changed in the master DB, there won't be any thing to Sync the Procedures from One DB to another DB.
    If it is a data then, you might gone for DB Link, Streams etc., for replicating the data.
    In order to automate your need to write a script for logging into DB and running set of scripts and disconnecting - a shell script.
    Just think is that your requirement.!!
    Pavan Kumar N

  • Oracle Package Procedures

    Hello all,
    Does Forte support the calling of overloaded package procedures in Oracle?
    Tim Sawyer
    PanCredit
    Leeds, UK.

    As I remember Forte picks correct overloaded procedure if you specify all
    parameter names and qualifiers (input/output). This was the way it worked in
    R2. Never tested it in R3 though - it may have changed.
    Nickolay Sakharov
    CBSI
    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]]
    Sent: Friday, September 24, 1999 5:56 AM
    To: Tim Sawyer
    Cc: '[email protected]'; Rob Patrick
    Subject: Re: (forte-users) Oracle Package Procedures
    Tim,
    The short answer is no. I had put in an enhancement request for this during
    Forte 3.0.G.2 release. I don't know the status of this now.
    Long answer: We faced the same issue when we Upgraded from Forte R2 to R3.
    If there is an overloaded procedure, Oracle returns a list of package
    specs. Forte picks one - I am not sure if it is the first or last. If it
    happens to be the one you are looking for, you will be lucky. Otherwise,
    you will get an exception.
    Our work around was to create a dummy procedure that calls the overloaded
    procedure. We call the dummy procedure from Forte.
    Hope this helps.
    Venkat
    PriceWaterhouseCoopers
    The information transmitted is intended only for the person or entity to
    which it is addressed and may contain confidential and/or privileged
    material. Any review, retransmission, dissemination or other use of, or
    taking of any action in reliance upon, this information by persons or
    entities other than the intended recipient is prohibited. If you received
    this in error, please contact the sender and delete the material from any
    computer.
    For the archives, go to: http://lists.sageit.com/forte-users and use
    the login: forte and the password: archive. To unsubscribe, send in a new
    email the word: 'Unsubscribe' to: [email protected]

  • Need Help With a Stored Procedure

    Help With a Stored Procedure
    Hi everyone.
    I am quite new relative to creating stored procedures, so I anticipate that whatever help I could get here would be very much helpful.
    Anyway, here is my case:
    I have a table where I need to update some fields with values coming from other tables. The other tables, let us just name as tblRef1, tblRef2 and tblRef3. For clarity, let us name tblToUpdate as my table to update. tblToUpdate has the following fields.
    PlanID
    EmployeeIndicator
    UpdatedBy
    CreatedBy
    tblRef1, tblRef2 and tblRef3 has the following fields:
    UserName
    EmpIndicator
    UserID
    In my stored procedure, I need to perform the following:
    1. Check each row in the tblToUpdate table. Get the CreatedBy value and compare the same to the UserName and UserID field of tblRef1. If no value exists in tblRef1, I then proceed to check if the value exists in the same fields in tblRef2 and tblRef3.
    2. If the value is found, then I would update the EmployeeIndicator field in tblToUpdate with the value found on either tblRef1, tblRef2 or tblRef3.
    I am having some trouble writing the stored procedure to accomplish this. So far, I have written is the following:
    CREATE OR REPLACE PROCEDURE Proc_Upd IS v_rec NUMBER;
    v_plan_no tblToUpdate.PLANID%TYPE;
    v_ref_ind tblToUpdate.EMPLOYEEINDICATOR%TYPE;
    v_update_user tblToUpdate.UPDATEDBY%TYPE;
    v_created_by tblToUpdate.CREATEDBY%TYPE;
    v_correct_ref_ind tblToUpdate.EMPLOYEEIDICATOR%TYPE;
    CURSOR cur_plan IS SELECT PlanID, EmployeeIndicator, UPPER(UpdatedBy), UPPER(CreatedBy) FROM tblToUpdate;
    BEGIN
    Open cur_plan;
         LOOP
         FETCH cur_plan INTO v_plan_no, v_ref_ind, v_update_user, v_created_by;
              EXIT WHEN cur_plan%NOTFOUND;
              BEGIN
              -- Check if v_created_by has value.
                   IF v_created_by IS NOT NULL THEN
                   -- Get the EmpIndicator from the tblRef1, tblRef2 or tblRef3 based on CreatedBy
                   SELECT UPPER(EmpIndicator)
                        INTO v_correct_ref_ind
                        FROM tblRef1
                        WHERE UPPER(USERNAME) = v_created_by
                        OR UPPER(USERID) = v_created_by;
                        IF v_correct_ref_ind IS NOT NULL THEN
                        -- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
                             UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
                        ELSIF
                        -- Check the Other tables here????
                        END IF;
                   ELSIF v_created_by IS NULL THEN
                   -- Get the EmpIndicator based on the UpdatedBy
                        SELECT UPPER(EmpIndicator)
                        INTO v_correct_ref_ind
                        FROM tblRef1
                        WHERE UPPER(USERNAME) = v_update_user
                        OR UPPER(USERID) = v_created_by;
                        IF v_correct_ref_ind IS NOT NULL THEN
                        -- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
                             UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
                        ELSIF
                        -- Check the Other tables here????
                        END IF;
                   END IF;
              END;
         END LOOP;
         CLOSE cur_plan;
         COMMIT;
    END
    Please take note that the values in the column tblToUpdate.UpdatedBy or tblToUpdate.CreatedBy could match either the UserName or the UserID of the table tblRef1, tblRef2, or tblRef3.
    Kindly provide more insight. When I try to execute the procedure above, I get a DATA NOT FOUND ERROR.
    Thanks.

    Ah, ok; I got the updates the wrong way round then.
    BluShadow's single update sounds like what you need then.
    I also suggest you read this AskTom link to help you see why you should choose to write DML statements before choosing to write cursor + loops.
    In general, when you're being asked to update / insert / delete rows into a table or several tables, your first reaction should be: "Can I do this in SQL?" If you can, then putting it into a stored procedure is usually just a case of putting the sql statement inside the procedure header/footers - can't really get much more simple than that! *{;-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Help with oracle 11g pivot operator

    i need some help with oracle 11g pivot operator. is it possible to use multiple columns in the FOR clause and then compare it against multiple set of values.
    here is the sql to create some sample data
    create table pivot_data ( country_code number , dept number, job varchar2(20), sal number );
    insert into pivot_data values (1,30 , 'SALESMAN', 5000);
    insert into pivot_data values (1,301, 'SALESMAN', 5500);
    insert into pivot_data values (1,30 , 'MANAGER', 10000);     
    insert into pivot_data values (1,301, 'MANAGER', 10500);
    insert into pivot_data values (1,30 , 'CLERK', 4000);
    insert into pivot_data values (1,302, 'CLERK',4500);
    insert into pivot_data values (2,30 , 'SALESMAN', 6000);
    insert into pivot_data values (2,301, 'SALESMAN', 6500);
    insert into pivot_data values (2,30 , 'MANAGER', 11000);     
    insert into pivot_data values (2,301, 'MANAGER', 11500);
    insert into pivot_data values (2,30 , 'CLERK', 3000);
    insert into pivot_data values (2,302, 'CLERK',3500);
    using case when I can write something like this and get the output i want
    select country_code
    ,avg(case when (( dept = 30 and job = 'SALESMAN' ) or ( dept = 301 and job = 'SALESMAN' ) ) then sal end ) as d30_sls
    ,avg(case when (( dept = 30 and job = 'MANAGER' ) or ( dept = 301 and job = 'MANAGER' ) ) then sal end ) as d30_mgr
    ,avg(case when (( dept = 30 and job = 'CLERK' ) or ( dept = 302 and job = 'CLERK' ) ) then sal end ) as d30_clrk
    from pivot_data group by country_code;
    output
    country_code          D30_SLS               D30_MGR               D30_CLRK
    1      5250      10250      4250
    2      6250      11250      3250
    what I tried with pivot is like this I get what I want if I have only one ( dept,job) for one alias name. I want to call (30 , 'SALESMAN') or (301 , 'SALESMAN') AS d30_sls. any help how can I do this
    SELECT *
    FROM pivot_data
    PIVOT (SUM(sal) AS sum
    FOR (dept,job) IN ( (30 , 'SALESMAN') AS d30_sls,
              (30 , 'MANAGER') AS d30_mgr,               
    (30 , 'CLERK') AS d30_clk
    this is a simple example .... my real life scenario is compliated with more fields and more combinations .... So something like using substr(dept,1,2) won't work in my real case .
    any suggestions get the result similar to what i get in the case when example is really appreciated.

    Hi,
    Sorry, I don't think there's any way to get exactly what you requested. The values you give in the PIVOT ... IN clause are exact values, not alternatives.
    You could do something like this to map all alternatives to a common value:
    WITH     got_dept_grp     AS
         SELECT     country_code, job, sal
         ,     CASE
                  WHEN  job IN ('SALESMAN', 'MANAGER') AND dept = 301 THEN 30
                  WHEN  job IN ('CLERK')               AND dept = 302 THEN 30
                                                                     ELSE dept
              END     AS dept_grp
         FROM     pivot_data
    SELECT     *
    FROM     got_dept_grp
    PIVOT     (     AVG (sal)
         FOR     (job, dept_grp)
         IN     ( ('SALESMAN', 30)
              , ('MANAGER' , 30)
              , ('CLERK'   , 30)
    ;In your sample data (and perhaps in your real data), it's about as easy to explicitly define the pivoted groups individually, like this:
    WITH     got_pivot_key     AS
         SELECT     country_code, sal
         ,     CASE
                  WHEN  job = 'SALESMAN' AND dept IN (30, 301) THEN 'd30_sls'
                  WHEN  job = 'MANAGER'  AND dept IN (30, 301) THEN 'd30_mgr'
                  WHEN  job = 'CLERK'    AND dept IN (30, 302) THEN 'd30_clrk'
              END     AS pivot_key
         FROM    pivot_data
    SELECT     *
    FROM     got_pivot_key
    PIVOT     (     AVG (sal)
         FOR     pivot_key
         IN     ( 'd30_sls'
              , 'd30_mgr'
              , 'd30_clrk'
    ;Thanks for posting the CREATE TABLE and INSERT statements; that really helps!

  • I need help with oracle

    Hi,
    I need some help... if someone can help its great.
    I need to make a statement in Oracle SQL that read data from a file and insert in a Oracle Database ... if someone can show me the syntax of it i appreciate..
    Thanks

    Okay, I see you followed the advice in that other thread and started a new post for you question. Congratulations. Your next lesson in forum etiquette is to give your posts a more relevant subject. Pretty much everybody who posts here needs help with oracle; if they need help with cooking catfish they've come to the wrong place.
    It that other thread I suggested using SQL*Loader or External Tables might be a more suitable solution. Find out more.
    Cheers, APC

  • Help Required on Cross Referencing with Oracle Stored Procedure

    Hi Experts,
       I have a requirement which is having the requirements as follow,
    Web Application initially sends a request number to SAP ECC to fetch the response details through SAP PI (HTTP to RFC u2013 Synchronous). While fetching the response from SAP ECC system, SAP PI has to invoke a Oracle Stored Procedure based on some parameter from SAP ECC System and then composited data has to send back to Web Application by SAP PI.
    Request you to kindly suggest how to achieve the above.  JDBC lookup is not much extended to call stored procedure. It would be helpful if it will be a step by step as I am novice to SAP PI.
    Regards
    Archana

    you might very well have to use a BPM.
    open a sync/async bridge ->
    do a sync call to RFC ->
    Do a sync call to DB (use SP here) ->
    do a transformation from the response message of RFC and Response of DB (N:1) to for your response to original caller (http)
    Close the sync async bridge using the response message

  • Help! Need oracle help with constructing stored procedure that return resultsets

    Suns tutorial path for returning resultsets from stored procedures indicates that the following should work...
    CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
    ResultSet rs = cs.executeQuery();
    Thats if you build your stored procedure something like this ...
    String createProcedure = "create procedure SHOW_SUPPLIERS " + "as " + "select SUPPLIERS.SUP_NAME, COFFEES.COF_NAME " + "from SUPPLIERS, COFFEES " + "where SUPPLIERS.SUP_ID = COFFEES.SUP_ID " + "order by SUP_NAME";
    We are using oracle 8.1.6. However I've been told that with oracle procedures when you return a result set from a called procedure you return a p_cursor variable. Somthing like this
    (p_cursor in out SHOW_SUPPLIERS.SHOCurTyp)
    is
    begin
    open p_cursor for
    select * from suppliers
    In which case the above mentioned sun code doesn't work.
    We want to use jdbc to call a stored procedure that returns a resultset that does not require us to import any proprietary oracle objects...
    Is there another way to write these stored procedures, rather than using this cursor construct? Are we missing something in the way we invoke them?

    Suns tutorial path for returning resultsets from stored procedures indicates that the following should work...
    CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
    ResultSet rs = cs.executeQuery();
    Thats if you build your stored procedure something like this ...
    String createProcedure = "create procedure SHOW_SUPPLIERS " + "as " + "select SUPPLIERS.SUP_NAME, COFFEES.COF_NAME " + "from SUPPLIERS, COFFEES " + "where SUPPLIERS.SUP_ID = COFFEES.SUP_ID " + "order by SUP_NAME";
    We are using oracle 8.1.6. However I've been told that with oracle procedures when you return a result set from a called procedure you return a p_cursor variable. Somthing like this
    (p_cursor in out SHOW_SUPPLIERS.SHOCurTyp)
    is
    begin
    open p_cursor for
    select * from suppliers
    In which case the above mentioned sun code doesn't work.
    We want to use jdbc to call a stored procedure that returns a resultset that does not require us to import any proprietary oracle objects...
    Is there another way to write these stored procedures, rather than using this cursor construct? Are we missing something in the way we invoke them?

  • Executing an Oracle Stored Procedure from Sender JDBC adapter

    I could really use some help from someone who had done this before. 
    I've read the help about using the JDBC sender adapter, but it's not helping enough.
    I found this line: "Specify an SQL EXECUTE statement to execute a stored procedure, which contains exactly one SELECT statement.
    The expression must correspond to the SQL variant supported by the relevant JDBC driver. It can also contain table JOINs."
    That's definately what we want to do, but we can't figure out the syntax.
    The procedure in oracle looks like this:
    CREATE OR REPLACE PROCEDURE test_ref_cursor
    ( cur_generic IN OUT result_sets.cur_generic)
    as
    BEGIN
    Open cur_generic for
    select
       proposal_number,
       to_char(sequence_number),
       column_name,
       column_value,
       update_timestamp,
       update_user
       from
       coeus.sap_test;
    END test_ref_cursor;
    And we have tried every kind of statement we can think of, but the file adapter always gives us an "invalid sql statement" error.
    Does anyone know what syntax we need to put in the "Query SQL Statement" in the JDBC sender adapter in order to call this procedure?  Or is there something wrong with the procedure that is causing the error?
    <i>I will absolutely return and give points, but PLEASE read my whole post before answering and do not just link me to or quote the help for configuring a sender JDBC adapter or blogs that are about the JDBC adapter in general but do not deal with the issues I am having. Thank you.</i>

    Hi Vanda,
    Unfortunately, the sender JDBC adapter does not support Oracle's store procedure/function.  Unlike stored procedures from other database vendors, Oracle returns a cursor, not a resultset.  The sender JDBC adapter must send a resultset to XI.
    There are 2 possible ways you can accomplish this:
    1.  Use BPM and call the Oracle stored procedure using a receiver adapter via a asynch-synch bridge.
    2.  Develop a user-module for the adapter, which can be used with a sender adapter.
    Thanks
    Prasad

  • How to find out Unused Packages/Procedures/Functions/Triggers

    Hi,
    I have one database. This database is with 7 schemas. Around 1000 triggers are associated with each schema. But the application is using only some triggers.
    How to find out the used triggers? Apllications is developed in J2EE.
    Same way I want to find out the for Packages/Procedures and Functions.
    Any easy way is available?
    Please help me.
    regards
    Mathew

    Hi,
    >Audit the execution event on the objects by access.
    Kindly explain how to enable this auditing.
    regards
    Mathew

Maybe you are looking for