How to optimize the performance of this query SQL

Hello

I need to find the age for each day, but I need for all previous dates in a single query. So I used the following query:

Select trunc (sysdate) - level + 1 DATE

trunc (sysdate) - level + 1 - created_date AGE

elements

connect by trunc (sysdate) - level + 1 - created_date > 0

I get output (FOR the DATE and AGE) that is fine and correct:

DATE AGE           

--------- ----------

6 JULY 15 22

5 JULY 15 21

4 JULY 15 20

3 JULY 15 19

2 JULY 15 18

JULY 1, 15 17

JUNE 30, 15 16

JUNE 29, 15 15

JUNE 28, 15 14

JUNE 27, 15 13

JUNE 26, 15 12

25 JUNE 15 11

24 JUNE 15 10

Now I need to calculate the average age for each day and I added the average in the following query:

Select trunc (sysdate) - level + 1 DATE .

AVG (trunc (sysdate) - level + 1 - created_date) AVERAGE_AGE

elements

connect by trunc (sysdate) - level + 1 - created_date > 0

Group of trunc (sysdate) - level + 1


This query is correct? When I add the aggregate (avg) function to this query, it takes 1 hour to retrieve the data. When I remove the average request function that gives the result in 2 seconds? What is the solution to calculate the average without affecting performance? Help, please

Maybe you are looking for something like this...

SQL > ed
A written file afiedt.buf

1 with t (point, created_date) :)
2 Select 1, date '' 2015-06-24 from all the double union
3 select 2, date ' 2015-06-29 the Union double all the
4 Select 3, date ' 2015-06-17' of the double
5        )
6  --
7. end of test data
8  --
9. Select item
10, trunc (sysdate) - level + 1 as dt
11, trunc (sysdate) - level + 1-created_date age
12, round (avg (trunc (sysdate) - level + 1 - created_date) on (trunc (sysdate) partition - level + 1), 2) as avg_in_day
13 t
14 connect by level<=>
15-point point = prior
sys_guid() 16 and prior is not null
17 * order by 1.2
SQL > /.
POINT DT AGE AVG_IN_DAY
---------- ----------- ---------- ----------
1 JUNE 24, 2015 0 3.5
1 25 JUNE 2015 1 4.5
1 26 JUNE 2015 2 5.5
1 27 JUNE 2015 3 6.5
1 28 JUNE 2015 4 7.5
1 29 JUNE 2015 5 5.67


1 30 JUNE 2015 6 6.67
1 1 JULY 2015 7 7.67
1-2 JULY 2015 8 8.67
1-3 JULY 2015 9 9.67
1 TO 4 JULY 2015 10 10.67
1 5 JULY 2015 11 11.67
1 6 JULY 2015 12 12.67
2 JUNE 29, 2015 5.67 0
2 30 JUNE 2015 1 6.67
2 1 JULY 2015 2 7,67
2 2 JULY 2015 3 8.67
2-3 JULY 2015 4 9.67
2-4 JULY 2015 5 10.67
2-5 JULY 2015 6 11.67
2-6 JULY 2015 7 12.67
3 JUNE 17, 2015 0 0
3 18 JUNE 2015 1 1
3 19 JUNE 2015 2 2
3 20 JUNE 2015 3 3
3 21 JUNE 2015 4 4
3 22 JUNE 2015 5 5
3 23 JUNE 2015 6 6
3 24 JUNE 2015 7 3.5
3 25 JUNE 2015 8 4.5
3 26 JUNE 2015 9 5.5
3 27 JUNE 2015 10 6.5
3 28 JUNE 2015 11 7.5
3 29 JUNE 2015 12 5.67
3 30 JUNE 2015 13 6.67
3 1 JULY 2015 14 7.67
3 2 JULY 2015 15 8.67
3 3 JULY 2015 16 9.67
3-4 JULY 2015 17 10.67
3-5 JULY 2015 18 11.67
3 6 JULY 2015 19 12.67

41 selected lines.

Tags: Database

Similar Questions

  • How to optimize the performance of this code?

    I have two clips on a flash project. One of them is fixed and the other can be moved with the arrow keys of the keyboard. The two clips have irregular shapes, so HitTestObject and HitTestPoint does not work very well. I have a function that detects the collision of two clips using bitmap. I wanted to update the position of the Movie clip mobile so I put the function of collision detection under the ENTER_FRAME event listener code. It works fine, but when I add many fixed film clips (about 10 clips fixed in an image), the game (.swf file) becomes slower and slows down the performance of the PC. I thought that my collision detection function has a negative effect on the performance of the PC, so I used the class on this page: https://forums.adobe.com/thread/873737
    but the same thing happens.

    You told me how to do to speed up execution of my codes?

    Here's the part of my code:

    stage.addEventListener (Event.ENTER_FRAME, myOnEnterFrame);

    function myOnEnterFrame(event:Event):void

    {

    If (doThisFn) / / doThisFn is a variable to allow or prevent the kind of mobile film clip moved with arrow keys

    {

    If (left & &! right) {}

    Player.x = speed;

    Player.rotation = player.rotation - speed;

    }

    If (right & &! left) {}

    Player.x += speed;

    Player.rotation = player.rotation + speed;

    }

    If (up & &! down) {}

    Player.y = speed;

    }

    If (down & &! up) {}

    Player.y += speed;

    }

    The clips of film sets are wall1, wall2, wall3, wall4,... and so on
    the following code checks to see how many walls exist on each image and pushes them in table wallA

    for (var i: int = 0; i < 1000; i ++) / / you can put up to 1000 object of wall in the table wallA

    {

    If (this ['wall' + i]) / / if the wall object exists, push it into the table wallA

    {

    wallA.push (this, ['wall' + i]);

    }

    }

    for (i = 0; i < wallA.length; i ++)

    {

    If ( h.hitF (player, wallA [i]) | gameOverTest) / / this code checks whether or not the player (the mobile clip) hit the walls

    {

    trace ("second try");

    gameOver.visible = true;

    doThisFn = false;

    }

    }

    I think the following codes are easy to turn and run. I think that the performance problem is due to previous codes.


    If (player.hitTestObject (door))

    {

    Win.Visible = true;

    doThisFn = false;

    }

    If (key) / / if there is a key on chassis

    {

    If (player.hitTestObject (key))

    {

    Key.Visible = false;

    switch (currentFrame)

    {

    case 4:

    wallA [0] .visible = false;

    .x wallA [0] = 50000;

    break;

    case 5:

    wall14. Play();

    wall8.x = 430;

    break;

    }

    }

    }

    }

    }

    It's a simple question that doesn't usually have a simple answer.

    Here is an excerpt of a book (Flash game development: in a Social, Mobile and 3D world) I wrote.

    Optimization techniques

    Unfortunately, I don't know any way completely satisfactory to organize this information. In what follows, I discuss memory management first with sub-themes listed in alphabetical order. Then I discuss the management of CPU/GPU with subheadings listed in alphabetical order.

    This may sound logical, but at least, there are two problems with this organization.

    1. I don't think it's the most useful way to organize this information.

    2. memory management affects the CPU/GPU use, so that everything in the section of memory management can also be listed in the section CPU/GPU.

    In any case, I'll also list information in two other ways, from the easiest to the most difficult to implement and more for much less.

    Two of these later inscriptions are subjective and dependent on experience developer and capabilities, as well as environmental test and the test situation. I very much doubt there would be a consensus on the order of these lists.  However, I think that they are still valid.

    Easier to the more difficult to implement

    1. do not use the filters.

    2. always use the reverse for loops and avoid loops and avoid while loops.

    3. explicitly stop timers for their loan for gc (garbage collection).

    4. use the weak event listeners and remove headphones.

    5. strictly type variable when possible.

    6. explicitly disable interactivity mouse when interactivity smile not necessary.

    7. replace dispatchEvents with callback functions whenever possible.

    8 it would be gc stop sounds for the sounds and SoundChannels.

    9. use the DisplayObject most basic need.

    10. always use cacheAsBitmap and cacheAsBitmapMatrix with air applications (i.e., mobile).

    11. reuse of objects when possible.

    12 Event.ENTER_FRAME loops: use different listeners and different listener functions applied to DisplayObjects as little as possible.

    13. the pool instead of creating objects and gc objects ' ing.

    14. use partial blitting.

    15. use step blitting.

    16 use Stage3D

    Biggest advantage less

    1. Use the blitting Stadium (if there is enough memory system).
    2. Use Stage3D.
    3. Use partial blitting.
    4. Use cacheAsBitmap and cacheAsBitmapMatrix with mobile devices.
    5. Disable explicitly interactivity mouse when interactivity smile not necessary.
    6. Do not use filters.
    7. Use the most basic necessary DisplayObject.
    8. Reuse objects whenever possible.
    9. Event.ENTER_FRAME loops: use different listeners and different listener functions applied to DisplayObjects as little as possible.
    10. Use reverse for loops and avoid the do loops and while loops.
    11. The pool instead of creating objects and gc'ing.
    12. Strictly, type variable when possible.
    13. Use weak event listeners and remove headphones.
    14. Replace dispatchEvents by the callback functions whenever possible.
    15. Explicitly stop timers on loan for the gc.

    16 stop sounds for the sounds and SoundChannels be gc would be.

  • How to improve the performance of this loop?

    Hello

    I have this code below performs a loop on both issues, which compares the files in them. The performance is bad. Can someone tell me how to accomplish this task in an effective way?
    Please note that both folders can be on the network and most often contains 5000 + files.
    for (int i = 0; i < sourceList.length; i++) {
    for (int j = 0; j < targetList.length; j++) {
        if (sourceList.getName().equalsIgnoreCase(targetList[j].getName())) {
    if (sourceList[i].lastModified() > targetList[j].lastModified())
    {
    newInSourceList.add(sourceList[i]); //ArrayList 1
    }
    else if(sourceList[i].lastModified() < targetList[j].lastModified())
    {
    newInTargetList.add(targetList[j]); //ArrayList 2
    }
    }
    }
    }


    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    This minute is spent for the most part between the two points I mentioned below (Point A & B).

    I guess time will especially isFile() calls. That should make a stat() system call, which calls the network file server.

    If you can target Java 7 and greater, you can use the new java.nio.file and BasicFileAttributes. Allows you to extract the data to stat() each file in a single call, so that lastModified() and isFile() must separate calls to the file server. It will not yet be fast like lightning, but maybe almost 2 x faster - I think that all other treatments are overshadowed by calls on the network.

        // Read file attributes to a list (or use a Map if you prefer)
        String files[] = new File(Directory).list();
        BasicFileAttributes attributes[] = new BasicFileAttributes[files.length];
        for (int n = 0; n < files.length; n++)
            attributes[n] = Files.readAttributes(Paths.get(directory, files[n]), BasicFileAttributes.class);
    
        // Now you can use
        attributes[n].lastModifiedTime()
        attributes[n].isRegularFile()
        // etc without each call hitting the file server.
    
  • How to display the values of this query? The type is XDB. XDB$ STRING_LIST_T

    Hi all

    If I run this query using a tool like developer PL/SQL (SQL window), the values are displayed as a Collection. Just click and see the results of the al.

    Select
    dbms_resconfig.getRepositoryResConfigPaths)
    Of
    Double;


    I want to know how to display these values using any tool of sqlplus (with dbms_output or something like that).

    How can I do? With the help of the table? Create a type?

    TKS

    user12083350 wrote:

    I want to know how to display these values using any tool of sqlplus (with dbms_output or something like that).

    SQL> select * from table(dbms_resconfig.getRepositoryResConfigPaths())
      2  /
    
    COLUMN_VALUE
    --------------------------------------------------------------------------------
    /sys/xs/userrc.xml
    /sys/xs/rolesetrc.xml
    /sys/xs/drolerc.xml
    /sys/xs/rolerc.xml
    /sys/xs/frolerc.xml
    /sys/xs/xdserc.xml
    /sys/xs/scrc.xml
    
    7 rows selected.
    
    SQL> 
    

    And in PL/SQL:

    SQL> declare
      2      v_list xdb$string_list_t := dbms_resconfig.getRepositoryResConfigPaths();
      3  begin
      4      for i in 1..v_list.count loop
      5        dbms_output.put_line(v_list(i));
      6      end loop;
      7  end;
      8  /
    /sys/xs/userrc.xml
    /sys/xs/rolesetrc.xml
    /sys/xs/drolerc.xml
    /sys/xs/rolerc.xml
    /sys/xs/frolerc.xml
    /sys/xs/xdserc.xml
    /sys/xs/scrc.xml
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    

    SY.

    Published by: Solomon Yakobson, April 24, 2010 15:04

  • How to get the result using this query?

    Hi using iam under query,

    WITH CTE (SNO, ID, PNT)

    AS

    (SELECT ROWNUM as SNO, TRANS_ID, VCN_NO OF)

    SELECT V.TRANS_ID, V.VCN_NO IN VSL_MOVES V

    WHERE V.END_TIME > = TRUNC (TO_DATE (: pStartDate, ' dd/MM/yy HH24')) AND V.END_TIME < = TRUNC (TO_DATE (: pEndDate, ' dd/MM/yy HH24'))

    AND V.MOVEMENT_TYPE_CODE NOT IN ORDER ("ATA") OF V.VCN_NO, V.END_TIME))

    SELECT ROWNUM as SNO, TAB. VESSEL_NAME, TAB. FLAG, TAB. IMO_NO, TAB. ARRIVED_DATE, TAB. F_ROM,

    NVL ((SELECT CASE WHEN VMS. MOVEMENT_TYPE_CODE = 'ATS' THEN (SELECT TO_CHAR (NBV. ATD, "DD/MM/YYYY HH24") OF PNTS WHERE NBV. DOC_NO = TAB. VCN_NO AND ROWNUM < = 1) WHEN VMS. MOVEMENT_TYPE_CODE = 'ATB' THEN (SELECT TO_CHAR (VBU. BRTH_ALL_FAST, "DD/MM/YYYY HH24") OF VSL_BERTH_UNBERTH VBU WHERE VBU. BERTH_TRANS_ID = VMS. TRANS_ID AND ROWNUM < = 1) END ELSE NULL VSL_MOVES VMS WHERE VMS. TRANS_ID = TAB. (T_ID),'-') Sailed_Date,.

    NVL ((SELECT CASE WHEN VMS. MOVEMENT_TYPE_CODE = 'ATS' THEN (SELECT P.PORT_NAME OF RRS, PORT_MASTER P WHERE P.PORT_CODE = PNT. VSL_NXT_PRT_CALL AND PNT. DOC_NO = TAB. VCN_NO) WHEN VMS. MOVEMENT_TYPE_CODE = 'ATB' THEN (SELECT CASE WHEN VBU. BERTH_CODE LIKE "% VOPK" AND THEN "VOPAK" WHAT VBU. BERTH_CODE AS "VSPM %" THEN "VOPAK" ELSE "POF" VBU VSL_BERTH_UNBERTH END WHERE VBU. BERTH_TRANS_ID = VMS. TRANS_ID AND ROWNUM < = 1) END ELSE NULL VSL_MOVES VMS WHERE VMS. TRANS_ID = TAB. (T_ID), "-") DESTINATION

    DE)

    SELECT

    VM. TRANS_ID,

    VM. VCN_NO,

    VM. MOVEMENT_TYPE_CODE,

    (SELECT PNT. VSL_NAME OF PNTS WHERE NBV. DOC_NO = VM. VCN_NO AND ROWNUM < = 1) VESSEL_NAME;

    (SELECT C.COUNTRY_NAME OF COUNTRY C, VESSEL_MASTER M WHERE C.COUNTRY_CODE = M.FLAG AND M.VSL_CODE = VM. VSL_CODE AND ROWNUM < = 1) AS FLAG,.

    (SELECT M.VSL_IMO_NO FROM VESSEL_MASTER M WHERE M.VSL_CODE = VM. VSL_CODE AND ROWNUM < = 1) IMO_NO;

    TO_CHAR (VM. END_TIME, "DD/MM/YYYY HH24") ARRIVED_DATE,.

    WHEN VM BOX. MOVEMENT_TYPE_CODE = 'STA' THEN (SELECT P.PORT_NAME FROM RRS, PORT_MASTER P WHERE P.PORT_CODE = PNT. LST_PORT_CALL AND PNT. DOC_NO = VM. VCN_NO AND ROWNUM < = 1) WHEN VM. MOVEMENT_TYPE_CODE = 'UTA' THEN (SELECT VB. VSL_BERTH_UNBERTH VB BERTH_CODE WHERE VB. UNBERTH_TRANS_ID = VM. TRANS_ID AND ROWNUM < = 1) END F_ROM.

    --(SELECT T2.ID DELE DE CTE T1 JOIN CTE T2 SUR T1.) SNO = T2. SNO + 1 WHERE T1.ID = VM. TRANS_ID AND T1. NBV = VM. VCN_NO AND T2. NBV = VM. ATD VCN_NO)

    (SELECT T1.ID CTE T1 WHERE SNO = (SELECT T2. SNO + 1 ETC T2 WHERE T2.ID = VM. TRANS_ID AND T2. NBV = VM. T_ID VCN_NO))

    OF VSL_MOVES VM

    WHERE (VM. End_time > = TRUNC (TO_DATE (: pStartDate, ' dd/MM/yy HH24')) AND VM. End_time < = TRUNC (TO_DATE (: pEndDate, ' dd/MM/yy HH24')) or

    ((CASE WHEN VMS. MOVEMENT_TYPE_CODE = 'ATS' THEN (SELECT TO_CHAR (NBV. ATD, "DD/MM/YYYY HH24") OF PNTS WHERE NBV. DOC_NO = TAB. VCN_NO AND ROWNUM < = 1) WHEN VMS. MOVEMENT_TYPE_CODE = 'ATB' THEN (SELECT TO_CHAR (VBU. BRTH_ALL_FAST, "DD/MM/YYYY HH24") OF VSL_BERTH_UNBERTH VBU WHERE VBU. BERTH_TRANS_ID = VMS. TRANS_ID AND ROWNUM < = 1) END ELSE NULL VSL_MOVES VMS WHERE VMS. TRANS_ID = TAB. Saileddate T_ID)) > = TRUNC (TO_DATE (: pStartDate, ' dd/MM/yy HH24')) and

    (CASE WHEN VMS. MOVEMENT_TYPE_CODE = 'ATS' THEN (SELECT TO_CHAR (NBV. ATD, "DD/MM/YYYY HH24") OF PNTS WHERE NBV. DOC_NO = TAB. VCN_NO AND ROWNUM < = 1) WHEN VMS. MOVEMENT_TYPE_CODE = 'ATB' THEN (SELECT TO_CHAR (VBU. BRTH_ALL_FAST, "DD/MM/YYYY HH24") OF VSL_BERTH_UNBERTH VBU WHERE VBU. BERTH_TRANS_ID = VMS. TRANS_ID AND ROWNUM < = 1) END ELSE NULL VSL_MOVES VMS WHERE VMS. TRANS_ID = TAB. T_ID) saileddate) < = TRUNC (TO_DATE (: pEndDate, ' dd/MM/yy HH24')))

    --(Sailed_Date > = TRUNC (TO_DATE (: pStartDate, ' dd/MM/yy HH24 ')) AND Sailed_Date < = TRUNC (TO_DATE (: pEndDate, ' dd/MM/yy HH24')))

    AND VM. MOVEMENT_TYPE_CODE IN ('STA', "UTA")

    ) TAB

    now my Question is should I include Sailed date also starttime and endtime (ex: date range of pStartDate and pEndDate I need to display the date sailed respected records)

    I mean the problem is solved, I found the solution

    docks of pof-

    WITH CTE (SL, VCN_NO, VESSEL_NAME, FLAG, IMO_NO, ARRIVED, FROM_, MOVEMENT_TYPE_, NEXT_MOVE, SAILED_DATE, DESTINATION, FID, TID)

    AS

    (SELECT T1.*,

    WHEN T1 BOX. FROM_ = 'POF' THEN 1 OTHER 2 END FID,

    WHEN T1 BOX. DESTINATION = "POF" THEN 1 OTHER 2 END TID

    Of

    (

    SELECT ROW_NUMBER() OVER (PARTITION OF VM. VCN_NO ORDER BY VB. (SL BRTH_ALL_FAST),

    VM. VCN_NO,

    (SELECT M.VSL_NAME FROM VESSEL_MASTER M WHERE M.VSL_CODE = VM. VESSEL_NAME VSL_CODE),

    (SELECT C.COUNTRY_NAME OF COUNTRY C, VESSEL_MASTER M WHERE C.COUNTRY_CODE = M.FLAG AND M.VSL_CODE = VM. VSL_CODE AND ROWNUM< =1="" )="" as="">

    (SELECT M.VSL_IMO_NO FROM VESSEL_MASTER M WHERE M.VSL_CODE = VM. IMO_NO VSL_CODE),

    VB. BRTH_ALL_FAST HAS ARRIVED,

    (CASE WHEN VM. MOVEMENT_TYPE_CODE = 'ATB' THEN 'ANCHORAGE' WHAT VM. MOVEMENT_TYPE_CODE = "LTB" THEN 'LAND' WHEN VM. MOVEMENT_TYPE_CODE = "BTB" AND (SELECT TT1. VSL_MOVES TT, VSL_BERTH_UNBERTH TT1 BERTH_CODE WHERE TT. TRANS_ID = TT1. BERTH_TRANS_ID AND TT. VCN_NO = VM. VCN_NO AND TT1. UNBERTH_TRANS_ID = VB. BERTH_TRANS_ID) (SELECT WB. BERTH_MASTER BM BERTH_CODE WHERE BM. QUAY_CODE NOT IN ("VOPAK", "SPM")) THEN 'POF' WHEN VM. MOVEMENT_TYPE_CODE = "BTB" AND (SELECT TT1. VSL_MOVES TT, VSL_BERTH_UNBERTH TT1 BERTH_CODE WHERE TT. TRANS_ID = TT1. BERTH_TRANS_ID AND TT. VCN_NO = VM. VCN_NO AND TT1. UNBERTH_TRANS_ID = VB. BERTH_TRANS_ID) (SELECT WB. BERTH_MASTER BM BERTH_CODE WHERE BM. QUAY_CODE IN ("VOPAK", "SPM")) THEN "VOPAK" OTHER (SELECT P.PORT_NAME FROM RRS, P PORT_MASTER WHERE P.PORT_CODE = PNT. LST_PORT_CALL AND PNT. DOC_NO = VM. FROM_ VCN_NO END)).

    VM. MOVEMENT_TYPE_CODE,

    (SELECT THE VIRTUAL COMPUTERS. VSL_MOVES VMS MOVEMENT_TYPE_CODE WHERE VMS. TRANS_ID = VB. NEXT_MOVE UNBERTH_TRANS_ID),

    VB. UB_LST_LNE_CASTOFF SAILED_DATE,

    NVL ((SELECT CASE WHEN VMS. MOVEMENT_TYPE_CODE = 'UTA' THEN 'ANCHORAGE' WHAT VMS. MOVEMENT_TYPE_CODE = 'BTL' THEN 'LAND' WHEN VMS. MOVEMENT_TYPE_CODE = "UTS" THEN (SELECT P.PORT_NAME FROM RRS, PORT_MASTER P WHERE P.PORT_CODE = PNT. VSL_NXT_PRT_CALL AND PNT. DOC_NO = VMS. VCN_NO) WHEN VMS. MOVEMENT_TYPE_CODE = "BTB" AND (SELECT TT1. VSL_MOVES TT, VSL_BERTH_UNBERTH TT1 BERTH_CODE WHERE TT. TRANS_ID = TT1. BERTH_TRANS_ID AND TT. VCN_NO = VM. VCN_NO AND TT1. BERTH_TRANS_ID = VMS. TRANS_ID) (SELECT WB. BERTH_MASTER BM BERTH_CODE WHERE BM. QUAY_CODE NOT IN ("VOPAK", "SPM")) THEN 'POF' WHEN VMS. MOVEMENT_TYPE_CODE = "BTB" AND (SELECT TT1. VSL_MOVES TT, VSL_BERTH_UNBERTH TT1 BERTH_CODE WHERE TT. TRANS_ID = TT1. BERTH_TRANS_ID AND TT. VCN_NO = VM. VCN_NO AND TT1. BERTH_TRANS_ID = VMS. TRANS_ID) (SELECT WB. BERTH_MASTER BM BERTH_CODE WHERE BM. QUAY_CODE IN ("VOPAK", "SPM")) THEN "VOPAK" OTHERWISE NULL END VSL_MOVES VMS WHERE VB. UNBERTH_TRANS_ID = VMS. (TRANS_ID), "-") DESTINATION

    OF VM, VSL_BERTH_UNBERTH VB VSL_MOVES WHERE (VM. TRANS_ID = VB. BERTH_TRANS_ID)

    AND VM. MOVEMENT_TYPE_CODE LIKE '% TB '.

    AND ((VB. BRTH_ALL_FAST > = TO_TIMESTAMP(:pStartDate,'DD/MM/YYYY HH24:MI') AND VB. BRTH_ALL_FAST<= to_timestamp(:penddate,'dd/mm/yyyy="">

    OR (VB. UB_LST_LNE_CASTOFF > = TO_TIMESTAMP(:pStartDate,'DD/MM/YYYY HH24:MI') AND VB. UB_LST_LNE_CASTOFF<= to_timestamp(:penddate,'dd/mm/yyyy="" hh24:mi'))="">

    AND VB. BERTH_CODE (SELECT WB. BERTH_MASTER BM BERTH_CODE WHERE BM. QUAY_CODE NOT IN ("VOPAK", "SPM"))

    - AND VM. VCN_NO = 201510336

    ORDER OF VB. BRTH_ALL_FAST

    ) T1

    )

    Select rownum AS SNO, tab2.* of)

    SELECT

    TAB1. VCN_NO, TAB1. VESSEL_NAME, TAB1. FLAG, TAB1. IMO_NO,

    NVL (BOX WHEN TAB1. HAS ARRIVED< to_timestamp(:pstartdate,'dd/mm/yyyy="" hh24:mi')="" then="" '----------'="" else="" to_char(tab1.arrived,'dd/mm/yyyy="" hh24:mi')="" end,'----------')="">

    NVL (BOX WHEN TAB1. HAS ARRIVED< to_timestamp(:pstartdate,'dd/mm/yyyy="" hh24:mi')="" then="" '----------'="" else="" (select="" t2.from_="" from="" cte="" t2="" where="" t2.sl="TAB1.FROM_" and="" t2.vcn_no="TAB1.VCN_NO)" end,'----------'="">

    NVL (CASE WHEN (SELECT T2. DESTINATION OF THE CTE T2 WHERE T2.SL = TAB1. DEST AND T2. VCN_NO = TAB1. VCN_NO) = 'POF' THEN '-' ANOTHER BOX WHEN TAB1. SAILED_DATE > TO_TIMESTAMP (: pEndDate, ' DD/MM/YYYY HH24') THEN '-' ELSE TO_CHAR (TAB1. (SAILED_DATE, "DD/MM/YYYY HH24") A PIECE,'-') SAILED_DATE,.

    NVL (BOX WHEN TAB1. SAILED_DATE > TO_TIMESTAMP (: pEndDate, ' DD/MM/YYYY HH24') THEN '-' ELSE (SELECT CASE WHEN T2. DESTINATION = 'POF' THEN '-' ANOTHER T2. THE END OF THE DESTINATION OF THE CTE T2 WHERE T2.SL = TAB1. DEST AND T2. VCN_NO = TAB1. (END OF VCN_NO), "-") DESTINATION

    DE)

    SELECT THE TAB. VCN_NO, TAB. VESSEL_NAME, TAB. FLAG, TAB. IMO_NO,

    MIN (TAB. HAPPENED) ARRIVED,

    MIN (TAB.SL) FROM_,

    MAX (TAB. SAILED_DATE SAILED_DATE),

    MAX (TAB.SL) DEST,

    TAB. SNO

    DE)

    SELECT T1.*,

    WHEN T1 BOX. FID = 2 AND T1. TID = 1 THEN 1 WHEN T1. FID = 1 AND T1. TID = 2 THEN 1 WHEN T1. FID = 1 AND T1. TID = 1 THEN 0

    WHEN T1. FID = 2 AND T1. TID = ROWNUM THEN 2 + 1 END OF ANOTHER 3 SNO

    T1 ETC

    ) GROUP OF TABS BY TABS. VCN_NO, TAB. VESSEL_NAME, TAB. FLAG, TAB. IMO_NO, TAB. SNO

    ) TAB1 WHERE TAB1. SNO<>0

    ) tab2

  • How to use the case for this query.

    I got this name from the Employee table.
    columns...

    EmpId,
    EmpType,
    Join date,
    Date of resignation

    Now in EmpType it can be either 'P' OR 'C '.

    So I want to check if the EmpTYpe is 'P' then joiningdate must not be null
    and if the EmpType is 'C' then resignation date must not be null.

    So only want to employee records.
    Help, please.

    Select * from employee
    where (employeetype = 'c' and joinngdate is not null)
    or (employeetype = 'p' and resigndate is not null)

  • How do I optimize the performance of windows 7 with freeware tool or tool?

    How do I optimize the performance of windows 7 with freeware tool or tool?

    Hello

    As Frederik advised, saving No. tune-up, not so-called Optimizer program, no registry cleaners should be used.

    See if this helps you improve performance.

    Search for malicious software with the FREE version of this program.

    This is the right link to download included.

    And does not accept the option "Pay for the version" trial installation

    Download, install, update and scan your system with the free version of Malwarebytes AntiMalware:

    http://www.Malwarebytes.org/products/malwarebytes_free

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    You can clean your hard drive using these two methods.

    "Delete files using Disk Cleanup"

    http://Windows.Microsoft.com/en-us/Windows/delete-files-using-disk-cleanup#delete-files-using-disk-cleanup=Windows-7

    Using the free CCleaner program:

    http://www.Piriform.com/CCleaner

    In NO case use the registry cleaning Option in CCleaner

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    And it is not recommended to use a register or a program of cleaning/TuneUP/utilities they can do more harm to your any good operating system that they claim to be able to do.

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    Make sure you have the latest updated drivers:

    Access the site on your computer or equipment manufacturing > Driver and Software Support Section > search your computer or hardware model number > then your operating system > locate the correct drivers > download and install.

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    What are the other steps, which does not include some of the above:

    "Optimize Windows for better performance.

    http://Windows.Microsoft.com/en-us/Windows/optimize-Windows-better-performance#optimize-Windows-better-performance=Windows-7

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    It would be a good idea also run the System File Checker tool to check that everything is correct in the system files.

    "How to use the System File Checker tool to fix the files on system missing or corrupted on Windows Vista or Windows 7"

    http://support.Microsoft.com/kb/929833

    Use the (SFC.exe) System File Checker tool to determine which file is causing the problem and then replace the file. To do this, follow these steps:

    1. Open an elevated command prompt. To do this, click Start, click principally made programs, Accessories, right-click guest, and then click run as administrator. If you are prompted for an administrator password or a confirmation, type the password, or click allow.
    2. Type the following command and press ENTER:
      sfc/scannow

      The sfc/scannow command analyzes all protected system files and replaces incorrect versions with appropriate Microsoft versions.

    See you soon.

  • How to optimize the query with a join of virtual tables

    I'm working on a query that is get the data of virtual tables 2 and b
    one is formed by the Union, all say 4 queries and b is formed by the Union, all say 3 queries
    then these two virtual tables and b are joined on a column common and data are extracted from their part.
    Problem is that there is about 1 minutes each in the two virtual tables has and b. If individual a and b queries virtual takes about 5 seconds to retrieve data
    but the join on column takes about 25 seconds to retrieve data.
    Can someone guide me how to optimize the recovery of joining 2 virtual tables having large data

    Thank you

    Please read these:

    When your query takes too long
    When your query takes too long...

    How to post a SQL tuning request
    HOW to: Validate a query of SQL statement tuning - model showing

  • Optimize the performance of Windows 8.1

    Hi all

    I bought a HP Envy dv6 (including Windows 8) in November 2012.

    For all those people who have good experiences with Windows 8.1... I was wondering what software you used to optimize performance?

    In the past I had good experiences with...

    Avast

    Advanced System Care 6

    CCleaner

    IObit Malware Fighter

    Driver boost

    However, in Windows 8, it seems that some of them were because of issues with apps from metro.  I had to reset my computer to factory settings countless times because for some reason any my metro apps can not maintain an INTERNET CONNECTION.

    You guys are using any antivirus software or registry/maintenance software to optimize the performance of your PC which has not caused any problems?  Leave the windows firewall "on" your best option for protection?

    Chrome or Internet Explorer?

    Make adjustments to settings PC (like the game "never notify" in the settings of the user account, etc.)?

    What are some software 'must have' that you found useful?

    Thanks in advance!

    Hello!

    Thanks for posting in the forum to Support HP and you thank for your trust in HP!

    I'll try to answer some of your questions:

    For all those people who have good experiences with Windows 8.1... I was wondering what software you used to optimize performance?

    No, it works well on its own. Less you hit, the better. 3 party registry cleaners and optimizers should be used with caution by people with advance knowledge on the subject. More 3rd party (most, not all) optimizers are causing problems more than fix. Remove unnecessary programs, defrag automatically or auto (so HARD, not so SSD drive), run Disk Clean up, clear Temp folder.

    Avast

    Advanced System Care 6

    CCleaner

    IObit Malware Fighter

    Driver boost

    These I wouldn't use one of them.

    You guys are using any antivirus software or registry/maintenance software to optimize the performance of your PC which has not caused any problems?  Leave the windows firewall "on" your best option for protection?

    Light antivirus is ESET and clean of Windows Defender. Windows Firewall (firewall) is essential (critical) part of any system, computer security, network, so it must be turned on. To do this, * no * slow down your computer or your * network * traffic.

    Being without firewall you leave at the open to pirate computer/malware attacks and risk huge data.

    Antivirus software is also a kind of essential program to protect against known and unknown malware attacks. Windows Defender is integrated in Windows 8/8.1 if you don't like it, you can try ESET NOD32, Norton Antivirus...

    Chrome or Internet Explorer?

    They are both very light when it comes to performance. I personally chose IE 10 (my favorite - in win 7 and 8) and IE11. But that's my opinion. Use what suits you best. IE is very safe and stable in the latest versions of Windows. That is to say, I prefer because it is the 1st part, made from Microsoft and works.

    Make adjustments to settings PC (like the game "never notify" in the settings of the user account, etc.)?

    User account control is also very good part of the guarantee. In fact, it helps the principle of "least privilege" security and helps your programs to run with the least amount of law they can. I recommend that you use the value default level3 or the more level '4 always notify when. User account control can help you prevent malicious attacks / viruses / threats.

    What are some software 'must have' that you found useful?

    In my opinion, there is no such thing as software should be - everyone installs and uses what they need. Statistics show that most people (98% or more) use Microsoft Office. Many have some archivers zip/rar as 7-zip, video software like VideoLAN, etc... It depends on what you need. Antivirus software...

    Visit www.microsoft.com/protect for more information on keeping computer secure and shaped

    If it please let me know if I can help you further and do not hesitate to ask for assistance if you have problems.

    Please, click on the star of white LAURELS (left). This way you'll testify for advice or help you have received.  If your problem has been resolved - click on the appropriate button and accept the solution. ***

  • How to change the value games programmatically query in OFA

    Hello

    We have upgraded to 12.2.4.There is a custom value defined in 11i is also improved to R12 which is used in an FDF attribute and the FDF is used in a de FACTO forces (drop ship site) field in the sales form

    Now the problem is this query value set has the following where would adopt with BLOCK. FIELD(:ADDR.) CUSTOMER_ID reference) that is compatible with Oracle Forms.But in R12, we use HTML frame, so the reference should be changed to dial the new code JAVA to UI in R12 customers.

    Now, how we will discover the handle value contained query mdoify the query programmatically OAF or y at - it another way to deal with

    where m.source_organization_id = FND_PROFILE. VALUE('ORG_ID')

    and m.customer_id =: ADDR. CUSTOMER_ID

    and m.subsidiary_inv_org_id = HCAS.org_id

    and HCAS.status = 'A '.

    and AHC. CUST_ACCOUNT_ID = HCA. CUST_ACCOUNT_ID

    and HZP. PARTY_ID = HCA. PARTY_ID

    Thank you

    Prabhat

    Hi AJ,.

    I tried the first option and it worked. But instead of package, I created a profile and used in the query games value and then set the profile in the process request method.

    Thanks a lot for the idea.

    Kind regards

    Prabhat

  • What is the name of this query

    Hi all

    I want to know the name of this query to learn about it, because I don't understand how it works.

    Select the columns tab "(select table columns)" table.

    I saw him, but I don't know how it works.

    Thanks in advance

    It is a scalar subquery expression.

    "An expression of scalar subquery is a subquery that returns exactly one column of a line."

    The value of the scalar subquery expression is the value of the select item from the list of the subquery.

    If the subquery returns 0 rows, then the value of the scalar subquery expression is NULL.

    If the subquery returns more than one line, then Oracle returns an error. »

    See:

    http://docs.Oracle.com/CD/E16655_01/server.121/e17209/expressions013.htm#SQLRF52093

    For example, we can write

    Select empno,

    Ename,

    DEPTNO,

    (select dname dept where deptno = emp.deptno) dname

    WCP

    order by empno

    /

    Instead of

    Select e.empno,

    e.Ename,

    e.DEPTNO,

    d.DNAME

    from emp e,.

    d Dep.

    where e.deptno = d.deptno

    order by empno

    /

  • How to improve the performance of the import

    I'm converting a database of its current WE8ISO88591 character set AL32UTF8
    I use NLS_LENGTH_SEMANTICS to TANK so I don't have to increase the length of the column.

    I followed the instructions in the Oracle:
    144808.1
    313175.1

    Except import that takes too long.

    I took a full database export WE8ISO8859p1 and now its importation in AL32UTF8.

    It is always difficult to prove slow source; but I think it has to do something with NLS_LENGTH_SEMANTICS. On the same
    Server; If the new database was in WE8ISO8859P1, a 5 million row table import took 2 hours; but in Al32UTF8 with NLS_LENGTH_SEMANTICS it takes 1 day!

    No idea how to improve the performance of the import.

    DOUBLE WIRE!

    Please, don't post duplicate discussions.

    Mark this thread ANSWER and continue to use your original thread where you are already helped.

    You have NOT given the info that has been ask in your other thread.
    Re: NLS_LENGTH_SEMANTICS = CHAR import is too slow

  • I think that my computer might work better with less buffering, how to optimize its performance?

    I think that my computer might work better with less buffering, how to optimize its performance?

    How much RAM you have.   If it's 4 GB or less, you may need to upgrade.   8 GB would be excellent although Apple suggests much less.

  • What is the best way to improve the performance of this all-in-one PC?

    What is the best way to improve the performance of this all-in-one PC?

    Thanks in advance.

    David Barrett.

    Here are a few methods:

    • Run msconfig.exe, and then uncheck the startup tasks that you don't need. No matter what you disable, Windows always starts.
    • Use a light virus scanner, for example Microsoft Security Essentials.
    • Replace your magnetic drive with a Solid State Disk (SSD)
  • What can I do to prevent the failure of this query

    Someone used our search engine to submit the search term "NT the Australia".

    With the help of Barbara in several positions before this one, we have a thesaurus that transforms "NT" in "Northern Territory".

    If the "analysis function" I wrote eventually transform the search of this query string:
    select * from search_table where contains(keyfield,'(nt|northern territory) and (australia)')>0
    But which causes this error:

    -20000:ORA - 20000: Oracle Text error: DRG-10800: failed to query:

    I assume that the problem is "NT", which is taken to mean 'short term', rather than the State abbreviation. The same type of problem that can occur when someone searches for BT, which means 'British Telecom', but I imagine that this will be interpreted to mean "generic term".

    What is the usual way to stop these kinds of questions? I can write the code that replaces "NT" by "northern territory" before I even touched my dictionary of synonyms... but if I'm going to hardcode things like that, what else I'd be worried? And although I could replace 'BT' by 'british telecom', I imagine that anyone who wants to seek 'the confidence of bankers' could have a surprise if I.

    Is it all consistent, sensible, ways to deal with this kind of issue that does not imply that users think reading the spirit?

    "You say, I think, it was a stupid move and that there is no harm in putting each search term all about braces? "'({WOMAN}) and (HAT {})' would be just as acceptable, as fast as the '(femme et chapeau)? »

    Fix.

Maybe you are looking for