What Should be Query Syntax ?

table has a field 'A' containing numeric value...
Want a field 'B' to display to cumulative data of row 'A'
where ,
          B1=A1, B2=B1+A2 , B3=B2+A3 .....
Here 'B' is not a table field..
it is just for display purpous on Report..
column 'A' has following values in desc order : 5,5,4,4,4,3,3,2,2,1
So 'B' should have 5,10,14,18,22,25,28,30,32,33
i m working on Ms SQL server 2005 reporting services ..

I don't know how you can do it in MS SQL Server (you know this is an Oracle forum, right?)
But in Oracle you can do it this way:
create table t
(a number)
insert into t values (5);
insert into t values (5);
insert into t values (4);
insert into t values (4);
insert into t values (4);
insert into t values (3);
insert into t values (3);
insert into t values (2);
insert into t values (2);
insert into t values (1);
select a
     , Sum (a) over (order by rownum
                    ) b
  from t
         A          B
         5          5
         5         10
         4         14
         4         18
         4         22
         3         25
         3         28
         2         30
         2         32
         1         33
10 rows selected.

Similar Messages

  • Stuck on what SHOULD be simple syntax...

    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    This code is one script of an update script I'm trying to push.
    It's failing. I have to write the code so that it can be re-run multiple times and not cause the main job to fail.
    I've been staring at this for hours and can NOT see why it's erroring.
    Here is the error being thrown.
    VALUES ('NRSA_APP_USER',11,'NONE','APPROVED','N','Y','10M','N','SPIREK, FRANK','Y',1)';
    ERROR at line 3:
    ORA-06550: line 3, column 10:
    PLS-00103: Encountered the symbol "NRSA_APP_USER" when expecting one of the
    following:
    * & = - + ; < / > at in is mod remainder not rem return
    returning <an exponent (**)> <> or != or ~= >= <= <> and or
    like like2 like4 likec between into using || multiset bulk
    member submultisetHere is my pl/sql code. --I simplified the exception clause, to try and narrow down possibilities...But the commented out exception portion is the original.
    BEGIN execute immediate
    'create user NRSA_APP_USER
      identified by XXX
      default tablespace USERS
      temporary tablespace TEMP
      profile DEFAULT
      quota 10m on USERS';
    EXCEPTION WHEN OTHERS THEN null;  --DBMS_OUTPUT.PUT_LINE('User already Exists');
    END;
    grant connect to NRSA_APP_USER;
    grant create session to NRSA_APP_USER;
    commit;
    --  script to register the application user with UMA
    BEGIN execute immediate
    'INSERT INTO UMA.UMA_USERS(USER_NAME,AGENCY_CODE,HOME_ORG_ID,STATUS,ADMIN_IND,HIDDEN_IND,QUOTA_USERS,DIRECT_ACCESS,CONTACT,EMAIL_ENABLED,EID_LEVEL)
    VALUES ('NRSA_APP_USER',11,'NONE','APPROVED','N','Y','10M','N','SPIREK, FRANK','Y',1)';
    EXCEPTION WHEN OTHERS THEN null; --DBMS_OUTPUT.PUT_LINE('User NRSA_APP_USER already inserted');
    END;
    BEGIN execute immediate
    'INSERT INTO UMA.UMA_CLIENT_APP_USERS (APP_NAME,USER_NAME,DISPLAY_ORDER)
    VALUES ('NRISINFORMS','NRSA_APP_USER',1)';
    EXCEPTION WHEN OTHERS THEN null; --DBMS_OUTPUT.PUT_LINE('User already inserted');
    END;
    BEGIN execute immediate
    'UMA.UMA_BATCH_PROCESSOR.PROCESS_USERS';
    EXCEPTION WHEN OTHERS THEN NULL;
    END;
    /The error indicates that it doesn't like the column NRISINFORMS...or something PRIOR to that in the code. I checked the table, and the column is spelled right, and it's a varchar2. And then I looked over all the code prior to that for punctuation and such. No luck. I even cut/paste the code into my formatter in TOAD. And it didn't find anything wrong.
    Can ANYONE see what I am apparently oblivious to?
    Thank you.
    Edited by: Willy_B on Oct 18, 2012 9:29 AM - fixed code tag, and also put exact cut/paste of error report.

    Hi,
    Willy_B wrote:
    ... Here is the error being thrown.
    VALUES ('NRSA_APP_USER',11,'NONE','APPROVED','N','Y','10M','N','SPIREK, FRANK','Y',1)';
    ERROR at line 3:
    ORA-06550: line 3, column 10:
    PLS-00103: Encountered the symbol "NRSA_APP_USER" when expecting one of the
    following:
    * & = - + ; < / > at in is mod remainder not rem return ...
    Here is my pl/sql code ...
    BEGIN execute immediate
    'INSERT INTO UMA.UMA_USERS(USER_NAME,AGENCY_CODE,HOME_ORG_ID,STATUS,ADMIN_IND,HIDDEN_IND,QUOTA_USERS,DIRECT_ACCESS,CONTACT,EMAIL_ENABLED,EID_LEVEL)
    VALUES ('NRSA_APP_USER',11,'NONE','APPROVED','N','Y','10M','N','SPIREK, FRANK','Y',1)';
    EXCEPTION WHEN OTHERS THEN null; --DBMS_OUTPUT.PUT_LINE('User NRSA_APP_USER already inserted');
    END;
    You have to do somnething special to include a single-quote character in a string literal, such as repeat the single-quotes that are inside the literal:
    BEGIN execute immediate
          'INSERT INTO UMA.UMA_USERS
          ( USER_NAME
          , AGENCY_CODE
          , HOME_ORG_ID
          , STATUS
          , ADMIN_IND
          , HIDDEN_IND
          , QUOTA_USERS
          , DIRECT_ACCESS
          , CONTACT
          , EMAIL_ENABLED
          , EID_LEVEL
    VALUES ( ''NRSA_APP_USER''
           , 11
           , ''NONE''
           , ''APPROVED''
           , ''N''
           , ''Y''
           , ''10M''
           , ''N''
           , ''SPIREK, FRANK''
           , ''Y''
           , 1
           )';or use Q-notation:
    BEGIN execute immediate
          Q'{INSERT INTO UMA.UMA_USERS     -- Note Q and { here
          ( USER_NAME
          , AGENCY_CODE
          , HOME_ORG_ID
          , STATUS
          , ADMIN_IND
          , HIDDEN_IND
          , QUOTA_USERS
          , DIRECT_ACCESS
          , CONTACT
          , EMAIL_ENABLED
          , EID_LEVEL
    VALUES ( 'NRSA_APP_USER'
           , 11
           , 'NONE'
           , 'APPROVED'
           , 'N'
           , 'Y'
           , '10M'
           , 'N'
           , 'SPIREK, FRANK'
           , 'Y'
           , 1
           )}'                    -- Note } here
    ;Why are you using EXECUTE IMMEDIATE for this at all? PL/SQL has INSERT statements.
    Also, why do you need to create uses on the fly, especially when all the details are hard-coded?

  • What should be the XQuery for this..

    hi
    i have this xml file. and
    what should be query to select the 'prod_id' where the 'prod_group = food'
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE ROOT (View Source for full doctype...)>
    - <ROOT>
    - <row>
    <field name="prod_sk">1</field>
    <field name="prod_id">S101</field>
    <field name="prod_desc">Soap 1</field>
    <field name="prod_catg">Soap</field>
    <field name="prod_group">Detergent</field>
    </row>
    - <row>
    <field name="prod_sk">2</field>
    <field name="prod_id">S102</field>
    <field name="prod_desc">Soap 2</field>
    <field name="prod_catg">Soap</field>
    <field name="prod_group">Detergent</field>
    </row>
    - <row>
    <field name="prod_sk">3</field>
    <field name="prod_id">M101</field>
    <field name="prod_desc">Meat 1</field>
    <field name="prod_catg">Meat</field>
    <field name="prod_group">Food</field>
    </row>
    - <row>
    <field name="prod_sk">4</field>
    <field name="prod_id">M102</field>
    <field name="prod_desc">Meat 2</field>
    <field name="prod_catg">Meat</field>
    <field name="prod_group">Food</field>
    </row>
    - <row>
    <field name="prod_sk">5</field>
    <field name="prod_id">C101</field>
    <field name="prod_desc">Choco 1</field>
    <field name="prod_catg">Chocolates</field>
    <field name="prod_group">Food</field>
    </row>
    - <row>
    <field name="prod_sk">6</field>
    <field name="prod_id">C102</field>
    <field name="prod_desc">Choco 2</field>
    <field name="prod_catg">Chocolates</field>
    <field name="prod_group">Food</field>
    </row>
    - <row>
    <field name="prod_sk">7</field>
    <field name="prod_id">R101</field>
    <field name="prod_desc">Rice 1</field>
    <field name="prod_catg">Rice</field>
    <field name="prod_group">Food</field>
    </row>
    - <row>
    <field name="prod_sk">8</field>
    <field name="prod_id">R102</field>
    <field name="prod_desc">Rice 2</field>
    <field name="prod_catg">Rice</field>
    <field name="prod_group">Food</field>
    </row>
    - <row>
    <field name="prod_sk">9</field>
    <field name="prod_id">PD101</field>
    <field name="prod_desc">Powder 1</field>
    <field name="prod_catg">Washing Powder</field>
    <field name="prod_group">Detergent</field>
    </row>
    - <row>
    <field name="prod_sk">10</field>
    <field name="prod_id">PD102</field>
    <field name="prod_desc">Powder 2</field>
    <field name="prod_catg">Washing Powder</field>
    <field name="prod_group">Detergent</field>
    </row>
    </ROOT>

    Cross join?
    SQL> select a.country_short_name
      2       , b.country_short_name
      3    from country_sample a
      4   cross
      5    join country_sample b
      6   where a.country_short_name != b.country_short_name
      7  /
    COUNTRY_SH COUNTRY_SH
    IND        PAK
    IND        ENG
    IND        AUS
    PAK        IND
    PAK        ENG
    PAK        AUS
    ENG        IND
    ENG        PAK
    ENG        AUS
    AUS        IND
    AUS        PAK
    AUS        ENG
    12 rows selected.

  • XPATH Database Query Syntax in an Assign

    Trying to get an XPATH Database query to work by assigning the Input variable value in a simple BPEL Process to my query condition. I keep getting invalid XPATH errors. I cannot seem to figure out how get write it out.
    Here is what I have:
    <from expression="orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')"/>
    Here is my error:
    Error(30): [Error ORABPEL-10039]: invalid xpath expression [Description]: in line 30 of "C:\OraBPELPM_1\integration\jdev\jdev\mywork\BPELws\ReadDB\ReadDB.bpel", xpath expression "orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')" specified in <from> is not valid, because XPath query syntax error. Syntax error while parsing xpath expression "orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')", at position "80" the exception is Expected: ). Please verify the xpath query "orcl:query-database( 'select ename from emp where ename = bpws:getVariableData('inputVariable','payload','/client:ReadDBProcessRequest/client:input')' ,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL')" which is defined in BPEL process. . [Potential fix]: Please make sure the expression is valid.
    Any help?
    Thanks!!!

    Ok. I have figured out how to place the condition (variable value) inside a concatentated string. So my final result is the actual XPATH Query-Database statement. But the problem is it is being returned as a String. How can I turn that final string into the XPATH expression I need? I suspect another <COPY> block could pull this off but I am not sure how to do it.
    Here is my code:
    <process name="QueryBuild" targetNamespace="http://xmlns.oracle.com/QueryBuild" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:ns1="http://www.w3.org/2001/XMLSchema" xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:client="http://xmlns.oracle.com/QueryBuild" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="client:QueryBuild" myRole="QueryBuildProvider"/>
    </partnerLinks>
    <variables>
    <variable name="inputVariable" messageType="client:QueryBuildRequestMessage"/>
    <variable name="outputVariable" messageType="client:QueryBuildResponseMessage"/>
    <variable name="QueryText" type="ns1:string"/>
    </variables>
    <sequence name="main">
    <receive name="receiveInput" partnerLink="client" portType="client:QueryBuild" operation="process" variable="inputVariable" createInstance="yes"/><!-- Generate reply to synchronous request -->
    <assign name="Assign_1">
    <copy>
    <from expression="concat(&quot;orcl:query-database('select ename from emp where empno = &quot;, bpws:getVariableData('inputVariable','payload','/client:QueryBuildProcessRequest/client:input'), &quot;,false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL)'&quot;)"/>
    <to variable="QueryText"/>
    </copy>
    <copy>
    <from variable="QueryText"/>
    <to variable="outputVariable" part="payload" query="/client:QueryBuildProcessResponse/client:result"/>
    </copy>
    </assign>
    <reply name="replyOutput" partnerLink="client" portType="client:QueryBuild" operation="process" variable="outputVariable"/>
    </sequence>
    </process>

  • Simple database query syntax question

    Hi experts,
    I am just stucked here...
    e.g.
    String Name = "John Doe";
    String query =
    "select * from table where NameCol = "+Name;
    ResultSet rs =stmt.executeQuery(query);
    while (rs.next()) {
    System.out.println(rs.getString(NameCol);
    The complier complains that "Syntax error !" at
    " NameCol = ....." ?!?!
    Why this is happening ? What is the correct syntax ?
    Thanks in advance !
    Philip

    finally figured it out. thanks...

  • Buffer Hit Ratio % -- Whats the right query ?

    Whats the right query to track Buffer Hit % ;
    Using this :
    prompt BUFFER HIT RATIO %
    prompt ===============
    select 100 * ((a.value+b.value)-c.value) / (a.value+b.value) "Buffer Hit Ratio"
    from v$sysstat a, v$sysstat b, v$sysstat c
    where
    a.statistic# = 38
    and
    b.statistic# = 39
    and
    c.statistic# = 40;
    Buffer Hit Ratio
    99.9678438
    However, using this :
    Select
    Round((Sum(Decode(name, 'consistent gets',value,0)) +
    Sum(Decode(name, 'db block gets',value,0)) -
    Sum(Decode(name, 'physical reads',value,0))) /
    (Sum(Decode(name, 'consistent gets',value,0)) +
    Sum(Decode(name, 'db block gets',value,0)) ) * 100, 4)
    from V$sysstat;
    Comes up as : 67.7069 %
    So which is the right one ?
    Thanks.

    user4874781 wrote:
    Well, I recently joined this organisation and that was the script that was used since long to check Buffer Hit Ratio%.
    But when I ran a TOAD report, using the other query, the value came up different.
    So am confused .. Whats the difference and which is the right one ?
    Try running the following query:
    select
            statistic#, name
    from
            v$sysstat
    where
            statistic# in (38,39,40)
    or      name in (
                    'consistent gets',
                    'physical reads',
                    'db block gets'
    ;The you will understand the point the previous answer was making. It's a bad idea to rely on things like the statistic# being consistent across different versions of Oracle - names tend to be safer.
    But neither query is correct. If you want any sort of vaguely meaningful "buffer cache hit ratio", you should be quering v$buffer_pool_statistics. See also: Re: Testing of buffer cache reveals these results: and http://jonathanlewis.wordpress.com/2007/09/02/hit-ratios/
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge." Stephen Hawking.

  • I have a problem with Adobe Creative Cluod. Basically after installing the application when I open it I do not charge adobe products but remains all white screen. I tried to uninstall it and install it several times but it does not work.  What should I do

    I have a problem with Adobe Creative Cluod. Basically after installing the application when I open it I do not charge adobe products but remains all white screen. I tried to uninstall it and install it several times but it does not work.
    What should I do?

    Hi Anto2211,
    Please follow the thread: Black screen CC where this issue is already discussed and resolved.
    Let me know for any further query.
    Thanks,
    Ratandeep Arora

  • What should be done for this ?

    hi ,
    here is my question ..my xml will have
    <Message>
    <ATO>
    <somefiled="X" type=int value=35 />
    </ATO>
    <FIX>
    <somefiled="Y" type=String value=50 />
    <FIX>
    </Message>
    Now first i have to parse this xml ..then my java program is going to accept value from user ..and depending on user specified value i've to use either ATO or FIX fields...e.g if user value is 35 then my program should use fields within ATO node.
    what should be done for this ..
    and what if i change values in my xml file..will i have to restart my application to load xml again ?

    I have changed your XML to make it well formed. Please refer this further in this reply.
    Well Formed XML:
    <Message>
         <ATO somefiled="X" type="int" value="35"/>
         <FIX somefiled="Y" type="String" value="50"/>
    </Message>
    daitkarsachin wrote:Now first i have to parse this xml ..then my java program is going to accept value from user ..and depending on user specified value i've to use either ATO or FIX fields...e.g if user value is 35 then my program should use fields within ATO node.
    what should be done for this ..A simple XPath Query can do trick for you, it can give you ATO or FIX element according to user specified value. XPath query can be:
    // replace ##user_specified_value## with value user enters.
    String xPathquery= "/Message/child::*[@value='##user_specified_value##']";
    daitkarsachin wrote:and what if i change values in my xml file..will i have to restart my application to load xml again ?Not necessary to restart application but you need to parse or reload updated XML file again.

  • What should be the MSS version ????

    Hi,
    Hi I have installed my ESS 6.0 business package SP 11 on my development Enterprise portal 7.0 SP 11.
    The XSS file I used for this installation was :-
    PCUIGP of SP11
    ESS of SP 10_10 (bacause SP11 SCA's was giving errors at the time of installation,so as per the recommendations we installed its SP 10)
    Going further,I installed the NWDI of SP11 on the same host of my EP SP11 as another SAP instance.
    In this developers have already started building their tracks and source codes/configurations and did import & all.
    Now in our landscape,request for MSS installation on the same dev EP7.0 has come.So my questions are:-
    1) What should be the version of Business package MSS. should it be 10 or 11 ?
    2) If,I am installing the business package of MSS of SP11 then what should be the version of XSS files for MSS..should it be 10 or 11.
    3) For MSS of 11 version.will there be any compatibility issue with ESS,as my XSS for ESS is at 10 ?
    4) If require,is it possible to upgrade my ESS now from 10 to 11? will it be safe now?
    Kindly please reply to me as early as possible.
    Regards
    Saurabh Sharma

    Hi Abhishek,
    1.As i said,we have already started customizing the webdynpro source code on xss-ess 10 in nwdi track,so would it be advisable to upgrade to xss-ess to SP11and then do the fresh installation of MSS SP11,as all our changes will be lost?
    Yes, if you upgrade, all your customization will be lost.
    can we go for repair connection between 10 & 11 in this case?
    I dont know whether I understand your query or not. Refer sap note 872892. Refer the pdf which is attached to this note and then create the required tracks. Then you can find out all your changes in SP10 that you had done and can apply same in SP11 or SP13 whichever you will upgrade to.
    2.As I told you that my WAS(EP) is at SP11,so I have one question,moving forward if we upgrade our ESS and MSS to SP13,will I have to upgrade my EP also to SP13?
    Yes, it is fine to have ess, mss at SP13 even though EP is at SP11.So no need to upgrade EP.

  • What should I do? i  have error while installing creative cloud desktop, i have error with number 1

    I am on the mac, and i don't know what should i do?

    HI Duckapemadness
    Please follow the link: Other downloads and download Adobe Application Manager. On its first launch it will update itself as the required Creative Cloud Desktop application.
    Let me know for any further query.
    Thanks,
    Ratandeep Arora

  • IMac really slow compare to my new macbook air which i bought several month ago. What should i do to get my iMac fast?

    I have just bought a new Macbook Air several month ago, and i realize that my iMac is very very slow compare with the macbookair, what should i do to faster my iMac,
    This few point happen slow at my iMac:
    When Restart it is very slow.
    When search spotlight or search a file using finder.
    When Running iPhoto, iTunes, iMovie. Especially iPhoto
    When transfering image from my phone to iphoto.
    When Open New Application.
    When working in multi application when swich between application, sometimes it was hang for a few second.
    Sometimes typing aslo slow and the text wont come out and the cursor hold a few second.
    I think above 7 points was very annoying my working, especially when in a rush.
      Model Name:          iMac
      Model Identifier:          iMac12,1
      Processor Name:          Intel Core i5
      Processor Speed:          2.5 GHz
      Number of Processors:          1
      Total Number of Cores:          4
      L2 Cache (per Core):          256 KB
      L3 Cache:          6 MB
      Memory:          4 GB
      Boot ROM Version:          IM121.0047.B1F
      HD Capacity:          499.25 GB (499,248,103,424 bytes)
      Running OSX 10.9.2
    Could anybody help me to solve this problem, i am guesing maybe my HDD not working properly, or if i change to SSD it will be better? but how?
    Thanks to all of you that willing to help me.

    1. This procedure is a diagnostic test. It changes nothing, for better or worse, and therefore will not, in itself, solve the problem. But with the aid of the test results, the solution may take a few minutes, instead of hours or days.
    2. If you don't already have a current backup, back up all data before doing anything else. The backup is necessary on general principle, not because of anything in the test procedure. Backup is always a must, and when you're having any kind of trouble with the computer, you may be at higher than usual risk of losing data, whether you follow these instructions or not.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    3. Below are instructions to run a UNIX shell script, a type of program. All it does is to collect information about the state of the computer. That information goes nowhere unless you choose to share it. However, you should be cautious about running any kind of program (not just a shell script) at the request of a stranger. If you have doubts, search this site for other discussions in which this procedure has been followed without any report of ill effects. If you can't satisfy yourself that the instructions are safe, don't follow them. Ask for other options.
    Here's a summary of what you need to do, if you choose to proceed:
    ☞ Copy a line of text in this window to the Clipboard.
    ☞ Paste into the window of another application.
    ☞ Wait for the test to run. It usually takes a few minutes.
    ☞ Paste the results, which will have been copied automatically, back into a reply on this page.
    The sequence is: copy, paste, wait, paste again. You don't need to copy a second time. Details follow.
    4. You may have started the computer in "safe" mode. Preferably, these steps should be taken in “normal” mode, under the conditions in which the problem is reproduced. If the system is now in safe mode and works well enough in normal mode to run the test, restart as usual. If you can only test in safe mode, do that.
    5. If you have more than one user, and the one affected by the problem is not an administrator, then please run the test twice: once while logged in as the affected user, and once as an administrator. The results may be different. The user that is created automatically on a new computer when you start it for the first time is an administrator. If you can't log in as an administrator, test as the affected user. Most personal Macs have only one user, and in that case this section doesn’t apply. Don't log in as root.
    6. The script is a single long line, all of which must be selected. You can accomplish this easily by triple-clicking anywhere in the line. The whole line will highlight, though you may not see all of it in the browser window, and you can then copy it. If you try to select the line by dragging across the part you can see, you won't get all of it.
    Triple-click anywhere in the line of text below on this page to select it:
    PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/libexec;clear;cd;p=(Software Hardware Memory Diagnostics Power FireWire Thunderbolt USB Fonts 51 4 300 25 5120 KiB/s 1024 85 \\b% 10240 1 MB/s 25000 ports 'com.autodesk.AutoCad com.evenflow.dropbox com.google.GoogleDrive' DYLD_INSERT_LIBRARIES\ DYLD_LIBRARY_PATH -86 ` route -n get default|awk '/e:/{print $2}' ` 25 N\\/A down up 102400 25600 recvfrom sendto CFBundleIdentifier 25 50 );N5=${#p[@]};p[N5]=` networksetup -listnetworkserviceorder|awk ' NR>1 { sub(/^\([0-9]+\) /,"");n=$0;getline;} $NF=="'${p[45]}')" { sub(/.$/,"",$NF);print n;exit;} ' `;f=('\n%s: %s\n' '\n%s\n\n%s\n' '\nRAM details\n%s\n' %s\ %s '%s\n\t(%s)\n' );S0() { echo ' { q=$NF+0;$NF="";u=$(NF-1);$(NF-1)="";gsub(/^ +| +$/,"");if(q>='${p[$1]}')printf("%s (UID %s) is using %s '${p[$2]}'\n",$0,u,q);} ';};s=(' /^ *$|CSConfigDot/d;s/^ */   /;s/[-0-9A-Fa-f]{22,}/UUID/g;s/(ochat)\.[^.]+(\..+)/\1\2/;/Shared/!s/\/Users\/[^/]+/~/g ' ' s/^ +//;5p;6p;8p;12p ' ' {sub(/^ +/,"")};NR==6;NR==13&&$2< '${p[10]} ' 1,5d;/[Bmy].*:/d;H;$   { g;/s: [^EO]|x([^08]|02[^F]|8[^0])/p;} ' ' 5h;6   { H;g;/P/!p;} ' ' ($1~/^Cy/&&$3>'${p[11]}')||($1~/^Cond/&&$2!~/^N/) ' ' /:$/{ s/ *:$//;x;s/\n//;/Apple|Genesy|Intel|SMSC/d;s/\n.*//;/\)/p;};/^ *(V.+ [0N]|Man).+ /{ s/ 0x.... //;s/[()]//g;s/(.+: )(.+)/ (\2)/;H;} ' ' s/^.*C/C/;H;$   { g;/No th|pms/!p;} ' '/= [^GO]/p' '{$1=""};1' ' /Of/!{ s/^.+is |\.//g;p;} ' '/(sh|ng|ic)$/p' ' $3~/[0-9]:[0-9]{2}$/ { $4="";gsub("  "," ");gsub(/:[0-9:a-f]{14}/,"");} { print|"tail -n'${p[12]}'";} ' ' NR==2&&$4<='${p[13]}' { print $4;} ' ' END { $2/=256;if($2>='${p[15]}')print int($2) } ' ' NR!=13{next};{sub(/[+-]$/,"",$NF)};'"`S0 21 22`" 'NR==2'"`S0 37 17`" ' NR!=5||$8!~/[RW]/{next};{ $(NF-1)=$1;$NF=int($NF/10000000);for(i=1;i<=3;i++){$i="";$(NF-1-i)="";};};'"`S0 19 20`" 's:^:/:p' '/\.kext\/(Contents\/)?Info\.plist$/p' ' s/^.{52}//;s/ .+//p ' ' /Launch[AD].+\.plist$/;END{if(NR<100)print "/System/";} ' '/\.xpc\/(Contents\/)?Info\.plist$/p' ' NR>1&&!/0x|\.[0-9]+$|com\.apple\.launchctl\.(Aqua|Background|System)$/ { print $3;} ' '/\.(framew|lproj)/d;/plist:|:.+(M.+exec|scrip)/s/:[^:]+//p' '/root/p' ' !/\/Contents\/.+\/Contents|Applic|Autom|Frameworks/&&/Lib.+\/Info.plist$/;END{if(NR<100)print "/System/"};' '/^\/usr\/lib\/.+dylib$/p' '/\/etc\/(auto_m|hosts[^.]|peri)/s/^\.\/[^/]+//p' ' /\/(Contents\/.+\/Contents|Frameworks)\//d;p;' 's/\/(Contents\/)?Info.plist$//;p' ' { gsub("^| ","||kMDItem'${p[35]}'=");sub("^.."," ") };1 ' p '{print $3"\t"$1}' 's/\'$'\t''.+//p' 's/1/On/p' '/Prox.+: [^0]/p' '$2>'${p[9]}'{$2=$2-1;print}' ' BEGIN { i="'${p[26]}'";M1='${p[16]}';M2='${p[18]}';M3='${p[31]}';M4='${p[32]}';} !/^A/ { next;} /%/ { getline;if($5<M1) a="user "$2"%, system "$4"%";} /disk0/&&$4>M2 { b=$3" ops/s, "$4" blocks/s";} $2==i { if(c) { d=$3+$4+$5+$6;next;};if($4>M3||$6>M4) c=int($4/1024)" in, "int($6/1024)" out";} END { if(a)print "CPU: "a;if(b)print "I/O: "b;if(c)print "Net: "c" (KiB/s)";if(d)print "Net errors: "d" packets/s";} ' ' /r\[0\] /&&$NF!~/^1(0|72\.(1[6-9]|2[0-9]|3[0-1])|92\.168)\./ { print $NF;exit;} ' ' !/^T/ { printf "(static)";exit;} ' '/apsd|OpenD/!s/:.+//p' ' (/k:/&&$3!~/(255\.){3}0/ )||(/v6:/&&$2!~/A/ ) ' ' /lR/ { if($2<='${p[25]}')print $2;} ' ' BEGIN { FS=":";} { n=split($3,a,".");sub(/_2.+/,"",a[n-1]);b=b"\n"$2" "a[n-1]" "a[n]" "$1;c=c$1;} END { d="sort";print b|d;close(d);if(c)print("\n\t* Code injection");} ' ' NR!=4{next} {$NF=int($NF/10240)} '"`S0 27 14`" ' END { if($3~/[0-9]/)print$3;} ' ' BEGIN { L='${p[36]}';} !/^[[:space:]]*(#.*)?$/ { l++;if(l<=L)f=f"\n\t"$0;} END { F=FILENAME;if(!f) f="\n\t[N/A]";"file -b "F|getline T;if(T!~/^(A.+ E.+ text$|POSIX sh.+ text ex)/) F=F" ("T")";printf("\nContents of %s\n%s\n",F,f);if(l>L) printf("\n\t...and %s more line(s)\n",l-L);} ' ' BEGIN{FS="= "} /Path/{print $2} ' ' /^ +B/{ s/.+= |(-[0-9]+)?\.s.+//g;p;} ' ' END{print NR} ' ' /id: N|te: Y/{i++} END{print i} ' '/:/!p' ' /:/{$0="'"${p[28]}"'"};1;' ' $0;END { if(NR<100)print "com.apple.";} ' );c1=(system_profiler pmset\ -g nvram fdesetup find syslog df vm_stat sar ps sudo\ crontab sudo\ iotop top pkgutil PlistBuddy whoami cksum kextstat launchctl sudo\ launchctl crontab 'sudo defaults read' stat lsbom mdfind ' for i in ${p[24]};do ${c1[18]} ${c2[27]} $i;done;' defaults\ read scutil sudo\ dtrace sudo\ profiles sed\ -En awk /S*/*/P*/*/*/C*/*/airport networksetup );c2=(com.apple.loginwindow\ LoginHook '-c Print /L*/P*/loginw*' '-c Print L*/P*/*loginit*' '-c Print L*/Saf*/*/E*.plist' '~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \)' '.??* -path .Trash -prune -o -type d -name *.app -print -prune' '-c Print\ :'${p[35]}' 2>&1' '-c Print\ :Label 2>&1' '{/,}L*/{Con,Pref}* -type f ! -size 0 -name *.plist -exec plutil -s {} \;' "-f'%N: %l' Desktop L*/Keyc*" therm sysload boot-args status '-F bsd -k Sender kernel -k Message CReq "Beac|caug|dead[^l]|GPU |hfs: Ru|inval|jnl:|last value [1-9]|n Cause: -|NVDA\(|pagin|proc: t|Roamed|rror|ssert|Thrott|timed? ?o|WARN" -k Message Ane "SMC:" -o -k Sender fseventsd -k Message CReq "SL"' '-du -n DEV -n EDEV 1 10' 'acrx -o comm,ruid,%cpu' '-t1 10 1' '-f -pfc /var/db/*/*.{BS,Bas,Es,OSXU,Rem}*.bom' '{/,}L*/Lo*/Diag* -type f \( -exec grep -lq "^Thread c" {} \; -exec printf \* \; -o -true \) -execdir stat -f:%Sc:%N -t%F {} \;' '-L {/{S*/,},}L*/Lau* -type f' '-L /{S*/,}L*/StartupItems -type f -exec file {} +' '-L /S*/L*/{C*/Sec*A,E}* {/,}L*/{A*d,Compon,Ex,In,iTu,Keyb,Mail/B,P*P,Qu*T,Scripti,Sec,Servi,Spo}* -type f -name Info.plist' '/usr/lib -type f -name *.dylib' `awk "${s[31]}"<<<${p[23]}` "/e*/{auto_master,{cron,fs}tab,hosts,{launchd,sysctl}.conf} /u*/lo*/e*/per*/*/* .launchd.conf" list getenv /Library/Preferences/com.apple.alf\ globalstate --proxy '-n get default' -I --dns -getdnsservers -getinfo\ "${p[N5]}" -P -m\ / '' -n1 '-R -l1 -n1 -o prt -stats command,uid,prt' '--regexp --only-files --files com.apple.pkg.*|sort|uniq' -kl -l );N1=${#c2[@]};for j in {0..8};do c2[N1+j]=SP${p[j]}DataType;done;N2=${#c2[@]};for j in 0 1;do c2[N2+j]="-n 'syscall::'${p[33+j]}':return {@out[execname,uid]=sum(arg0)} tick-10sec {trunc(@out,1);exit(0)}'";done;l=(Restricted\ files Hidden\ apps RAM POST Battery Safari\ extensions Bad\ plists 'High file counts' User Heat System\ load boot\ args FileVault Diagnostic\ reports Log 'Free space (MiB)' 'Swap (MiB)' Activity 'CPU per process' Login\ hook 'I/O per process' Mach\ ports kexts Daemons Agents launchd Startup\ items Admin\ access Root\ access Bundles dylibs Apps Font\ issues Inserted\ dylibs Firewall Proxies DNS TCP/IP RSSI Profiles 'Elapsed time (s)' Root\ crontab User\ crontab 'Global login items' 'User login items' );N3=${#l[@]};for i in 0 1 2;do l[N3+i]=${p[5+i]};done;N4=${#l[@]};for j in 0 1;do l[N4+j]="Current ${p[29+j]}stream data";done;A0() { id -G|grep -qw 80;v[1]=$?;((v[1]==0))&&sudo true;v[2]=$?;v[3]=`date +%s`;clear;};for i in 0 1;do eval ' A'$((1+i))'() { v[0]=` eval "${c1[$1]} ${c2[$2]}"|'${c1[30+i]}' "${s[$3]}" `;[[ "${v[0]}" ]];};A'$((3+i))'() { v[0]=` while read i;do eval "${c1[$1]} ${c2[$2]}" \"$i\"|'${c1[30+i]}' "${s[$3]}";done<<<"${v[$4]}" `;[[ "${v[0]}" ]];};A'$((5+i))'() { v[0]=` while read i;do '${c1[30+i]}' "${s[$1]}" "$i";done<<<"${v[$2]}" `;[[ "${v[0]}" ]];};';done;A7(){ v[0]=$((`date +%s`-v[3]));};B2(){ v[$1]="${v[0]}";};for i in 0 1;do eval ' B'$i'() { unset v[0];((v['$((i+1))']==0))||{ v[0]=No;false;};};B'$((3+i))'() { v[$2]=`'${c1[30+i]}' "${s[$3]}"<<<"${v[$1]}"`;} ';done;B5(){ v[$1]="${v[$1]}"$'\n'"${v[$2]}";};B6() { v[0]=` paste -d: <(echo "${v[$1]}") <(echo "${v[$2]}")|awk -F: ' {printf("'"${f[$3]}"'",$1,$2)} ' `;};B7(){ v[0]=`grep -Fv "${v[$1]}"<<<"${v[0]}"`;};C0(){ echo "${v[0]}";};C1() { [[ "${v[0]}" ]]&&printf "${f[$1]}" "${l[$2]}" "${v[0]}";};C2() { v[0]=`echo ${v[0]}`;[[ "${v[0]}" != 0 ]]&&C1 0 $1;};C3() { v[0]=`sed -E "${s[0]}"<<<"${v[0]}"`&&C1 1 $1;};for i in 1 2;do for j in 2 3;do eval D$i$j'(){ A'$i' $1 $2 $3; C'$j' $4;};';done;done;A0;{ A2 0 $((N1+1)) 2;C0;A1 0 $N1 1;C0;B0;C2 27;B0&&! B1&&C2 28;D12 15 37 25 8;D13 0 $((N1+2)) 3 2;D13 0 $((N1+3)) 4 3;D22 0 $((N1+4)) 5 4;for i in 0 1 2;do D13 0 $((N1+5+i)) 6 $((N3+i));done;D13 1 10 7 9;D13 1 11 8 10;D22 2 12 9 11;D12 3 13 10 12;A1 4 19 11;B4 0 0 44;C3 13;D23 5 14 12 14;D22 6 36 13 15;D22 7 37 14 16;D23 8 15 38 17;D22 9 16 16 18;B1&&D22 11 17 17 20;D22 12 39 15 21;A1 13 40 18;B2 4;B3 4 0 19;A3 14 6 52 0;B4 0 5 54;A1 17 41 20;B7 5;C3 22;B4 4 6 21;A3 14 7 52 6;B4 0 7 54;B3 4 0 22;A3 14 6 52 0;B4 0 8 54;B5 7 8;B1&&{ A2 19 26 23;B7 7;C3 23;};A2 18 26 23;B7 7;C3 24;A2 4 20 21;B7 6;B2 9;A4 14 7 53 9;B2 10;B6 9 10 4;C3 25;D13 4 21 24 26;B4 4 12 26;B3 4 13 27;A1 4 22 29;B7 12;B2 14;A4 14 6 53 14;B2 15;B6 14 15 4;B3 0 0 30;C3 29;A1 4 23 27;B7 13;C3 30;D13 24 24 32 31;A1 23 18 28;B2 16;A2 16 25 33;B7 16;B3 0 0 34;B2 21;A6 47 21&&C0;B1&&D13 21 0 32 19;D23 14 1 48 43;D23 14 2 48 44;D13 14 3 49 5;D22 4 4 50 0;D13 4 5 32 1;D22 0 $((N1+8)) 51 32;D13 4 8 41 6;D23 22 9 37 7;B1&&D13 10 42 32 41;D23 20 42 32 42;D13 25 37 32 33;D12 26 28 35 34;D13 27 29 36 35;A2 27 32 39&&{ B2 19;A2 33 33 40;B2 20;B6 19 20 3;};C2 36;D23 33 34 42 37;D22 32 31 43 38;B1&&for i in 0 1;do D22 28 $((N2+i)) 45 $((N4+i));done;B1&&D22 29 35 46 39;A7;C2 40;} 2>/dev/null|pbcopy;exit 2>&-  
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    7. Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Click anywhere in the Terminal window and paste by pressing command-V. The text you pasted should vanish immediately. If it doesn't, press the return key.
    8. If you see an error message in the Terminal window such as "syntax error," enter
    exec bash
    and press return. Then paste the script again.
    9. If you're logged in as an administrator, you'll be prompted for your login password. Nothing will be displayed when you type it. You will not see the usual dots in place of typed characters. Make sure caps lock is off. Type carefully and then press return. You may get a one-time warning to be careful. If you make three failed attempts to enter the password, the test will run anyway, but it will produce less information. In most cases, the difference is not important. If you don't know the password, or if you prefer not to enter it, press the key combination control-C or just press return three times at the password prompt. Again, the script will still run.
    If you're not logged in as an administrator, you won't be prompted for a password. The test will still run. It just won't do anything that requires administrator privileges.
    10. The test may take a few minutes to run, depending on how many files you have and the speed of the computer. A computer that's abnormally slow may take longer to run the test. While it's running, there will be nothing in the Terminal window and no indication of progress. Wait for the line
    [Process completed]
    to appear. If you don't see it within half an hour or so, the test probably won't complete in a reasonable time. In that case, close the Terminal window and report the results. No harm will be done.
    11. When the test is complete, quit Terminal. The results will have been copied to the Clipboard automatically. They are not shown in the Terminal window. Please don't copy anything from there. All you have to do is start a reply to this comment and then paste by pressing command-V again.
    At or near the top of the results, there will be a line that begins with "System Version." If you don't see that, but instead see a mass of gibberish, you didn't wait for the "Process completed" message to appear in the Terminal window. Please wait for it and try again.
    If any private information, such as your name or email address, appears in the results, anonymize it before posting. Usually that won't be necessary.
    12. When you post the results, you might see the message, "You have included content in your post that is not permitted." It means that the forum software has misidentified something in the post as a violation of the rules. If that happens, please post the test results on Pastebin, then post a link here to the page you created.
    Note: This is a public forum, and others may give you advice based on the results of the test. They speak only for themselves, and I don't necessarily agree with them.
    Copyright © 2014 by Linc Davis. As the sole author of this work, I reserve all rights to it except as provided in the Use Agreement for the Apple Support Communities website ("ASC"). Readers of ASC may copy it for their own personal use. Neither the whole nor any part may be redistributed.

  • What is correct query ?

    I have two tables: tmp and tmp1. the output should be, for each cno in tmp, its pno should be ALL in the tmp1. The correct output should be '1111'.
    I have written a query based on 1111, it works. But how could I extend to 2222, 3333 .... ? what is correct query ?
    Thanks.
    select * from tmp;
    CNO                    PNO                   
    1111                   10506                 
    1111                   10507                 
    1111                   10508                 
    1111                   10509                 
    2222                   10601                 
    2222                   10701                 
    3333                   10800                 
    3333                   10900                 
    8 rows selected
    select * from tmp1;
    PNO                   
    10506                 
    10507                 
    10508                 
    10509                 
    10701                 
    10800                 
    6 rows selected
    select * from tmp where
    cno = 1111
    and
    not EXISTS(select pno from tmp  where cno = 1111 minus select pno from tmp1)
    CNO                    PNO                   
    1111                   10506                 
    1111                   10507                 
    1111                   10508                 
    1111                   10509                 
    4 rows selectedEdited by: user533361 on Sep 27, 2009 1:47 PM

    with tmp as (
                 select 1111 cno,10506 pno from dual union all
                 select 1111,10507 from dual union all
                 select 1111,10508 from dual union all
                 select 1111,10509 from dual union all
                 select 2222,10601 from dual union all
                 select 2222,10701 from dual union all
                 select 3333,10800 from dual union all
                 select 3333,10900 from dual
        tmp1 as (
                 select 10506 pno from dual union all
                 select 10507 from dual union all
                 select 10508 from dual union all
                 select 10509 from dual union all
                 select 10701 from dual union all
                 select 10800 from dual
    select  cno
      from  tmp t1,
            tmp1 t2
      where t1.pno = t2.pno(+)
      group by cno
      having count(t1.pno) = count(t2.pno)
           CNO
          1111
    SQL> SY.

  • What should be take action against following sql tuning report.

    Hi
    what should be take action against following sql tuning report.
    SQL ID : fn3mt5dvm7fba
    SQL Text : SELECT * FROM (select
         to_number(ow.waybl_no) waybl_no,ow.id wb_id,
         To_Number(ogp.gp_no) gp_no,
         To_Number(ots.trip_sht_no) trip_sht_no,
         otr.nm,
         ots.gty_br_mast_id,
         DECODE(otr.sign_recd,'1','YES','NO') Sign_Recd,
         DECODE(otr.stamped,'1','YES','NO') Stamped,
         otr.dlvry_dt dlvry_dt,
         otr.tel_no,
         --otr.remarks,                                                   
         Decode(otr.comments, NULL,'','Yes') remarks,
         otr.id ID,ops_safex_utl.get_br_nm(to_number(ow.bkg_br_mast_id))
    book_br,
         ow.pick_dt book_date
    from
         ops_ts_reconsile otr,
         ops_pultd_wb_dtls opuwd,
         ops_trip_sht ots,
         ops_waybl ow,
         ops_ultd_wb_dtls ouwd,
         ops_gate_pass ogp
    where
         otr.trip_sht_id=ots.id and
         otr.pultd_wb_dtls_id=opuwd.id and
         opuwd.ultd_wb_dtls_id=ouwd.id and
         ouwd.gate_pass_id=ogp.id and
         opuwd.waybl_id=ow.id and
         otr.status_lid=157 and
         ots.gty_br_mast_id = (:br_Id) and
         (otr.dlvry_dt = :searchDate OR :searchDate IS NULL) and
         otr.note_prpd = 'N' and otr.pod_recd = '1' and
         not exists (select TS_RECONSILE_ID from OPS_POD_FRWD_NOTE_DTLS
    where TS_RECONSILE_ID = otr.id)
    union
    select
         to_number(ow.waybl_no) waybl_no, ow.id wb_id,
         To_Number(ogp.gp_no) gp_no,
         null trip_sht_no,
         ogr.nm,
         ogp.dlvry_br_mast_id,
         DECODE(ogr.sign_recd,'Y','YES','NO') Sign_Recd,
         DECODE(ogr.stamped,'Y','YES','NO') Stamped,
         ogr.dlvry_dt dlvry_dt,
         ogr.tel_no,
         --ogr.remarks,                                                   
         Decode(ogr.comments, NULL,'', 'Yes') remarks,
         ogr.id ID,ops_safex_utl.get_br_nm(to_number(ow.bkg_br_mast_id))
    book_br,
         ow.pick_dt book_date
    from
         ops_gp_reconcile ogr,
         ops_gate_pass ogp,
         ops_waybl ow
    where
         ogr.gp_id=ogp.id and
         ogp.waybl_id=ow.id and
         ogp.dlvry_br_mast_id = (:br_Id) and
         (ogr.dlvry_dt = :searchDate) and
         ogr.note_prpd = 'N' and ogr.pod_recd = 'Y' and
         not exists (select GP_RECONSILE_ID from OPS_POD_FRWD_NOTE_DTLS
    where GP_RECONSILE_ID = ogr.id)) QRSLT ORDER BY trip_sht_no desc
    Bind Variables :
    1 - (VARCHAR2(32)):37069
    2 - (DATE):07/11/2011 00:00:00
    3 - (DATE):07/11/2011 00:00:00
    4 - (VARCHAR2(32)):37069
    5 - (DATE):07/11/2011 00:00:00
    FINDINGS SECTION (3 findings)
    1- SQL Profile Finding (see explain plans section below)
    2 potentially better execution plans were found for this statement. Choose
    one of the following SQL profiles to implement.
    Recommendation (estimated benefit<=10%)
    - Consider accepting the recommended SQL profile.
    execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_58643',
    task_owner => 'SYS', replace => TRUE);
    Recommendation (estimated benefit: 99.15%)
    - Consider accepting the recommended SQL profile to use parallel execution
    for this statement.
    execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_58643',
    task_owner => 'SYS', replace => TRUE, profile_type =>DBMS_SQLTUNE.PX_PROFILE);
    Executing this query parallel with DOP 128 will improve its response time
    99.11% over the SQL profile plan. However, there is some cost in enabling
    parallel execution. It will increase the statement's resource consumption by
    an estimated 14.56% which may result in a reduction of system throughput.
    Also, because these resources are consumed over a much smaller duration, the
    response time of concurrent statements might be negatively impacted if
    sufficient hardware capacity is not available.
    The following data shows some sampled statistics for this SQL from the past
    week and projected weekly values when parallel execution is enabled.
    Past week sampled statistics for this SQL
    Number of executions 17494
    Percent of total activity 7.2
    Percent of samples with #Active Sessions > 2*CPU .63
    Weekly DB time (in sec) 614696.04
    Projected statistics with Parallel Execution
    Weekly DB time (in sec) 704166.9
    2- Restructure SQL finding (see plan 1 in explain plans section)
    An expensive "UNION" operation was found at line ID 4 of the execution plan.
    Recommendation
    - Consider using "UNION ALL" instead of "UNION", if duplicates are allowed
    or uniqueness is guaranteed.
    3- Alternative Plan Finding
    Some alternative execution plans for this statement were found by searching
    the system's real-time and historical performance data.
    The following table lists these plans ranked by their average elapsed time.
    See section "ALTERNATIVE PLANS SECTION" for detailed information on each
    plan.
    id plan hash last seen elapsed (s) origin note
    1 209247904 2011-07-12/10:09:08 7.564 Cursor Cache
    2 4029269565 2011-07-12/10:20:21 15.374 Cursor Cache original plan
    3 4128886984 2011-07-08/11:30:25 42.426 AWR
    4 3695555639 2011-07-12/08:30:30 101.459 AWR
    Recommendation
    - Consider creating a SQL plan baseline for the plan with the best average
    elapsed time.
    execute dbms_sqltune.create_sql_plan_baseline(task_name => 'TASK_58643',
    owner_name => 'SYS', plan_hash_value => 209247904);
    ADDITIONAL INFORMATION SECTION
    - The optimizer could not merge the view at line ID 3 of the execution plan.
    The optimizer cannot merge a view that contains a set operator.
    - SQL Profile "SYS_SQLPROF_01306b26f6aa0000" exists for this statement and
    was ignored during the tuning process.

    afzal wrote:
    Hi
    what should be take action against following sql tuning report.
    <snip>Perhaps no action at all.
    You can ALWAYS produce a report that will show "top 5" issues. The question is NOT "do I have an issue reported by a tuning report". Yes you do. Everyone does. Always. Even if you slowest batch job runs in 1.3 seconds and your slowest OLTP transaction completes in 0.0001 second.
    The question is "do I have a problem that is serious enough to spend time solving?"
    If your average OLTP transaction completes in 3 seconds, how much effort is justified to get a 50% improvement?
    How much effort is justified to get that same 50% improvement on transactions that complete in 1.5 seconds? 0.2 seconds?
    Beware of Compulsive Tuning Disorder.

  • Question about WebLogic query syntax

    Hello,
    I am using WebLogic Server 6.0, which came as part of the WebGain
    Studio SE 4.5 development kit. My question regards the Web Logic query
    syntax, which I have not yet mastered.
    I am trying to create a finder method that takes a single argument
    of type "char" and finds all matching fields of the column "keyword" in
    which the argument is the first letter of keyword. That is, if I were
    only looking for fields beginning with the letter "M", I'd use:
    (like keyword 'M%')
    However, I'm looking for all fields beginning with the first letter
    defined by the first argument. Sadly, this syntax:
    (like keyword '$0%')
    doesn't seem to be working. Any suggestions on the correct syntax?
    If this is not the right forum for this question, could someone
    suggest an appropriate newsgroup?
    Thanks, Dave

    962466 wrote:
    Hi all,
    I have an issue I need help with. I have created a script for an automated partition create on a monthly basis. It creates a monthly partition containing all dates within the respective month. The script is essentially this:
    ALTER TABLE SCHEMA.TABLE
    ADD PARTITION &&1
    VALUES LESS THAN (to_number(to_char(to_date('&&2', 'DD-MON-YY'), 'YYYYMMDD')))
    TABLESPACE LARGE_DATA94 COMPRESS;
    I continually get this error message "ORA-14019: partition bound element must be one of: string, datetime or interval literal, number, or MAXVALUE"
    The variable &&2 is passing in character data for the first of the month (E.G. '01-SEP-12'). &&1 passes character data for the month in MONYY (AUG12) I can run this query:
    select
    (to_number(to_char(to_date('&&2', 'DD-MON-YY'), 'YYYYMMDD')))
    from dual;
    With the output of 20120801. I cannot understand why I am able to run this partition create statement by hardcoding 20120901 but passing it in as a variable I receive the error. Note that I am not having problems with the &&1 variable. If anyone has any ideas please let me know. Thanks!I don't understand why you are taking a string, converting it to a date, then converting the date BACK TO a string ... then trying to convert that string to a number.
    What is the data type of the partitioning key? It appears that it is a NUMBER, but actually represents a DATE. If so, that is a fundamentally flawed design.

  • PHP/mySQL query syntax

    Can I just check I have some of this right? It's fairly
    basic, but just want to check I'm setting about it the right way,
    as I'm new to the coding. (have in the past used Access a lot).
    Basically I have tables for companies and contacts - in a one
    to many relationship, as any given company may have many contacts -
    which as far as I can tell is how you should do this rather than
    have a single contacts table? (normalisation?)
    So if the tables are :
    Companies :
    CompanyID (INT, auto increment)
    Company
    Address
    etc
    Contacts :
    ContactID (INT, auto increment)
    FirstName
    LastName
    etc
    CompanyContacts :
    CompanyID (INT)
    ContactID (INT)
    what should the SQL be for the page to display a company's
    details along with each contact ?
    I thought it might be something fairly simple like :
    SELECT *
    FROM Companies, CompanyContacts, Contacts
    WHERE Company.CompanyID=CompanyContacts.CompanyID
    But the Access flavour query comes out as :
    SELECT *
    FROM ([Companies] INNER JOIN [CompanyContacts] ON
    [Companies].CompanyID = [CompanyContacts].CompanyID) INNER JOIN
    [Contacts] ON [CompanyContacts].ContactID = [Contacts].ContactID;
    If someone could translate the Access flavour query into
    PHP/mySQL flavour that I could use as a reference that would be a
    great help.
    Cheers,
    Iain

    Thanks David.
    Thinking about it, do I even need the interlinking table -
    can I get away with :
    Companies
    CompanyID (primary key)
    Company
    etc
    Contacts
    ContactID (primary key)
    CompanyID (foreign key)
    FirstName
    LastName
    etc
    And have
    SELECT *
    FROM Companies, Contacts
    WHERE Companies.CompanyID = Contacts.CompanyID
    Which would keep it relatively straightforward adding in new
    companies and new contacts using DWs insert record behaviour, ie
    wouldn't have the complication of populating the CompanyContacts
    table?
    Also - I've ordered your book from Amazon this week - so once
    I get this project completed the plan is to work through it and
    firm up some of the stuff I've been doing.
    Iain

Maybe you are looking for

  • Internal order-budgeting & settelemnt

    Hi friends, What is the internal order-budgeting & settlement?How to the settled and budgeted?Please explain with example in simple way? Regards, Chandra.

  • HT5642 I don't have the software update tab under general in my settings how can I update to iOS 5

    I need help updating my iPad 2 version 4.3.3 bc under my setting and general there is no software update tab which is what all the websites say I need to click on next

  • Slice lines showing in ie browser

    Hello, This site renders fine in firefox, safari on mac -  http://www.co2tropicaltrees.com/ - but in internet explorer on pc, there has been issues. I had it rendering okay in ie, then yesterday I added 'link machine' (an outside program) . I don't k

  • Zen Micro..Repair or buy Vision

    I have received the oh so common headphone jack problem and sent in an email for the repair cost and was wondering if it was really worth it to repair or if I should just go ahead and get a new Vision:M. Any thoughts would be nice.

  • Need clarity on ARP operation

    Hi, I just wanna know whether i'm properly understandin ARP or not. As per the OSI model if we take the communication between any two devices, the sender host will go through the Application,Presentation,Session,Transport,Network,Datalink,Physical an