PL/SQL with DBMS_HS_PASSTHROUGH Package

Hi,
Can someone provide me a sample code on using DBMS_HS_PASSTHROUGH package? I have Oracle 10g installed on Windows XP Home and needs to extract some data from HP-UX(running Informix 8.32).
Any help is highly appreciated.
Thanks

This is an internal package so it is not visible when you query the database objects.
You should be able to use it. It is available with the developer download.
Take a look at Chap 3 of the Heterogeneous Connectivity Administrator's Guide for more information.

Similar Messages

  • DBMS_HS_PASSTHROUGH Package

    Ive configured the Heterogeneous Services on our Oracle 9.2 server and can access a variety of different non-Oracle datasources (Access, ADABAS on a mainframe, etc.). However, theres no sign of the DBMS_HS_PASSTHROUGH package referenced in the docs -- it doesn't show up in queries to all_objects and I can't reference it in PL/SQL . I would like to use this package to pass clean SQL strings to the various datasources as part of our prototyping effort.
    Is this package supposed to be installed when caths.sql is run to configure Heterogeneous Services? Is this package somehow deprecated or not included on the Oracle 9.2 developer download?
    Thanks for any insight.

    This is an internal package so it is not visible when you query the database objects.
    You should be able to use it. It is available with the developer download.
    Take a look at Chap 3 of the Heterogeneous Connectivity Administrator's Guide for more information.

  • SQL 2012 SSIS package runs from the command line (dtexec.exe) and completes right away ...

    Hi
    I’m upgrading our SSIS packages from SQL 2005 to SQL 2012 .
    Everything is working fine in Visual Studio, but when I’m submitting dtexec.exe it’s finishing right away in the command line (the actual execution takes long time). 
    It looks to me that as the return code doesn’t pass properly.
    As I have depending tasks how I can make sure all jobs will be executed in the proper order.
    (We never had this issue in SQL 2005)
    C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn>dtexec.exe /ISSERVER "\"\SSISDB\Direct_Prod\Direct_SSIS_Package
    \DD_Load_Customer.dtsx\"" /SERVER TORSQLSIS01 /ENVREFERENCE 2
    Microsoft (R) SQL Server Execute Package Utility
    Version 11.0.2100.60 for 32-bit
    Copyright (C) Microsoft Corporation. All rights reserved.
    Started:  10:21:55 AM
    Execution ID: 21138.
    To view the details for the execution, right-click on the Integration Services Catalog, and open the [All Executions] report
    Started:  10:21:55 AM
    Finished: 10:21:56 AM
    Elapsed:  0.766 seconds

    As per MSDN /ENVREFERENCE argument is used only by SQL Server Agent
    see
    https://msdn.microsoft.com/en-us/library/hh231187.aspx
    below part is what it says
    /Env[Reference] environment reference ID
    (Optional). Specifies the environment reference (ID) that is used by the package execution, for a package that is deployed to the Integration Services server. The parameters configured to bind
    to variables will use the values of the variables that are contained in the environment.
    You use /Env[Reference] option together with the /ISServer and the /Server options.
    This parameter is used by SQL Server Agent.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Execution of Immediate SQL in compiled package in two versions of SQL*PLUS

    A peculiar problem has risen in our database.
    Execution of Immediate SQL in compiled package in two versions of SQLPLUS gives different results
    We have a compiled package with two procedures that contain immediate SQL statements, and these are:
    +PROC_DELETE_ROWS+
    +     -- This immediate sql deletes unreferenced Document Types from the DOC_REF_TYPE table+
    +     delete from doc_ref_type t where exists (select 1 from PROARC_DOC_REF_TYPE_VW d where d.doc_ref_type = t.doc_ref_type)+
       +     and not exists (select 1 from doc_ref d where d.doc_ref_type = t.doc_ref_type)+
       +     and doc_ref_type not in (select doc_ref_type from eis_doc_ref_type)+
       +     and doc_ref_type not in (select eis_doc_ref_type from eis_doc_ref_type)+
    +PROC_ADD_NEW_ROWS+
    +     -- Drop the temporary table+
    +     drop table TMP_PROARC_DOC_REF_TYPE+
    +     -- Create a temporary table+
    +     create table tmp_PROARC_DOC_REF_TYPE as+
    +     select DOC_REF_TYPE, substr(DOC_REF_TYPE_DESC,1,100) as DOC_REF_TYPE_DESC+
    +     from PROARC_DOC_REF_TYPE_VW+
    +     -- Insert document types that do not exist in the DOC_REF_TYPE table+
    +     insert into doc_ref_type t (DOC_REF_TYPE, DOC_REF_TYPE_DESC)+
            +     select distinct DOC_REF_TYPE, DOC_REF_TYPE_DESC from tmp_PROARC_DOC_REF_TYPE s+
            +     where not exists (select 1 from doc_ref_type t where t.doc_ref_type = s.doc_ref_type)+
    I am using the following test script:
    +Exec mypackage.proc_delete_rows;+
    +Commit;+
    +Select count(*) from DOC_REF_TYPES;+
    +Exec mypackage.proc_add_new_rows;+
    +Commit;+
    +Select count(*) from DOC_REF_TYPES;+We have a Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit
    I am using SQL*Plus: Release 8.1.7.0.0
    The test script is working as expected.
    Count after delete =155
    Count after insert = 511
    but when I use another computer with SQL*Plus: Release 10.x
    The Test script returns the following
    Count after delete =155
    Count after insert =155
    The same is happening when I am running the scripts as a scheduled job.
    QUESTION:
    I believe I have found a fix for the problem though. By changing tmp_PROARC_DOC_REF_TYPE in the insert statement to all upper case, the script is running in both environments apparently. But how is this possible? I am executing a compiled package in the database. The session shell should have no impact on the behaveour of the procedure I am calling. What causes this?
    Edited by: Reon on Jun 16, 2011 4:44 AM

    1) I am using the same user (PANDORA)
    2) (PANDORA) for both
    3) I am actually not handling any errors. Just skipping any error altogether. I'll check to see what exceptions are raised, and come back.
    I have also noticed that SQL/PLUS is not the culprit here. If I use SQLTools 1.5 to run the script, the same thing happens. So it has to do something with the connection or session environment that is inheritet to both clients.
    The CODEZ:_
      procedure add_doc_types IS
      sqlstr     VARCHAR2(2000);
      begin
      BEGIN
           sqlstr := 'drop table TMP_PROARC_DOC_REF_TYPE';
         EXECUTE IMMEDIATE sqlstr;
        EXCEPTION
          WHEN OTHERS THEN
            null;
        END;
      BEGIN
           sqlstr := 'create table tmp_PROARC_DOC_REF_TYPE as select DOC_REF_TYPE, substr(DOC_REF_TYPE_DESC,1,100) as DOC_REF_TYPE_DESC from PROARC_DOC_REF_TYPE_VW';
         EXECUTE IMMEDIATE sqlstr;
        EXCEPTION
          WHEN OTHERS THEN
            null;
        END;
        BEGIN
            sqlstr := 'insert into doc_ref_type t (DOC_REF_TYPE, DOC_REF_TYPE_DESC)
                    select distinct DOC_REF_TYPE, DOC_REF_TYPE_DESC from TMP_PROARC_DOC_REF_TYPE s
                    where not exists (select 1 from doc_ref_type t where t.doc_ref_type = s.doc_ref_type)';
         EXECUTE IMMEDIATE sqlstr;
            sqlstr := 'update doc_ref_type t set DOC_REF_TYPE_DESC = (
                    select DOC_REF_TYPE_DESC from tmp_PROARC_DOC_REF_TYPE s
                    where t.doc_ref_type = s.doc_ref_type)
                    where exists (select 1 from tmp_PROARC_DOC_REF_TYPE s where t.doc_ref_type = s.doc_ref_type)';
         EXECUTE IMMEDIATE sqlstr;
        EXCEPTION
          WHEN OTHERS THEN
            null;
        END;
      end add_doc_types;
      procedure delete_doc_types IS
      sqlstr     VARCHAR2(2000);
       BEGIN
            sqlstr := 'delete from doc_ref_type t where exists (select 1 from PROARC_DOC_REF_TYPE_VW d where d.doc_ref_type = t.doc_ref_type)
            and not exists (select 1 from doc_ref d where d.doc_ref_type = t.doc_ref_type)
            and doc_ref_type not in (select doc_ref_type from eis_doc_ref_type)
            and doc_ref_type not in (select eis_doc_ref_type from eis_doc_ref_type)';
          EXECUTE IMMEDIATE sqlstr;
         EXCEPTION
           WHEN OTHERS THEN
             null;
      end delete_doc_types;Edited by: Reon on Jun 16, 2011 2:01 AM

  • Problem with XMLDOM package (Oracle 10.2.0.1.0)

    Hi,
    I am using the dbms_xmldom package to generate xml files (specific structure).
    Below is the code but It produces nothing (dbms_output does not return) :
    DECLARE
    doc xmldom.DOMDocument;
    main_node xmldom.DOMNode;
    root_node xmldom.DOMNode;
    root_elmt xmldom.DOMElement;
    transmissionHeaderNode xmldom.DOMNode;
    transmissionHeaderElement xmldom.DOMElement;
    item_node xmldom.DOMNode;
    item_elmt xmldom.DOMElement;
    item_text xmldom.DOMText;
    buffer_problem CLOB;
    BEGIN
    doc := xmldom.newDOMDocument;
    main_node := xmldom.makeNode(doc);
    xmldom.setversion(doc,'1.0');
    root_elmt := xmldom.createElement(doc, 'InvoiceTransmission');
    root_node := xmldom.appendChild( main_node, xmldom.makeNode(root_elmt));
    transmissionHeaderElement := xmldom.createElement(doc, 'TransmissionHeader');
    transmissionHeaderNode := xmldom.appendChild(root_node, xmldom.makeNode(transmissionHeaderElement));
    item_elmt := xmldom.createElement(doc, 'TransmissionDateTime');
    item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
    item_text := xmldom.createTextNode(doc, TO_CHAR(SYSDATE,'DD-MM-YYYY'));
    item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
    item_elmt := xmldom.createElement(doc, 'IssuingOrganiszationID');
    item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
    item_text := xmldom.createTextNode(doc,'0258');
    item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
    item_elmt := xmldom.createElement(doc, 'Version');
    item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
    item_text := xmldom.createTextNode(doc, 'IATA:ISXMLInvoiceV3.0');
    item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
    xmldom.writetobuffer(doc, buffer_problem);
    dbms_output.put_line(buffer_problem);
    xmldom.freeDocument(doc);
    END;
    That's strange because when remove a code part like :
    item_elmt := xmldom.createElement(doc, 'Version');
    item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
    item_text := xmldom.createTextNode(doc, 'IATA:ISXMLInvoiceV3.0');
    item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
    I can get the ouput xml :
    <?xml version="1.0"?>
    <InvoiceTransmission>
    <TransmissionHeader>
    <TransmissionDateTime>26-10-2010</TransmissionDateTime>
    <IssuingOrganiszationID>0258</IssuingOrganiszationID>
    </TransmissionHeader>
    </InvoiceTransmission>
    I don't if it's a problem with xmldom or with dbms_output package...
    Please someone can help me ?

    Works fine for me
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    SQL> set serveroutput on;
    SQL>
    SQL> DECLARE
      2     doc xmldom.DOMDocument;
      3     main_node xmldom.DOMNode;
      4     root_node xmldom.DOMNode;
      5     root_elmt xmldom.DOMElement;
      6 
      7     transmissionHeaderNode xmldom.DOMNode;
      8     transmissionHeaderElement xmldom.DOMElement;
      9     item_node xmldom.DOMNode;
    10     item_elmt xmldom.DOMElement;
    11     item_text xmldom.DOMText;
    12 
    13     buffer_problem CLOB;
    14 
    15  BEGIN
    16 
    17     doc := xmldom.newDOMDocument;
    18     main_node := xmldom.makeNode(doc);
    19     xmldom.setversion(doc,'1.0');
    20     root_elmt := xmldom.createElement(doc, 'InvoiceTransmission');
    21     root_node := xmldom.appendChild( main_node, xmldom.makeNode(root_elmt));
    22 
    23     transmissionHeaderElement := xmldom.createElement(doc, 'TransmissionHeader');
    24     transmissionHeaderNode := xmldom.appendChild(root_node, xmldom.makeNode(transmissionHeaderElement));
    25 
    26     item_elmt := xmldom.createElement(doc, 'TransmissionDateTime');
    27     item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
    28     item_text := xmldom.createTextNode(doc, TO_CHAR(SYSDATE,'DD-MM-YYYY'));
    29     item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
    30 
    31     item_elmt := xmldom.createElement(doc, 'IssuingOrganiszationID');
    32     item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
    33     item_text := xmldom.createTextNode(doc,'0258');
    34     item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
    35 
    36     item_elmt := xmldom.createElement(doc, 'Version');
    37     item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
    38     item_text := xmldom.createTextNode(doc, 'IATA:ISXMLInvoiceV3.0');
    39     item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
    40 
    41     --buffer_problem := 'a';  -- added to initialize clob
    42     xmldom.writetobuffer(doc, buffer_problem);  -- change to writetoclob
    43     dbms_output.put_line(buffer_problem);
    44     xmldom.freeDocument(doc);
    45 
    46  END;
    47  /
    <?xml version="1.0"?>
    <InvoiceTransmission>
      <TransmissionHeader>
        <TransmissionDateTime>26-10-2010</TransmissionDateTime>
        <IssuingOrganiszationID>0258</IssuingOrganiszationID>
        <Version>IATA:ISXMLInvoiceV3.0</Version>
      </TransmissionHeader>
    </InvoiceTransmission>Suggestions:
    - Use dbms_xmldom instead of just xmldom. Oracle changed the name in the 9i days and xmldom is a synonym to dbms_xmldom.
    - Use .writeToClob intead of .writeToBuffer
    - I would suggest trying to upgrade to .4 as you pick up a lot of improvements and bug fixes. Whether what you are encountering is a bug I cannot say but would seem so.
    - See the FAQ under your sign-in name to learn how to use the tag to format the code like I did above.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Retrieve SQL with filters applied from an Interactive Report

    I want to use an Interactive report as interface for providing parameters to a base report query.
    I would like to capture the full SQL code from the filtered interactive report and then run the sql to create a collection.
    I have found this tread
    Re: Using Data from filtered Interactive Report
    which says that you can use APEX_APPLICATION_PAGE_IR to access the reports SQL. This holds the information about the interactive report when the user saves it. The sql code from the interactive report (after the user has added filters) is stored in the field sql_query.I can only retrieve the base query and not the filtered version even after saving.
    Any ideas how this can be done would be appreciated.
    regards
    PP

    OK Darren I think I've got it working. My solution is an adaption that follows the steps of a blog I found here: http://stewstools.wordpress.com/2009/02/19/get-ir-where-clause/
    My solution allows you to click on a button and the records that are currently displayed in the IR report are saved to an APEX collection. You can then use the collection to save records to a table or run a report on another page. (I haven't included code for this last step but it's easy to find on the forum)
    First a bit of background knowledge. The following APEX views hold all the information on IRs that you access via PLSQL code in the package you need to download. Run an IR report, save a version of the report, then in SQL Workshop have a look at:
    select * from APEX_APPLICATION_PAGE_IR
    select * from APEX_APPLICATION_PAGE_IR_COND
    select * from APEX_APPLICATION_PAGE_IR_COL
    select * from APEX_APPLICATION_PAGE_IR_RPT
    When you run an IR report it has an internal ID that you can access and also a Base Id for each Saved report that is currently in context.
    Here are the steps:
    1) Download the following package and install it in the workspace schema
    http://www.mediafire.com/?nj118x9vmc9
    click on the link "click here to download"
    2)In the HTML header Attribute of the page where your IR runs, put the following Javascript:
    <!--===================================================================-->
    <!--FUNCTION TO RETRIEVE IR REPORTS SQL WITH WHERE CLAUSE
    <!--===================================================================-->
    <script language="JavaScript" type="text/javascript">
    function SaveAndRunReport() {
    document.location='f?p=&APP_ID.:3:&SESSION.:CONSTRUCT_IR_QUERY:NO::'+
    'P3_BASE_REPORT_ID:'+$v('apexir_REPORT_ID');
    </script>
    <!--===================================================================-->
    Notes: You will need to obviously change the URL above to reflect your Page No. (3) and the name of a HIDDEN Item (P3_BASE_REPORT_ID) that you will populate with the base ID of the report.
    Setting :P3_BASE_REPORT_ID to +$v('apexir_REPORT_ID') is an internal thing and works out of the box. It returns the Id of the Base report.
    3) Create a button called SELECT_SPECIMENS (in region position - top of region) in the IR region that will initiate the execution of the IR background SQL to create a collection with the current selected records.
    TARGET= URL
    URL Target = javascript:SaveAndRunReport();
    You might also want to create a condition that only shows the button when there are records selected
    CONDITION TYPE=Exists(SQL returns at least one row)
    EXPRESSION 1 - put the SQL of the IR report here.
    4)Create a branch back to the same page (3) and with the REQUEST attribute set to the value in the Javascript URL above e.g. CONSTRUCT_IR_QUERY. Create a condition on the branch that uses this branch WHEN BUTTON PRESSED= SELECT_SPECIMENS
    5) Create an AFTER HEADER PROCESS with the following code:
    declare
    v_base_query clob;
    v_where clob;
    v_query clob;
    v_base_where varchar2(12):=' where 1=1 '; -- incase there is no where clause in the base query
    begin
    if apex_collection.collection_exists('IR_COLLECTION') THEN
    htmldb_collection.delete_collection( p_collection_name => 'IR_COLLECTION');
    end if;
    --GET THE BASE QUERY OF THE IR REPORT
    select sql_query
    into v_base_query
    from APEX_APPLICATION_PAGE_IR
    where application_id=:APP_ID
    and page_id=:APP_PAGE_ID; -- you can only have one IR report per page
    --UNCOMMENT TO VIEW THE PARAMETERS TO THE PACKAGED FUNCTION
    --raise_application_error(-20001, :APP_ID||'-'||:APP_PAGE_ID||'-'||:SESSION||'-'||:P3_BASE_REPORT_ID);
    --GET THE SQL FILTER CODE
    select apex_ir_query.ir_query_where(:APP_ID,:APP_PAGE_ID,:SESSION,:P3_BASE_REPORT_ID)
    into v_where
    from dual;
    --CHECK TO SEE THAT THERE IS A "WHERE" CLAUSE IN THE BASE QUERY
    if instr(upper(v_base_query),'WHERE ') > 0 then
    v_query:=v_base_query||' '||v_where;
    else
    v_query:=v_base_query||' '||v_base_where||' '||v_where;
    end if;
    --UNCOMMENT TO SEE THE FULL QUERY SYNTAX
    --raise_application_error(-20001,v_query);
    --CREATE COLLECTION FROM IR RECORDS
    apex_collection.create_collection_from_query(P_collection_name=>'IR_COLLECTION',p_query=>v_query);
    exception
    when others then
    raise_application_error(-20001, 'Interactive report not found. Contact Administrator. Could not create collection of records.');
    end;
    remember to update P3_BASE_REPORT_ID above to your HIDDEN ITEM name.
    Set the following attributes for the process above
    CONDITIONAL PROCESSING
    CONDITION TYPE = Request=Expression 1
    EXPRESSION 1 --> CONSTRUCT_IR_QUERY (Note: this was set on the branch in step 4 above)
    6) Run the IR report, click on the "SELECT SPECIMENS" button then click on the Session link on the Developer's Toolbar and select VIEW COLLECTIONS from the popup list then click GO. You should now see the IR records.
    By the way I've been testing in IE not Firefox.
    ...and that's it!
    enjoy
    Paul P

  • Migrating SQL Server SSIS package to Oracle

    Dear All,
    We are using Microsoft SQL server 2005 in our application, we have two separate Server instances where one instance synchronize data from other server table using SQL Server SSIS package. What can be the counterpart of this functionality in Oracle. I have looked into materialized views but in my case the target table will have more columns than the base table, and the query used to get data from base table will extract some values from one of the BLOB type column of base table and then populate target table multiple columns.
    Kindly suggest me any solution.
    Best Regards
    Irfan

    You can start with Oracle doc,
    Oracle® Database PL/SQL User's Guide and Reference
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
    I don't think there's side by side comparison reference between them. Some syntax is very different.

  • Send mail from PL/SQL with an attachment

    Hi,
    Can any body help me on how to send a mail from PL/SQL with an attachment which is located on a unix system path.
    This is an urgent requirement in my current project. Any quick reply would be greatly appreciated.
    Thanks
    Kumar.

    Quick reply (too bad you didn't mention your DB-version):
    Check the docs @ http://tahiti.oracle.com regarding packages UTL_SMTP and UTL_MAIL
    Check http://asktom.oracle.com/pls/asktom/asktom.search?p_string=%22mail+attachment%22
    Check http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    Check http://www.oracle-base.com/articles/10g/PlsqlEnhancements10g.php#UTL_MAIL

  • If..then..else statement in SQL with 'generalized' conditions in the if sta

    it is possible to write something approaching an if..then..else statement in SQL with 'generalized' conditions in the if statement.
    Attached is the query for the payment register, in which I've written a series of decode statements, one for each possible value of the payment code. The query works OK - however, its specific and as the number of paycodes expand (and they do), the report won't pick up the new paycode until the code is changed. More importantly, the report won't be correct until someone 'discovers' that a paycode is missing, which might take months.
    If I were writing the equivalent of this series of decode statements in Focus, it would be something like this:
    DEFINE.......
    PAYMED/D12.2 = IF PAYMENT_CD LE 18
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYIND/D12.2 = IF PAYMENT_CD GE 19 AND PAYMENT_CD LE 49
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYEXP/D12.2 = IF PAYMENT_CD GE 70
                   THEN PAYMENT_AMT
                   ELSE 0 ;
    PAYREC/D12.2 = IF PAYMENT_CD GE 50 AND PAYMENT_CD LE 69
                   THEN PAYMENT_AMT
                   ELSE 0;
    END
    IN SQL/PLUS:
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(PAYMENT_CD, 20, PAYMENT_AMT, 21, PAYMENT_AMT,
    22, PAYMENT_AMT, 23, PAYMENT_AMT, 25, PAYMENT_AMT,
    26, PAYMENT_AMT, 27, PAYMENT_AMT, 28, PAYMENT_AMT,
    29, PAYMENT_AMT, 30, PAYMENT_AMT, 31, PAYMENT_AMT,
    32, PAYMENT_AMT, 33, PAYMENT_AMT, 34, PAYMENT_AMT,
    35, PAYMENT_AMT, 36, PAYMENT_AMT, 37, PAYMENT_AMT,
    39, PAYMENT_AMT, 40, PAYMENT_AMT, 41, PAYMENT_AMT,
    42, PAYMENT_AMT, 43, PAYMENT_AMT, 44, PAYMENT_AMT,
    45, PAYMENT_AMT, 46, PAYMENT_AMT, 47, PAYMENT_AMT,
    48, PAYMENT_AMT, 49, PAYMENT_AMT, NULL) INDEMNITY,
    DECODE(PAYMENT_CD, 0, PAYMENT_AMT, 1, PAYMENT_AMT,
    2, PAYMENT_AMT, 3, PAYMENT_AMT, 4, PAYMENT_AMT,
    5, PAYMENT_AMT, 6, PAYMENT_AMT, 7, PAYMENT_AMT,
    8, PAYMENT_AMT, 9, PAYMENT_AMT, 10, PAYMENT_AMT,
    11, PAYMENT_AMT, 12, PAYMENT_AMT, 13, PAYMENT_AMT,
    14, PAYMENT_AMT, 15, PAYMENT_AMT, 18, PAYMENT_AMT,
    17, PAYMENT_AMT, NULL) MEDICAL,
    DECODE(PAYMENT_CD, 70, PAYMENT_AMT, 71, PAYMENT_AMT,
    72, PAYMENT_AMT, 73, PAYMENT_AMT, 74, PAYMENT_AMT,
    75, PAYMENT_AMT, 76, PAYMENT_AMT, 77, PAYMENT_AMT,
    78, PAYMENT_AMT, 79, PAYMENT_AMT, 80, PAYMENT_AMT,
    81, PAYMENT_AMT, 82, PAYMENT_AMT, 83, PAYMENT_AMT,
    84, PAYMENT_AMT, 85, PAYMENT_AMT, 86, PAYMENT_AMT,
    87, PAYMENT_AMT, 88, PAYMENT_AMT, 89, PAYMENT_AMT,
    90, PAYMENT_AMT, NULL) EXPENSES,
    DECODE(PAYMENT_CD, 50, PAYMENT_AMT, 51, PAYMENT_AMT,
    52, PAYMENT_AMT, 53, PAYMENT_AMT, 54, PAYMENT_AMT,
    55, PAYMENT_AMT, 56, PAYMENT_AMT, 57, PAYMENT_AMT,
    58, PAYMENT_AMT, NULL) RECOVERIES,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH,
    DATE_FROM_SERVICE,
    DATE_THRU_SERVICE
    FROM &INPUT_TABLES
    WHERE &SECURITYCOND
    DATE_OF_PAYMENT BETWEEN :START_DATE AND :END_DATE
    ORDER BY LOCATION_1, CPO_CHECK_NBR
    As you can see, this is both much easier to write and covers the possibility of expansion of paycodes (expansions always fit in these defined ranges).
    My question is, then, is it possible to write something like this in SQL and, if so, could you give me some sample code? (I'm one of those people who learn best from looking at the code as opposed to a set of instructions)

    Here is one way you could do it.
    Create a table that has columns like:
    Payment_code varchar2(2),
    Effective_Date Date,
    Payment_type varchar2(20),
    Expiration_Date Date)
    Payment type for example could be
    I- indemnity
    M- medical
    R- recovery
    E- expenses
    Let the table name for example be PAYMENT_CODE.
    The select query would look like
    SELECT ACCOUNT_NAME,
    LOCATION_1,
    CLMNT_LAST_NAME,
    CLAIM_NBR,
    DATE_OF_INJURY,
    DATE_CHECK_REGISTER,
    PAYEE_NAME_1,
    PAYMENT_CD,
    SERV_OFC,
    CPO_CHECK_NBR,
    PAYMENT_FORM,
    DECODE(p.payment_type,'E',PAYMENT_AMOUNT,0) expenses,
    DECODE(p.payment_type,'I',PAYMENT_AMOUNT,0) indemnity,
    DECODE(p.payment_type,'M',PAYMENT_AMOUNT,0) Medical,
    DECODE(p.payment_type,'R',PAYMENT_AMOUNT,0) recoveries,
    DECODE(PAYMENT_FORM, 'N', PAYMENT_AMT, NULL) NONCASH
    FROM &INPUT_TABLES,
    PAYMENT_CODE P
    WHERE P.PAYMENT_CODE = SOMEINPUT_TABLE.PAYMENT_CODE
    and other conditions
    The idea is to group all the payment codes into a few groups to reduce the clutter. If there is ever a change to the payment code, you could modify the table and it will be reflected in your select query.

  • With one package of Adobe Creative Suite 2 and the upgrade CS5 how many computers can use it?

    With one package of Adobe Creative Suite 2 and the upgrade CS5 how many computers can use it?

    You have 2 activations and no more.
    Mylenium

  • Unable to update itunes. help. error message when trying to update to latest version of itunes. "the installer has encountered an unexpected error installing this package. this may indicate a problem with this package. error code 2721"

    unable to update itunes. help. error message when trying to update to latest version of itunes. "the installer has encountered an unexpected error installing this package. this may indicate a problem with this package. error code 2721"

    Hello chae84swangin,
    I recommend following the steps in the article below when getting an error message trying to install iTunes:
    Trouble installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • I have Adobe Reader XI with the package that allows me to send pdfs and convert pdfs to Word. When I open a pdf and try to search the search shows no matches even though the word I am searching for is in the document. Any suggestions how to search?

    I have Adobe Reader XI with the package that allows me to send pdfs and convert pdfs to Word. When I open a pdf and try to search the search shows no matches even though the word I am searching for is in the document. Any suggestions how to search?

    Once again, my thanks for your assistance. If I may impose on your generosity one more time, if I understand you correctly if I create a document on Word or WordPerfect, print it and scan it to create a pdf, the search function will not work. But, if I create the pdf document in Word the search function will work. Unfortunately, I am not sure how I create a pdf document in Word other than by printing it and scanning it. Could you please explain.
    William B. Kohn, Esq.
    General Counsel
    Paul V. Profeta & Associates, Inc.
    769 Northfield Avenue
    Suite 250
    West Orange, New Jersey 07052
    (973) 325 - 1300
    (973) 325 - 0376 (Facsimile)
    [email protected]<mailto:[email protected]>

  • HI , I, ON THE MONTH TO MONTH BILLING FOR Ps AND Lr ($9.99) ... i downloaded Ps but now want to download Lr ... how do i do that because it only gives me the option to take it on a month to month wit the $9.99 .... isn't it included with the package im cu

    HI , I, ON THE MONTH TO MONTH BILLING FOR Ps AND Lr ($9.99) ... i downloaded Ps but now want to download Lr ... how do i do that because it only gives me the option to take it on a month to month wit the $9.99 .... isn't it included with the package im currently on ??

    Niel.v.d.h please utilize the steps listed in Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html to install Photoshop Lightroom through the Creative Cloud Desktop application.

  • Load of big files in BPC with import package

    HI,
    I need to import many files (.txt) with 1,5 million of data lines in BPC with import package.
    But BPC is limited to 500 000 lines for each import.
    Have you got a solution ?
    Thanks,
    Morgann

    Morgann,
    You have two options.
    1. use import into FACT table -> Cons : System will be offline.  Pros : faster performance. No limit
    2. if you should use import package,  split file and put it into one folder and create a custom package that will handle those data file one by one.      Cons : Need to make a custom package   Pros : No system offline.
    I hope it will help you.
    Thanks.
    James Lim

  • Problem in SQL with CURSOR( ) ,Why the CURSOR did not work?

    hi All:
    I have a problem in SQL with CURSOR.
    The data is as the attachments.
    Here is the SQL statement as follow:
    SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
    FROM F3102 X
    WHERE X.IGDOCO=A.WADOCO
    AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
    FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
    WHERE A.WADOCO='10004'
    The statement above returns records as follow:
    WADC WADOCO IGCOST DETAIL
    WO 10004 A1 CURSOR STATEMENT : 4
    CURSOR STATEMENT : 4
    IGLITM
    1KV90CPG2
    1KV90CPG2
    1KV90CPG2
    But, after I add one statement in the subquery, there is no record returned from CURSOR.
    Here is the SQL statement:
    SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
    FROM F3102 X
    WHERE X.IGDOCO=A.WADOCO
    AND X.IGCOST=B.IGCOST
    AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
    FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
    WHERE A.WADOCO='10004'
    The statement above returns records as follow:
    WADC WADOCO IGCOST DETAIL
    WO 10004 A1 CURSOR STATEMENT : 4
    CURSOR STATEMENT : 4
    no rows selected
    Why the CURSOR did not work?
    The database version is Oracle Database 10g Release 10.2.0.4.0 - 64bit Production.
    F3102 DATA:
    IGDOCO     IGDCTO     IGLITM     IGCOST
    10004     WO     1KV90CPG2      A1
    10004     WO     1KV90CPG2      B1
    10004     WO     1KV90CPG2      C3
    10004     WO     1KV90CPG2      D1
    F4801 DATA:
    WADCTO     WADOCO
    WO     10004
    Edited by: user2319139 on 2010/3/2 上午 1:17
    Edited by: user2319139 on 2010/3/2 上午 1:20

    Why this structure and not a join?
    The cursor() function returns a cursor handle that needs to be processed - in other words, the client needs to fetch data from it. The Oracle® Database SQL Reference+ (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions005.htm#i1035107) describes it as being equivalent to a ref cursor handle.
    Thus why are you creating ref cursor handles as a column in a SQL projection - where each row will have a "+nested+" ref cursor handle to process. What problem are you attempting to hack solve this way?

Maybe you are looking for

  • How to register the Extended Warranty in Finland

    Hello I recently bought a Toshiba laptop with the extended warranty. When I registered the laptop there was a message that I should send copy of the receipt by e-mail. I accidentaly clicked the message away and forgot what the e-mail address was. Cou

  • Control exceptions or errors in procedure

    Hy , I have a proceducre like this: CREATE OR REPLACE PROCEDURE "MY_PROCEDURE"( ) AS BEGIN INSERT INTO tableBackupTable1 SELECT table1.* FROM table1; INSERT INTO tableBackupTable2 SELECT table1.* FROM table2; */*Disable FK*/* for i in (select constra

  • How to import bank statement file to B1 2005A patch 22? ????

    Dear All, We are using B1 2005A patch 22, Australia base. Our customer wants to import Bank statement file to B1. By far we can't find a way to import a file in to bank reconciliation yet. Thank you in advance.

  • Details about netweaver - please

    Hai gurus, In my company, management have decided to get the projects related to <b>Netweaver.</b> I want to know, <b>1. What is Netweaver?. 2. How it is related to SAP?. 3. What are the components needed for netweaver to connect with SAP?. 4. How it

  • Channel Mixer Tutorials/Book woes

    For my class ( I have a student assistant position) we bought the new CS4 book, (Studio Techniques) and it doesn't come with a CD, which means no pictures or files. We are having trouble with exercises for the class and  was wondering if anyone had f