How i can execute the sql query in java code

I already have sql query in jave plateform i need to execute this code how i can do that. i have unix env and with oracle database. should i just run this query in my sqlplus. this file has extention .java. thanks

you can create a project in JDeveloper add the java file to it, add the Oracle JDBC library to the project properties and then hit the run button.

Similar Messages

  • How to re-issue an SQL query in java code in deadlock situation ?

    Hi all..
    I have a java application (in Struts) which is running on JBoss 4.0.1 server. The database is MySql 6.0. It is an
    application made to be used among multiusers. The background operating system is Windows Vista.
    Now a days i am facing a peculiar problem due to which the further things go wrong. I am getting following error :
    com.mysql.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
    I searched over forums and i got response as restart the transaction in deadlock.
    In my java code it is a delete query where i get such exception when multiple users are accessing the application. What i tried for time being is as follows :
    Statement stmt = null;
    String temp = null;
    Connection conn = null;
    String sUserID =(String) session.getAttribute("username")
    try
    conn = DBConnection.getJndiConnection();
    stmt = conn.createStatement();
    temp = "Delete FROM temptable where Login ='"+sUserID+"'";
    System.out.println("QUERY:"+temp);
    int rowCount = stmt.executeUpdate(temp);
    System.out.println("Rows affected in try ="+rowCount+" for user :"+sUserID);
    // in catch i re-issue the delete query in deadlock..
    catch (com.mysql.jdbc.exceptions.MySQLTransactionRollbackException ne)
    System.out.println("Error ....Deadlock occured for user: "+sUserID);
    ne.printStackTrace();
    try
    int rowCount = s.executeUpdate(temp);
    System.out.println("Rows affected in catch ="+rowCount+" for user :"+sUserID);
    catch (Exception e)
    System.out.println("Exception again after restarting transaction..with user :"+sUserID);
    e.printStackTrace();
    (all necessary imports are present in code)
    Here i am properly establishing the database connection with the help of other class DBConnection. As most of the forum insisted to re-issue the transaction, i have tried upto one level with above code. But still the problem is just partially solved.
    How can i write my code so that every time if there is MySQLTransactionRollbackException , then the delete query should be re-issued again and again untill the transaction is complete.
    Can i use GOTO statement ? or is it bad programming practice?
    What are the other possible ways ??
    Can someone please help in this regard ??
    Thanks in advance..
    Regards
    Prasad

    Hi all
    i am new for these kind of databae transaction operation i am getting following error
    /resetattendancedata.dqlMessage: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; try restarting transaction" Cause: null Error Message: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; try restarting transaction" Cause: null Error code: 1205 Error state: 41000 java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; try restarting transaction"
    Here is my code i have written
    if(movements.equalsIgnoreCase("ON"))
    System.out.println("Movement");
    if(submovements.equalsIgnoreCase("statusonly"))
    query="";
    query="UPDATE TRNMOVEMENT SET PROCESSED='N',STATUSPUT='N',ATTDATE=NULL,TIMEDIFF='' "
    +"WHERE ATTDATE BETWEEN '"datefrom1"' AND '"dateto"' AND EMPID IN "
    +"(SELECT SYSEMPID "
    +"FROM (((MSTPERSONALDETAILS PD LEFT JOIN MSTCATEGORY CAT ON PD.CATEGCODE=CAT.SYSCATEGCODE)"
    +"LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) "
    +"LEFT JOIN MSTDESIGNATION DES ON PD.DESIGCODE=DES.SYSDESIGCODE) "
    +"LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE "strFltrString" ) ";
    leaveStmt.executeUpdate(query);
    leaveStmt.executeUpdate("commit");
    else if(submovements.equalsIgnoreCase("flagstatus"))
    query="";
    query="UPDATE TRNMOVEMENT SET PROCESSED='N',STATUSPUT='N',ATTDATE=NULL,FLAG='',TIMEDIFF='',BREAK='N'WHERE ATTDATE BETWEEN '"datefrom1"' AND '"dateto"' AND EMPID IN (SELECT SYSEMPID FROM(((MSTPERSONALDETAILS PD LEFT JOIN MSTCATEGORY CAT ON PD.CATEGCODE=CAT.SYSCATEGCODE) LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) LEFT JOIN MSTDESIGNATION DES ON PD.DESIGCODE=DES.SYSDESIGCODE) LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE WHERE EMPID IS NOT NULL "strFltrString" ) ";
    leaveStmt.executeUpdate(query);
    synchronized(leaveStmt)
    //leaveStmt1.executeUpdate("set TRANSACTION ISOLATION LEVEL REPEATABLE READ"); // setting transaction level using SQL
    // leaveStmt1.executeUpdate("start transaction"); // Starting a transaction using SQL     
    query1="DELETE FROM TRNDAILYATTENDANCE WHERE ATTDATE BETWEEN '"datefrom1"' AND '"dateto"' AND EMPID IN (SELECT SYSEMPID FROM (((MSTPERSONALDETAILS PD "
    +"LEFT JOIN MSTCATEGORY CAT ON PD.CATEGCODE=CAT.SYSCATEGCODE) LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) LEFT JOIN MSTDESIGNATION DES ON PD.DESIGCODE = DES.SYSDESIGCODE )LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE WHERE EMPID IS NOT NULL "strFltrString" )";
    //leaveStmt.addBatch(query1);
    leaveStmt.executeUpdate(query1);
    synchronized(leaveStmt)
    query2="UPDATE TRNLEAVEAPPLICATION SET TAKENTOATT='N' WHERE '"datefrom1"' BETWEEN FROMDATE AND "
    +"TODATE AND '"dateto"' BETWEEN FROMDATE AND TODATE AND EMPID IN (SELECT SYSEMPID FROM (((MSTPERSONALDETAILS PD LEFT JOIN MSTCATEGORY CAT ON "
    +"PD.CATEGCODE=CAT.SYSCATEGCODE) LEFT JOIN MSTUNITDETAILS U ON PD.UNITCODE=U.SYSUNITCODE) LEFT JOIN "
    +"MSTDESIGNATION DES ON PD.DESIGCODE=DES.SYSDESIGCODE) LEFT JOIN MSTDEPARTMENT DEP ON PD.DEPTCODE=DEP.SYSDEPTCODE WHERE EMPID IS NOT NULL "+strFltrString +") ";
    //leaveStmt.addBatch(query2);
    //leaveStmt.executeBatch();
    leaveStmt.executeUpdate(query2);
    //} // end of for loop
    else
    leaveStmt.executeUpdate("commit");
    Please Solve my problem for this error thanks in advance........

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

  • How we can update the  System Date,in java

    Hi guys,
    can U pls help me...
    How we can update the System Date,in java
    I need to get the System Date and time continuosly thruogh threads concept.kindly help me
    Thanking u in Advance

    System.currentTimeMillis() will give you the current
    system date and time as a long value.
    ~I think the OP wants to change the system time not just get the system time.

  • Executing the SQL query across 2 different databases of Oracle

    Hello All,
    In Microsoft SQL server we can execute following type of SQL query across 2 different databases:
    select * from TEST1.dbo.GENERIC_TABLE1 union select * from TEST2.dbo.GENERIC_TABLE2;
    Here TEST1 and TEST2 are 2 different databases.
    Can we do the same in Oracle?

    yes you can, but first one has to setup a database link
    Look up CREATE DATABASE LINK and then take things from there!
    P;

  • Where and how do I get the SQL Query used by the Microsoft Generic Report Library - Alerts?

    Background:
    I'm tasked with the following: I need to create a new Report and the SQL
    The two canned reports that I can pattern after are: Microsoft Generic Report Library
    - Alerts (there is also an alert detail report that can be chosen within the alert report that we may want to use instead)
    - Most Common Alerts
    I'm trying to do this:
    Add another parameter to search on customfield3.
    It should be able to report on all alerts that were assigned to the specific team for the time period along with the top 10 (most common alerts) assigned to the team for the time period.
    Choose as the objects (group) all servers, but Imay need to adjust the report to just look at all alerts without having to provide objects or a group
    The struggle I'm having is: I know SQL. I know how to create an RDL file.
    But Where are the RDL files for the canned reports so I can modify the canned RDL and modify its SQL and forms?
    What is the SQL/ where can I find the SQL used for the Generic Report Library -> Alerts

    Easy but you need to extract it from Microsoft Generic Report Pack. 
    So.. the procedure is as follows:
    1) You export and unseal Management Pack from your SCOM using
    Boris's OpsgMgr tools (MPViewer
    2.3.3)
    2) Ok you've got unsealed xml, now the tricky part, use
    MpElementsExtract tool, example of usage:
    MPElementsExtract.exe <MP.xml> /ex /destination:<destination>
    That you way you get several folders out of mp:
    DWScripts, DWSubScripts, LinkedReports, ReportResources, Reports
    Take a look into content of first 2, there will be pure sql scripts, and rdl's are in Reports folder :)
    Other way is to just use SQL profiler and catch SQL query while generating report. 
    --- Jeff (Netwrix)

  • What can be the SQL Query for this requirement ?

    Hi,
    I have a table with fields like this:
    ID DESC PARENT
    01 ABC 02
    02 ABC1 01
    03 ABC2 01
    04 ABC4 02
    In the above table PARENT column refers to ID column , but actually in SQL query i want to have ID, DESC , and PARENTDESC (i.e., desc value of the corresponding ID)
    Actual output that i need is
    select ID , DESC , ?? from table where ID=someValue . Now if i provide ID=01 then output should be like this:
    ID DESC PARDESC
    01 ABC ABC1
    Can anyone help what can be the required sql query ?
    Edited by: bootstrap on Apr 29, 2011 6:15 AM

    SELECT T1.ID, T1.DESC, T2.DESC
    FROM TABLEA T1, TABLEA T2
    WHERE T1.ID='01'
    AND T2.ID = T1.PARENT;

  • How I can optimize this SQL query

    I require your help, I want to know how I can optimize this query
    SELECT
                    "F42119". "SDLITM" as "Code1"
                    "F42119". "SDAITM" as "Code2"
                    "F42119". "SDDSC1" as "Product"
                    "F42119". "SDMCU" as "Bodega"
                    Sum ("F42119". "SDSOQS" / 10000) as "Number",
                    Sum ("F42119". "SDUPRC" / 10000) as "preciou"
                    Sum ("F42119". "SDAEXP" / 100) as "Value",
                    Sum ("F42119". "SDUNCS" / 10000) as "CostoU"
                    Sum ("F42119". "SDECST" / 100) as "Cost"
                    "F4101". "IMSRP1" as "Division"
                    "F4101". "IMSRP2" as "classification",
                    "F4101". "IMSRP8" as "Brand"
                    "F4101". "IMSRP9" as "Aroma"
                    "F4101". "IMSRP0" as "Presentation"
                    "F42119". "SDDOC" as "Type",
                    "F42119". "SDDCT" as "Document",
                    "F42119". "SDUOM" as "Unit"
                    "F42119". "SDCRCD" as "currency"
                    "F0101". "ABAN8" as "ABAN8"
                    "F0101". "ABALPH" as "Customer"
                    "F0006". "MCRP22" as "Establishment"
    from          "PRODDTA". "F0101" "F0101"
                    "PRODDTA". "F42119" "F42119"
                    "PRODDTA". "F4101" "F4101"
                    "PRODDTA". "F0006" "F0006"
    where       "F42119". "SDAN8" = "F0101". "ABAN8"
      and         "F0006". "MCMCU" = "F42119". "SDMCU"
      and         "F4101". "IMITM" = "F42119". "SDITM"
      and         "F42119". "SDDCT" in ('RI', 'RM', 'RN')
      and         CAST (EXTRACT (MONTH FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM-                YYYY ') + substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in : Month
    and          CAST (EXTRACT (YEAR FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM-                YYYY ')+ Substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in: Year
    and          trim ("F0006". "MCRP22") =: Establishment
    and          trim ("F4101". "IMSRP1") =: Division
    Group By    "F42119". "SDLITM"
                    "F42119". "SDAITM"
                    "F42119". "SDDSC1"
                    "F4101". "IMSRP1"
                    "F42119". "SDDOC"
                    "F42119". "SDDCT"
                    "F42119". "SDUOM"
                    "F42119". "SDCRCD"
                    "F0101". "ABAN8"
                    "F0101". "ABALPH"
                    "F4101". "IMSRP2"
                    "F4101". "IMSRP8"
                    "F4101". "IMSRP9"
                    "F4101". "IMSRP0"
                    "F42119". "SDMCU"
                    "F0006". "MCRP22"
    I appreciate the help you can give me

    It seems to me that part of fixing it could be how you join the tables.
    Instead of the humongous where clause, put the applicable conditions on the join.
    You have
    from "PRODDTA". "F0101" "F0101"
    "PRODDTA". "F42119" "F42119"
    "PRODDTA". "F4101" "F4101"
    "PRODDTA". "F0006" "F0006"
    where "F42119". "SDAN8" = "F0101". "ABAN8"
    and "F0006". "MCMCU" = "F42119". "SDMCU"
    and "F4101". "IMITM" = "F42119". "SDITM"
    and "F42119". "SDDCT" in ('RI', 'RM', 'RN')
    and CAST (EXTRACT (MONTH FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM- YYYY ') + substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in : Month
    and CAST (EXTRACT (YEAR FROM TO_DATE (substr ((to_date ('01-01-'| | to_char (round (1900 + (CAST ("F42119". "SDDGL" as int) / 1000))),' DD- MM- YYYY ')+ Substr (to_char (CAST ("F42119". "SDDGL" as int)), 4,3) -1), 1,10))) AS INT) in: Year
    and trim ("F0006". "MCRP22") =: Establishment
    and trim ("F4101". "IMSRP1") =: Division
    INSTEAD try something like
    from JOIN "PRODDTA". "F0101" "F0101" ON "F42119". "SDAN8" = "F0101". "ABAN8"
    JOIN "PRODDTA". "F42119" "F42119" ON "F0006". "MCMCU" = "F42119". "SDMCU"
    JOIN "PRODDTA". "F4101" "F4101" ON join condition
    JOIN "PRODDTA". "F0006" "F0006" ON join condition.
    Not sure exactly how you need things joined, but above is the basic idea. Remove criteria for joining the tables from the WHERE clause and put them
    in the join statements. That might clean things up and make it more efficient.

  • Can we execute the SQL query mannually

    hi,
    an error occurs when the drill down from higher to lower level as
    " Odbc driver returned an error (SQLExecDirectW).
    + Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27005] Unresolved column: "CA". (HY000)"
    how can we solve this problem...not only for this one report iam getting to number of reports.
    plz plz help to solve this problem.
    Thanks in advance.

    Increase the log level for the user you're using to do the tests to at least 2 (Admin Tool -> Manage -> Security -> User -> Logging Level).
    The run the report in question. Either check the logs through the web interface (Settings -> Administration -> Manage Sessions -> View Log) or just go to the server and check the NQQuery.log.
    Cheers,
    Christi@n

  • Execute simple SQL query on Java

    Hello,
    I am a newbie on ADF, I am a web developer used to work with EJBs, WebServices, Servlets and this stuff... But now I am on a project that uses ADF.
    My opinion, I don´t like this kind of development, drag and drop, I prefer to code on :) but, I need to work.
    I am developing a utility class that needs to run some SQL statements and send an email.
    I tried to work with the conventional @Resource (name...) Datasource ds; and did not worked, because it does not injected the object.
    I tried to create a java implementation of my application module, instanciate it and get a ViewObject that I created to do a select statement, and the ViewObject comes null...
    I just wanna do a simple query... just it, using simple java for web I would have already done it... How is the best way to do it?
    Thanks.

    ApplicationModuleImpl am = getApplicationModuleByName("AppModuleDataControl")
    DBTransaction dbt = am.getDBTransaction();
    CallableStatement cs = dbt.createCallableStatement(query, .......
    You can get ApplicationModule by this code. In this case there should be some binding related to this AM in pageDef. Input parameter "name" should be datacontrol name;
    public static ApplicationModuleImpl getApplicationModuleByName(String name) {
    try {
    BindingContext bc = (BindingContext)resolveExpression("#{data}");
    DCDataControl dc = bc.findDataControl(name);
    return (ApplicationModuleImpl)dc.getDataProvider();
    } catch (Exception e) {
    l.error(e);
    return null;
    public static Object resolveExpression(String expression) {
    l.debug("expression: " + expression);
    FacesContext fctx = FacesContext.getCurrentInstance();
    ELContext elctx = fctx.getELContext();
    ExpressionFactory exprFactory =
    fctx.getApplication().getExpressionFactory();
    ValueExpression ve =
    exprFactory.createValueExpression(elctx, expression, Object.class);
    Object value = ve.getValue(elctx);
    return value;
    }

  • How we can handle the below doubt in Java Script!!

    Hi All,
    I need to handle the below scenerio in javascript, i am very poor in scripting langauage could any help me out.
    Below are the three where we have specail character
    words as
    1. transfer (…)
    2. Shell’s
    3. Vitol – as
    The above 3 are having some specail characters which we need to
    replace as mentioned below
    need to use a Function/Method in some scripting language like Java
    script to replace the special character with a predefined sequence eg:
    single quote with “a1b1” before inserting the data in to the data base
    and then while retrieving the record from the database replace “a1b1”
    with single quote.
    Note#:It is a text area where user can either enter or copy and paste
    the content.
    Thanks,
    Anoo..

    Hi Anoo,
    always remember to put your apex and database versions, it makes it easier to help.
    You mentioned stripping out special characters and then putting them back for display. Is there a particular reason why?
    If you're having difficulty querying the 'special' characters from SQL, you can create a view to handle that complexity.
    The examples you gave don't contain any characters you can't query on. Maybe I'm missing something.
    Kofi

  • How to go to the parent dir using java code

    I want to store a file in a directory. That directory is in the parent directory of present working directory. So how can I do this using java.
    i want to store the file "datafile" in c:\super\datadir
    now i am in the directory called c:\super\programdir
    how can i do this using the java program.

    File parentDir = new File("").getAbsoluteFile().getParentFile();
    File dataFile = new File(parentDir,"datadir/datafile");

  • The SQL query is not executing

    Hi
    I have the following situation: In a project we designed our reports calling a stored procedure the exits in a MS SQL Server 200 database. The Stored Procedures works fine and when they are used in the report everything works perfectly.
    The reports are being made with CR DEsigner 11, when the designer ends them, ha pass them to me and we put them in our java web application. I open them and even preview them since the Crystal Reprots Perspective of Eclipse and I can see the data, so everything to this point is OK.
    The problem comes when I change of connection, I'm trying to connect every report to the same host and database, and when the reprot is displayed in the browser there is no data. I profile the SQL commands that are executed when the report is requested and I found that the reprot is not executing the stored procedure.
    I guess because i'm connectring the report to the same database and host that was used when the report is created and i'm also passing exactly the same parameters of the stored procedure, then report thinks that it doesn't have executing again becuase it will be the same information.
    SO, i wonder if there is a way to request to the report to execute the sql query every time i have to display it.
    thanks for any help.

    What happens when you try to view the report using a simple viewer.jsp?without changing the connection?
    2009-05-25 14:06:09,250 ERROR com.businessobjects.reports.sdk.JRCCommunicationAdapter -  detected an exception: Error de conexión: [SQLServer 2000 Driver for JDBC]Error establishing socket.
    But the database server is ok, so i think the rpt needs more information to be connect to the database.
    Also what happens if you dont use the data bean and give everything there only?
    The same, the rpt is not executing the stored procedure.
    Did anything change on the RDBMS side? Additional packages, changes to the schema, ownership, etc?
    No, the server is ok and the database is ok.
    If you configure Log4J logging to DEBUG, you should see the database invokes from the Crystal Java engine, specifically the queries sent and the number of rowsets returned. Do you notice any errors?
    I have a problem here with log4j. In my project i'm using spring and with the help of spring i configure log4j, basically with spring is easier to configure log4j.
    I'm telling you this because i have log4j working but when my application reaches the code to change the connection to the rerport, log4j dies and stop sending any message to the stdout or to a log file. I haven't since this behavior in any other app o library. So i want to guess i have something wrong with my log4j or maybe with log4j+spring.
    So, i remove all the code of spring referring to log4j, but the problem with log4j wasn't solved.
    What i will try now is to remove spring from the project.
    This is my log4j.properties:
    log4j.rootLogger=DEBUG, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

  • HOW TO FIND AND CORRECT THE SQL QUERY ERRORS ????

    Sometimes I get the errors while executing the sql queries.
    I just wanted to know about the various ways by which I can find the sql query errors .
    Any suggestions will be deeply appreciated.

    If you get the an error from SSMS and you can't comprehend it, you can google the error message and google would always lead you to the correction. Or you can post the error in this forum, people
    here are always kind and ready to help :).
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Error while executing a sql query for select

    HI All,
    ORA-01652: unable to extend temp segment by 128 in tablespace PSTEMP i'm getting this error while i'm executing the sql query for selecting the data.

    I am having 44GB of temp space, while executing the below query my temp space is getting full, Expert please let us know how the issue can be resolved..
    1. I dont want to increase the temp space
    2. I need to tune the query, please provide your recomendations.
    insert /*+APPEND*/ into CST_DSA.HIERARCHY_MISMATCHES
    (REPORT_NUM,REPORT_TYPE,REPORT_DESC,GAP,CARRIED_ITEMS,CARRIED_ITEM_TYPE,NO_OF_ROUTE_OF_CARRIED_ITEM,CARRIED_ITEM_ROUTE_NO,CARRIER_ITEMS,CARRIER_ITEM_TYPE,CARRIED_ITEM_PROTECTION_TYPE,SOURCE_SYSTEM)
    select
    REPORTNUMBER,REPORTTYPE,REPORTDESCRIPTION ,NULL,
    carried_items,carried_item_type,no_of_route_of_carried_item,carried_item_route_no,carrier_items,
    carrier_item_type,carried_item_protection_type,'PACS'
    from
    (select distinct
    c.REPORTNUMBER,c.REPORTTYPE,c.REPORTDESCRIPTION ,NULL,
    a.carried_items,a.carried_item_type,a.no_of_route_of_carried_item,a.carried_item_route_no,a.carrier_items,
    a.carrier_item_type,a.carried_item_protection_type,'PACS'
    from CST_ASIR.HIERARCHY_asir a,CST_DSA.M_PB_CIRCUIT_ROUTING b ,CST_DSA.REPORT_METADATA c
    where a.carrier_item_type in('Connection') and a.carried_item_type in('Service')
    AND a.carrier_items=b.mux
    and c.REPORTNUMBER=(case
    when a.carrier_item_type in ('ServicePackage','Service','Connection') then 10
    else 20
    end)
    and a.carrier_items not in (select carried_items from CST_ASIR.HIERARCHY_asir where carried_item_type in('Connection') ))A
    where not exists
    (select *
    from CST_DSA.HIERARCHY_MISMATCHES B where
    A.REPORTNUMBER=B.REPORT_NUM and
    A.REPORTTYPE=B.REPORT_TYPE and
    A.REPORTDESCRIPTION=B.REPORT_DESC and
    A.CARRIED_ITEMS=B.CARRIED_ITEMS and
    A.CARRIED_ITEM_TYPE=B.CARRIED_ITEM_TYPE and
    A.NO_OF_ROUTE_OF_CARRIED_ITEM=B.NO_OF_ROUTE_OF_CARRIED_ITEM and
    A.CARRIED_ITEM_ROUTE_NO=B.CARRIED_ITEM_ROUTE_NO and
    A.CARRIER_ITEMS=B.CARRIER_ITEMS and
    A.CARRIER_ITEM_TYPE=B.CARRIER_ITEM_TYPE and
    A.CARRIED_ITEM_PROTECTION_TYPE=B.CARRIED_ITEM_PROTECTION_TYPE
    AND B.SOURCE_SYSTEM='PACS'
    Explain Plan
    ==========
    Plan
    INSERT STATEMENT ALL_ROWSCost: 129 Bytes: 1,103 Cardinality: 1                                                        
         20 LOAD AS SELECT CST_DSA.HIERARCHY_MISMATCHES                                                   
              19 PX COORDINATOR                                              
                   18 PX SEND QC (RANDOM) PARALLEL_TO_SERIAL SYS.:TQ10002 :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1                                         
                        17 NESTED LOOPS PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,103 Cardinality: 1                                    
                             15 HASH JOIN RIGHT ANTI NA PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 129 Bytes: 1,098 Cardinality: 1                               
                                  4 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 63 Bytes: 359,283 Cardinality: 15,621                          
                                       3 PX SEND BROADCAST PARALLEL_TO_PARALLEL SYS.:TQ10001 :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621                     
                                            2 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621                
                                                 1 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1001Cost: 63 Bytes: 359,283 Cardinality: 15,621           
                                  14 NESTED LOOPS ANTI PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 40,256,600 Cardinality: 37,448                          
                                       11 HASH JOIN PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 65 Bytes: 6,366,160 Cardinality: 37,448                     
                                            8 BUFFER SORT PARALLEL_COMBINED_WITH_CHILD :Q1002               
                                                 7 PX RECEIVE PARALLEL_COMBINED_WITH_PARENT :Q1002Cost: 1 Bytes: 214 Cardinality: 2           
                                                      6 PX SEND BROADCAST PARALLEL_FROM_SERIAL SYS.:TQ10000 Cost: 1 Bytes: 214 Cardinality: 2      
                                                           5 INDEX FULL SCAN INDEX CST_DSA.IDX$$_06EF0005 Cost: 1 Bytes: 214 Cardinality: 2
                                            10 PX BLOCK ITERATOR PARALLEL_COMBINED_WITH_CHILD :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448                
                                                 9 MAT_VIEW ACCESS FULL MAT_VIEW PARALLEL_COMBINED_WITH_PARENT CST_ASIR.HIERARCHY :Q1002Cost: 63 Bytes: 2,359,224 Cardinality: 37,448           
                                       13 TABLE ACCESS BY INDEX ROWID TABLE PARALLEL_COMBINED_WITH_PARENT CST_DSA.HIERARCHY_MISMATCHES :Q1002Cost: 0 Bytes: 905 Cardinality: 1                     
                                            12 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT SYS.HIERARCHY_MISMATCHES_IDX3 :Q1002Cost: 0 Cardinality: 1                
                             16 INDEX RANGE SCAN INDEX PARALLEL_COMBINED_WITH_PARENT CST_DSA.IDX$$_06EF0001 :Q1002Cost: 1 Bytes: 5 Cardinality: 1

Maybe you are looking for

  • Awaiting my Apple TV - How does WiFi reception compare to your Macs?

    My Apple TV is due to arrive Monday. So happy to finally be getting one. I have lots of videos, music, and podcasts ready in iTunes! Unfortunately, my living room is the opposite of the house, from my airport express. Today I was doing some testing w

  • Where are the files?

    Hi there, Have MacBook and trying to setup TM for regular backups. It looks like my external HD problem will be solved (another thread) but I have following to solve. In current scheme I manually store files on external HD. I want to store all my pic

  • HOME screen icon problems

    On a web page everytime i click the + button to add it to home screen, it works but now all my icons for each one i bookmark are the same. They used to be snapshots of the webpage mostly or an official icon like google etc. Now its a set of weights f

  • Certain keys not working

    I've got a problem with my laptop keyboard. When my computer gets warmer (when playing a game or being turned on for a longer time), some of the keys stop working, or work really bad, such as: t, z, caps lock, backspace, left shift, F3 and F7. But wh

  • Preview weirdness...

    Preview has always been quirky for me.  Manipulating PDF documents with Preview is simply tedious and unpredictable.  I was simply trying to add a page to a PDF document in Preview. Opened two PDF's in Preview.  Tried to drag one page thumbnail from