ORA-02019 while using DBMS_FILE_TRANSFER Package.

Hi,
I am trying to transfer the datafiles from 10.2.0.3 database residing on File-system to 11gR2 database residing on ASM. Both the DBs are on Different machines across datacenters.
I am trying to use Transportable Tablespace to move the data. As a part of it, I am trying to use DBMS_FILE_TRANSFER package to move the 10gR2 files to 11gR2 ASM.
I am getting the below issue while doing so:
SQL> exec sys.DBMS_FILE_TRANSFER.GET_FILE('sdir','data01.dbf','tdir','data01.dbf','RECDB');
BEGIN sys.DBMS_FILE_TRANSFER.GET_FILE('sdir','data01.dbf','tdir','data01.dbf','RECDB'); END;
ERROR at line 1:
ORA-02019: connection description for remote database not found
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 37
ORA-06512: at "SYS.DBMS_FILE_TRANSFER", line 132
ORA-06512: at line 1
Above SQL was executed from Target Host (11gR2) to GET file from 10gR2. The above directory objects point to correct locations on respective hosts.
RECDB - it is the DB link which is owned by SYSTEM user and will connect to 10gR2 DB as SYSTEM user.
Strange thing is when i am querying the source 10gR2 DB from Target DB using Db link, IT is WORKING fine
SQL> select name from v$database@RECDB ;
NAME
POCREC01
Elapsed: 00:00:00.15
SQL> select * from dual@RECDB;
D
X
Elapsed: 00:00:00.12
I also have TNS entry in target tnsnames.ora as:
POCREC01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pocserver.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pocrec01)
SQL> create database link RECDB connect to system identified by <password> using 'POCREC01';
Database link created.
SQL> select * from all_db_links;
OWNER
DB_LINK
USERNAME
HOST
CREATED
SYSTEM
RECDB
SYSTEM
POCREC01
05-JAN-11
So, I want help on whether above issue is a BUG with Package (checked in Metalink and cannot find anything) OR am I doing something wrong??
Thanks

Can you please use "create public database link " to create the db link as a PUBLIC link and retry.

Similar Messages

  • ORA-03123 while using UTL_FILE package in oracle forms 10g

    hi all,
    i have created a directory 'REPORTS' as 'E:\EXCEL_TESTING_FORM\' and give grant read,write this directory to scott.
    and also given grant execute on UTL_FILE to scott;
    i have written this code in a button-pressed trigger and my file name is somename.xls file
    After printing the first line like 7369SMITH3000 in a single cell when it is going to print the second employee record it is showing
    ORA-03123 inside the loop.
    CURSOR EMP_DATA IS
         SELECT * FROM SCOTT.EMP;
    C_REF EMP_DATA%ROWTYPE;
    L_FILE UTL_FILE.FILE_TYPE;
    V_PATH VARCHAR2(200) := '';
    BEGIN
         V_PATH := 'REPORTS';
    L_FILE := UTL_FILE.FOPEN (V_PATH,P_FILE_NAME, 'W');
    OPEN EMP_DATA;
    LOOP
         FETCH EMP_DATA INTO C_REF;
         EXIT WHEN EMP_DATA%NOTFOUND;
              UTL_FILE.PUT_LINE(L_FILE, TO_CHAR(C_REF.EMPNO));
              UTL_FILE.PUT_LINE(L_FILE, C_REF.ENAME);
              UTL_FILE.PUT_LINE(L_FILE, TO_CHAR(C_REF.SAL));
    END LOOP;
    CLOSE EMP_DATA;
    UTL_FILE.FFLUSH(L_FILE);
    UTL_FILE.FCLOSE(L_FILE);
    please guide me how to avoid that error and also how to print cell wise why because it is print in a single cell.
    please reply...

    hi Andreas Weiden,
    No it is not a network-drive. i have total 0f 3 drives
    one is of c drive for wind sp2 and in d i have loaded oracle database and i have created a directory on e drive i.e 'E:\EXCEL_TESTING_FORM\'
    in that i have created a excel file i.e called taru.xls.
    so i want to know where is the problem.
    please reply...

  • Error while using UTL_FILE package

    I am getting error while using UTL_FILE package in apex 3.0 version
    Pls help me out.

    ok, how are you using UTL_FILE and what is the error?

  • Error while using UTL_DBWS package

    Hello
    I want to call a web service using UTL_DBWS package as explained in this link.
    http://www.oracle-base.com/articles/10g/utl_dbws10g.php
    I implemented the example successfully, and I need to my own web service.
    my web service is just a java class that return a hello world and a parameter. deployed on Integrated weblogic server shipped with Jdeveloper11g.
    here is my java class
    package ws;
    import javax.jws.Oneway;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    @WebService
    public class HelloWorld {
        public HelloWorld() {
        @WebMethod(action = "http://ws//sayHelloWorld")
        public String sayHelloWorld(){
            return "Hello World";
        @WebMethod(action = "http://ws//sayHelloWorld")
        public String sayHelloName(@WebParam(name = "arg0")
            String n){
            return "Hello " + n;
    }my WSDL is
      <?xml version="1.0" encoding="UTF-8" ?>
    - <!--  Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.
      -->
    - <!--  Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Oracle JAX-WS 2.1.5.
      -->
    - <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws/" name="HelloWorldService">
    - <types>
    - <xsd:schema>
      <xsd:import namespace="http://ws/" schemaLocation="http://127.0.0.1:7101/Application15-Model-context-root/HelloWorldPort?xsd=1" />
      </xsd:schema>
      </types>
    - <message name="sayHelloWorld">
      <part name="parameters" element="tns:sayHelloWorld" />
      </message>
    - <message name="sayHelloWorldResponse">
      <part name="parameters" element="tns:sayHelloWorldResponse" />
      </message>
    - <message name="sayHelloName">
      <part name="parameters" element="tns:sayHelloName" />
      </message>
    - <message name="sayHelloNameResponse">
      <part name="parameters" element="tns:sayHelloNameResponse" />
      </message>
    - <portType name="HelloWorld">
    - <operation name="sayHelloWorld">
      <input message="tns:sayHelloWorld" />
      <output message="tns:sayHelloWorldResponse" />
      </operation>
    - <operation name="sayHelloName">
      <input message="tns:sayHelloName" />
      <output message="tns:sayHelloNameResponse" />
      </operation>
      </portType>
    - <binding name="HelloWorldPortBinding" type="tns:HelloWorld">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    - <operation name="sayHelloWorld">
      <soap:operation soapAction="http://ws//sayHelloWorld" />
    - <input>
      <soap:body use="literal" />
      </input>
    - <output>
      <soap:body use="literal" />
      </output>
      </operation>
    - <operation name="sayHelloName">
      <soap:operation soapAction="http://ws//sayHelloWorld" />
    - <input>
      <soap:body use="literal" />
      </input>
    - <output>
      <soap:body use="literal" />
      </output>
      </operation>
      </binding>
    - <service name="HelloWorldService">
    - <port name="HelloWorldPort" binding="tns:HelloWorldPortBinding">
      <soap:address location="http://127.0.0.1:7101/Application15-Model-context-root/HelloWorldPort" />
      </port>
      </service>
      </definitions>and my function is to call the web service
    CREATE OR REPLACE FUNCTION SAYHelloMYNAME (p_int_1 IN Varchar2)
      RETURN NUMBER
    AS
      l_service          UTL_DBWS.service;
      l_call                 UTL_DBWS.call;
      l_wsdl_url         VARCHAR2(32767);
      l_namespace        VARCHAR2(32767);
      l_service_qname    UTL_DBWS.qname;
      l_port_qname       UTL_DBWS.qname;
      l_operation_qname  UTL_DBWS.qname;
      l_xmltype_in        XMLTYPE;
      l_xmltype_out       XMLTYPE;
      l_return          VARCHAR2(100);
    BEGIN
      l_wsdl_url        := 'http://127.0.0.1:7101/Application15-Model-context-root/HelloWorldPort?wsdl';
      l_namespace       := 'http://ws/';
      l_service_qname   := UTL_DBWS.to_qname(l_namespace, 'HelloWorldService');
      l_port_qname      := UTL_DBWS.to_qname(l_namespace, 'HelloWorldPort');
      l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'sayHelloName');
       l_service := UTL_DBWS.create_service (
        wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
        service_name           => l_service_qname);
      l_call := UTL_DBWS.create_call (
        service_handle => l_service,
        port_name      => l_port_qname,
        operation_name => l_operation_qname);
      l_xmltype_in :=  XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
        <sayHelloWorld xmlns="' || l_namespace || '">
          <parameters>' || p_int_1 || '</parameters>
          </sayHelloWorld>');
      l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
                                       request     => l_xmltype_in);
      UTL_DBWS.release_call (call_handle => l_call);
      UTL_DBWS.release_service (service_handle => l_service);
      l_return := l_xmltype_out.extract('//return/text()').getstringVal();
      RETURN l_return;
    END;
    /but when I test the function I get this error
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2ee.ws.common.tools.api.WsdlValidationException: Failed to read wsdl file at: "http://127.0.0.1:7101/Application15-Model-context-root/HelloWorldPort?wsdl", caused by: java.net.ConnectException.    : Connection refused
    ORA-06512: at "WSUSER.UTL_DBWS", line 193
    ORA-06512: at "WSUSER.UTL_DBWS", line 190
    ORA-06512: at "WSUSER.SAYHELLOMYNAME", line 24any suggestions?

    M.Jabr wrote:
    can you elaborate more on this?
    I can open http://127.0.0.1:7101/Application15-Model-context-root/HelloWorldPort?wsdl
    on my browser.Is your browser on that Oracle server? You are instructing Oracle server code (the UTL_DBWS package) to access that URL.
    The IP in that URL is a localhost IP address - and that means using the local IP stack only. So it expects a web server on the Oracle server platform on tcp port 7101. It cannot use that IP to access your client/development machine.
    How can I test it using UTL_HTTP?You can write a basic web browser, minus the rendering engine, using UTL_HTTP. You can also use it for web service calls - which is my preference as I deem the UTL_DBWS package to clunky and complex.
    See:
    {message:id=1925297} (sample PL/SQL web browser)
    {message:id=4205205} (sample PL/SQL web browser SOAP call)

  • Error while using DBMS_XMLSave package...

    Hi All,
    I am using DBMS_XMLSave package and when I try to execute the following code, it is giving me error "Java call terminated by uncaught Java exception:"
    I am executing following code ....
    declare
    insCtx DBMS_XMLSave.ctxType;
    begin
    insCtx := DBMS_XMLSave.newContext('scott.emp');
    end;
    I am getting following error ...
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.lang.ExceptionInInitializerError
    ORA-06512: at "SYS.DBMS_XMLSAVE"
    ORA-06512: at line
    Please help me to overcome the problem....
    Thanx in advance ,
    Yogesh

    Found maybe an applicable reference...
    On http://publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.was.doc/html/Java_2_Connectivity_(J2C)/1163246.html
    it says:
    * Application code is missing a setXXX method call somewhere.
    * There might be a problem in the Oracle JDBC driver code.
    If the latter is the problem than you should or try a different JDBC driver or (which is probably the best solution anyway) create an iTar with Oracle support via metalink.oracle.com
    Other references can also be found on the internet when using google which could be applicable. Search on keywords: "Missing IN or OUT parameter at index"
    Message was edited by:
    mgralike

  • Error  ORA-02019: while selecting table from oracle10g to SQL Server 2005

    Hi all,
    our oracle 10g database is on AIX 5.2 and i configures heterogeneous service and install oracle 10g cleint on windows 2003 server where SQL Server reside . i configured the following things but i got the error ORA-02019. please help me its very urgent. quick response will higly appreciated. thanks alot in advance.
    1)create Sytem DSN (mysqlserver) by selectin SQL Native cleint
    2)copy the existing entry and paste it in listener.ora file and edit it as below
    LISTENERMYSQLSERVERDSN =
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST= hostname of oracle database)(PORT=1521))
    (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
    SID_LIST_ =
    (SID_LIST=
    (SID_DESC=
    (SID_NAME= mysqlserver)
    (ORACLE_HOME = /u01/app/oracle/product/101)
    (PROGRAM=hsodbc)
    $lsnrctl status LISTENERMYSQLSERVERDSN
    It is working fine
    3) configure TNAMES.ora
    mysqlserver =
    (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 100.100.50.5)
    (PORT = 1521)
    (CONNECT_DATA =
    (SID = mysqlserver)
    (HS = OK)
    c:>tnsping mysqlserver
    it is workin fine
    4)copy inithsodbc.ora and make it initmysqlserver.ora
    HS_FDS_CONNECT_INFO = mysqlserver
    HS_FDS_TRACE_LEVEL = off
    4)create the database link
    sql>create database link mysqlserver
    connect to "sa" identified by "nsp@123" using 'mysqlserver';
    when i selecting SQL Server object from oracle i got below error
    SQL> select * from NSP_products@mysqlserver;
    select * from NSP_products@mysqlserver
    ERROR at line 1:
    ORA-02019: connection description for remote database not found
    pLease help me its very urgent.
    BEST REGARD

    Hi all,
    our oracle 10g database is on AIX 5.2 and i configures heterogeneous service and install oracle 10g cleint on windows 2003 server where SQL Server reside . i configured the following things but i got the error ORA-02019. please help me its very urgent. quick response will higly appreciated. thanks alot in advance.
    1)create Sytem DSN (mysqlserver) by selectin SQL Native cleint
    2)copy the existing entry and paste it in listener.ora file and edit it as below
    LISTENERMYSQLSERVERDSN =
    (ADDRESS_LIST=
    (ADDRESS=(PROTOCOL=tcp)(HOST= hostname of oracle database)(PORT=1521))
    (ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY)))
    SID_LIST_ =
    (SID_LIST=
    (SID_DESC=
    (SID_NAME= mysqlserver)
    (ORACLE_HOME = /u01/app/oracle/product/101)
    (PROGRAM=hsodbc)
    $lsnrctl status LISTENERMYSQLSERVERDSN
    It is working fine
    3) configure TNAMES.ora
    mysqlserver =
    (DESCRIPTION =
    (ADDRESS =
    (PROTOCOL = TCP)
    (HOST = 100.100.50.5)
    (PORT = 1521)
    (CONNECT_DATA =
    (SID = mysqlserver)
    (HS = OK)
    c:>tnsping mysqlserver
    it is workin fine
    4)copy inithsodbc.ora and make it initmysqlserver.ora
    HS_FDS_CONNECT_INFO = mysqlserver
    HS_FDS_TRACE_LEVEL = off
    4)create the database link
    sql>create database link mysqlserver
    connect to "sa" identified by "nsp@123" using 'mysqlserver';
    when i selecting SQL Server object from oracle i got below error
    SQL> select * from NSP_products@mysqlserver;
    select * from NSP_products@mysqlserver
    ERROR at line 1:
    ORA-02019: connection description for remote database not found
    pLease help me its very urgent.
    BEST REGARD

  • Help! ORA-03113 while compiling certain packages!

    Hello everyone
    Recently we migrated our PLSQL code from Oracle 8.1.7.0 to 9.2.0.4.
    While compiling our packages in 9i, we are getting the ORA-03113: end-of-file on communication channel error.
    This happens only when we compile two particular packages.
    And then when we connect again immediately, and recompile the same package, it gets compiled.
    This is only happening for two packages, frequently. All other packages are not giving this error.
    Why could this be happening? Any pointers to this would really help.
    Thanks
    Bob

    ORA-3113 often throws a .TRC file in the USER_DUMP_DEST directory. That might give you a clue.
    Cheers, APC

  • ORA-6508 while using attached PL-SQL library [SOLVED]

    Hi all,
    we use Developer 10.1.2.0.2 on Windows XP Professional SP 2.
    We have a Linux-based ( 2.6.5-7.287.3) OAS (10.1.2.0.2).
    We received ORA-6508 while starting a report from within a menu. In fact all reports led to the same mistake. I must admit that they all worked fine before. We found a workaround for this problem by recompiling the attached PL-SQL library. The question is: what caused the loss of information ? What reasons can be imagined for such a behaviour ?
    Regards
    Frank
    Message was edited by:
    fwb

    Hi Christian,
    what we have is:
    We have a .mmx in production for quite a while. Within the .mmx you can start several reports by selecting an entry of the menu. It all works without problems. Then suddenly by choosing one of the reports you face ORA-6508 (something that has never happend before even though we made no changes to the system - at least I have no knowledge of any ;)
    The .pll which I recompiled is attached to the menu (.mmb). Recompiling the .pll fixes the issue.
    Regards
    Frank
    Message was edited by:
    fwb

  • Error while using Copy Package

    Hi,
    I want to copy data from category BudgetV1 to BudgetV2,
    I have tried to use Copy Package but I always get error with
    error message "The file is empty".
    Can anyone help me with the problem?
    Thanks in advance.

    Hi,
    Please check if you have data in category BudgetV1. This error normally occurs when there is no data in source specified in COPY package. Make sure to select appropriate members when you specify other source dimensions.
    Hope this helps.
    Regards,
    Shoba

  • Error while using Mail Package for dynamic email address - XMLScanException

    Hi All,
        i am trying to implement File_to_Mail Scanrio. Here i am using mail package stuff to make use the dynamic mail Id's. i am following the blog /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address. i have finished all the settings as per the blog but it throwing the following error
    failed to send mail: com.sap.aii.messaging.util.XMLScanException: expecting start tag: Mail, but found Mail at state 1
    Please help me to resolve this error.
    Thanks in advance
    -Siva
    Edited by: Siva Ram on Jan 18, 2008 7:43 AM
    Edited by: Siva Ram on Jan 18, 2008 7:43 AM
    Edited by: Siva Ram on Jan 18, 2008 7:44 AM
    Edited by: Siva Ram on Jan 18, 2008 7:44 AM
    Edited by: Siva Ram on Jan 21, 2008 5:59 AM

    Hi Siva
    check with these threads discuss the same XMLScanException
    Mail adapter fails when using Mail Package Format
    Error in E-mail Adapter - Message protocol XIALL
    Mapping Error with mail package
    Error in Mail Adapter
    See the below links also
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address
    /people/sravya.talanki2/blog/2005/08/18/triggering-e-mails-to-shared-folders-of-sap-is-u
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
    Error in Mail Adapter
    Mapping Error with mail package
    Regards
    Abhishek

  • Error while using UTP_MAIL package in oracle 10g

    Hi,
    I am using the UTP_MAIL package to send a mail from oracle 10g.
    I hane connected to the database as sysdba,but while setting the SMTP_SERVER_OUTPUT parameter i get the following error.
    SQL> ALTER SYSTEM SET smtp_out_server='blrkecmbx02.ad.abc.com:25' scope=both;
    ERROR at line 1:
    ORA-02095: specified initialization parameter cannot be modified
    Pls help to figure out a solution.

    This parameter is not modifiable, check the Oracle Reference: SMTP_OUT_SERVER Initialization Parameter
    Try the scope=spfile instead of both.
    ~ Madrid

  • Error while using utl_http package

    Hi Guys,
    I need some help with the utl_http package
    The problem that Iam facing is as follows :
    Iam trying to use the Oracle provided package utl_http
    package to send an http request to a particular
    website.However Iam getting the request_failed
    exception.
    I type in the foll.command in sqlplus:
    select utl_http.request('http://www.oracle.com') from
    dual
    and I get the foll.error---
    ERROR at line 1:
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "SYS.UTL_HTTP", line 174
    ORA-06512: at line 1
    If I try and trap the exception it shows
    request_failed exception.
    If any one has any clue on how to resolve this -- >please reply ASAP .
    Thanks

    Is it possible that your database sits behind a firewall? If so, you need to specify the proxy in utl_http.request.

  • ORA-32036 while using WITH

    I will include the query below my question as it is very long.
    I am using Microsoft SQL Server Reporting Services to connect to an Oracle Database (9i v 2). When I put in the query below I get the following error coming from the Oracle Server -
    "TITLE: Microsoft Report Designer
    An error occurred while executing the query.
    ORA-32036: unsupported case for inlining of query name in WITH clause"
    I found an explanation for this error - "     There is at least one query name which is inlined more than once because it's definition query is too simple and references another query name. This is currently unsupported yet." - and taking out the sub-queries one by one it seems to be COMBINE_TWO sub-query that causes the issue. Apparently it doesn't like the Select * from BLAHBLAH and finds it to be unecessary. I have made this query using nested selects - but the code gets redundant and I end up having to use the same query two or three times....the whole statement takes far too long to execute.
    Any coding suggestions or workaround suggestions would be appreciated - I have been looking at this problem so long that I have tunnel vision. There has to be a fix or a better way...
    Thanks!
    Brett
    Here is the query....
    WITH 
      /*This query finds all pending WO's and caculates all changing service
      levels for limited, basic, internet and phone.  Any values that do not
      change are kept at null, any services being disconnected are dropped to a negative
      and service being upgrades and/or downgraded but still kept are valued
      at their to_quantity value. */
      STEP_1 AS
        SELECT
          WO.ACCOUNT_NUMBER,
          WO.WORK_ORDER_NUMBER,
          WO.WO_TYPE,
          WOD.SERVICE_CODE,
          CASE WHEN WOD.SERVICE_CODE = '101' AND WOD.FROM_QUANTITY != WOD.TO_QUANTITY THEN WOD.TO_QUANTITY - WOD.FROM_QUANTITY ELSE NULL END LIM,
          CASE WHEN WOD.SERVICE_CODE = '111' AND WOD.FROM_QUANTITY != WOD.TO_QUANTITY THEN WOD.TO_QUANTITY - WOD.FROM_QUANTITY ELSE NULL END EXP,
          CASE WHEN WOD.SERVICE_CODE = '30001' AND WOD.FROM_QUANTITY != WOD.TO_QUANTITY THEN WOD.TO_QUANTITY - WOD.FROM_QUANTITY ELSE NULL END HSI,
          CASE WHEN WOD.SERVICE_CODE IN ('LINE FL', 'ULTS FL') AND WOD.FROM_QUANTITY != WOD.TO_QUANTITY THEN WOD.TO_QUANTITY - WOD.FROM_QUANTITY ELSE NULL END PHONE
        FROM
          KAN_WORK_ORDER_MASTER WO INNER JOIN KAN_WORK_ORDER_DETAIL WOD ON WO.WORK_ORDER_NUMBER = WOD.WORK_ORDER_NUMBER
        WHERE
          WO.WO_TYPE IN ('DI', 'DW', 'IN', 'SR', 'UP')
          AND WOD.SERVICE_CODE IN ('101', '111', '30001', 'LINE FL', 'ULTS FL')
          AND POOL = 'A'
          AND WO_STATUS = ' '),
    /* This adds all values from step 1 and condenses all work orders
    into one row, a value for each service. */
    STEP_2 AS
        SELECT
          ACCOUNT_NUMBER,
          WORK_ORDER_NUMBER,
          WO_TYPE,
          SUM(LIM) LIM,
          SUM(EXP) EXP,
          SUM(HSI) HSI,
          SUM(PHONE) PHONE
        FROM
          STEP_1
        GROUP BY
          ACCOUNT_NUMBER,
          WORK_ORDER_NUMBER,
          WO_TYPE
        ORDER BY
          ACCOUNT_NUMBER),
      /* This query takes the results from Step 2 and then looks at all service
      levels that were not included or changed in the work order detail file
      and makes sure that unchanged services are included in the final total.
      FOR EXAMPLE : Coming from step 2, if LIM is NULL we know that no changes
      were done to LIM in the work order - so, if the customer has Limited then
      the service quantity is added to the total.  Else - if LIM is not null, then
      we know the service level was effected by the work order - so do not
      include the quantity from the services file because it will be innacurate
      once the work order is complete*/
      STEP_3 AS
       SELECT
          WO.ACCOUNT_NUMBER,
          WO.WORK_ORDER_NUMBER,
          WO.WO_TYPE,
          CASE WHEN LIM IS NULL AND CS.SERVICE_CODE = '101' THEN (CS.SERVICE_QUANTITY + CS.SERVICE_QUANTITY_TO_FREE) ELSE NULL END LIM,
          CASE WHEN EXP IS NULL AND CS.SERVICE_CODE = '111' THEN (CS.SERVICE_QUANTITY + CS.SERVICE_QUANTITY_TO_FREE) ELSE NULL END EXP,
          CASE WHEN HSI IS NULL AND CS.SERVICE_CODE = '30001' THEN (CS.SERVICE_QUANTITY + CS.SERVICE_QUANTITY_TO_FREE) ELSE NULL END HSI,
          CASE WHEN PHONE IS NULL AND CS.SERVICE_CODE IN ('LINE FL', 'ULTS FL') THEN (CS.SERVICE_QUANTITY + CS.SERVICE_QUANTITY_TO_FREE) ELSE NULL END PHONE
        FROM
          STEP_2 WO INNER JOIN KAN_CUSTOMER_SERVICES CS ON WO.ACCOUNT_NUMBER = CS.ACCOUNT_NUMBER
        WHERE
          CS.SERVICE_CODE IN ('101', '111', '30001', 'LINE FL', 'ULTS FL')
          AND CS.SERVICE_STATUS = 'A'),
      /* This step calculated the current service level. */
      STEP_4 AS
        SELECT
              ACCOUNT_NUMBER,
              WORK_ORDER_NUMBER,
              WO_TYPE,
              SUM(LIM) LIM,
              SUM(EXP) EXP,
              SUM(HSI) HSI,
              SUM(PHONE) PHONE
            FROM
              STEP_3
            GROUP BY
              ACCOUNT_NUMBER,
              WORK_ORDER_NUMBER,
              WO_TYPE
      COMBINE_TWO AS
        SELECT
        FROM
          STEP_2
        UNION ALL
        SELECT
        FROM
          STEP_4
        SELECT
          WOM.SCHEDULE_DATE,
          COMBINE_TWO.ACCOUNT_NUMBER,
          COMBINE_TWO.WORK_ORDER_NUMBER,
          COMBINE_TWO.WO_TYPE,
          HM.ADDRESS_LINE_1,
          HM.ADDRESS_LINE_2,
          HM.ADDRESS_LINE_3,
          HM.ADDRESS_LINE_4,
          SUM(LIM) LIM,
          SUM(EXP) EXP,
          SUM(HSI) HSI,
          SUM(PHONE) PHONE
        FROM
            COMBINE_TWO
            INNER JOIN KAN_CUSTOMER_MASTER CM ON COMBINE_TWO.ACCOUNT_NUMBER = CM.ACCOUNT_NUMBER
            INNER JOIN KAN_HOUSE_MASTER HM ON CM.HOUSE_NUMBER = HM.HOUSE_NUMBER
            INNER JOIN KAN_WORK_ORDER_MASTER WOM ON COMBINE_TWO.WORK_ORDER_NUMBER = WOM.WORK_ORDER_NUMBER
        GROUP BY
          WOM.SCHEDULE_DATE,
          COMBINE_TWO.ACCOUNT_NUMBER,
          COMBINE_TWO.WORK_ORDER_NUMBER,
          COMBINE_TWO.WO_TYPE,
          HM.ADDRESS_LINE_1,
          HM.ADDRESS_LINE_2,
          HM.ADDRESS_LINE_3,
          HM.ADDRESS_LINE_4
        HAVING
            SUM(LIM) <= 0
            AND SUM(EXP) <= 0
          AND
            SUM(HSI) >= 1
            OR SUM(PHONE) >= 1
        ORDER BY
          ACCOUNT_NUMBER

    GREAT job posting and formatting the query. Also helpful was your really good documentation in the query.
    You seem to be approaching your problem in the right way. You are pushing the limits of sql is capable of doing.
    Here are some ideas that you can consider and probably discard; I don't have any good ones but maybe these can encourage you or someone else to think of something better. Sometimes you have to consider and discard bad ideas before getting to the good ones - its part of the process.
    The query is complex enough - how many steps, with unions and subqueries galore - maybe a deconstructed pipelined function would be easier.
    Views aren't usually an answer to problems like this, and more often than not cause other problems later when somebody tries to join to them.
    Deconstructing the query and putting the incremental step data into global temporary tables might work, with a query at the end to read the final result set.

  • IO Exception Broken Pipe ORA-17002 while using connection pooling

    Hi
    We are experiencing "broken pipe ORA-17002 error" when using connection pooling. This seems to be a common error when implementing connection pooling, but I didn't find any solution anywhere.
    we are using Oracle 9i 9.2.0.1 JDBC thin driver
    Our database is Oracle 8.1.7 running on HP Unix
    The middle tier(Tomcat) runs on RedHat linux server
    We are using JDK1.3
    It seems the connections automatically get stale or bad after certain period of time.Iam checking to see if the connection is closed, before giving the connection from the pool to the appilcation.It seems its still open.But when I start using the connection to open a callable statement or setAutocommit to false, it says Broken pipe or No more data to read from the socket.
    We are implementing our own connection pooling class(we experimented with OracleConnectionCacheImpl but it too gave the same errors).
    Does anybody have a solution for this problem??
    Is there a workaround for this?I would like to know how connection pooling is implemented in most of the applications that use oracle database?Or do we need to explicitly test the connection before using it, and reopen a connection if that is bad??
    Thanks
    Anil

    kalle
    Thank you very much for your advice!!!
    Like you said, I started to check whether the connections are fine before giving them from the pool.I am executing a simple "select 'anil' from dual" and if its fine only then I return the connection. So far it seems to be fine. Also I am reopening the connections(closing the old ones and opening new connections) after every 12 hours.
    As far as the JDBC driver is concerned, I already tried with Oracle 8i driver, it gave the same problems. I read that 9i driver might solve this problem, so I changed to the latest 9i driver (classes12_g.zip).
    Sometimes before(before I started checking whether the connection is good )the application used to hang up at the point where I am issuing setAutoCommit(false).It never comes out from that statement.Is this something to do with theconnections being closed?
    What I am afraid is, will the appilation get hung up even after I check the connection with select query and then issue autocommit(false)??
    Or will it hang up while I check with a select query??
    As long as it doesn't hung up, I am fine. Because i am cathching the exceptions.
    Thanks In ADVANCE
    Anil

  • Using Oracle OLE DB provider (with ADO) generates error: ORA-01843 while using date

    Were using OLE DB provider in order to connect to our Oracle 9i database. When executing the following query in a SQL Plus window I will get the correct results:
    SELECT gum_seu_syo_id, seu_userid, seu_first_name, seu_last_name
    From group_user_mapping, security_users
    Where gum_seu_syo_id = seu_syo_id
    and gum_term_date > '8/19/2002'
    and gum_seg_syo_id = 11
    However if will execute the same query from the our application (VB using ADO) I will get the following error:
    ORA-01843: Not a valid month
    Checking with our Oracle DBA we made sure my registry is correct and includes the correct format under HEKY_LOCAL_MACHINE\SOFTWARE\ORACLE\ORACLE_HOME,
    where the key is NLS_DATE_FORMAT (of type REG_EXPAND_SZ) with the value:
    MM/DD/YYYY HH:MI:SS AM
    I also run the following query in a SQL Plus window:
    select sysdate from dual;
    and got the following result:
    08/19/2002 10:27:20 AM
    which shows that the data format is correct.
    Trying to switch between the month and day in the query (put '19/8/2002') worked from the application but generated ORA-01843: Not a valid month in the SQL Plus window.
    Any ideas?

    try using
    to_char function
    for eg.
    select * from emp where to_char(hiredate,'dd/mm/yy') > '20/3/83'.
    Jagriti

Maybe you are looking for