Need help on performing database queries with a general query

Dear experts,
I have two issues
1)
I have developed a software which connects to Oracle database
performing and executing DDL/DML statements.
I am using a Jdbc thin oracle driver.
When i perform a wrong syntax query or say a query using invalid column.I get exception accordingly.However,I want to know if there is any way by which i can know the exact position where i am making error
just as an asterik(*) comes in sql plus in case of invalid column or so.
2)
Whenever i minimize software window (made of swing components)
and again maximize it.It takes almost 12 secs to be visible otherwise it remains white.Is swing that much slow ???

(1) No.
(2) It's possible to make Swing programs that slow. (I know, I have done it.) But usually the slowness is in application code (your code) and not in Swing itself.

Similar Messages

  • Need help in Creating DB manually with OFA

    Hi,
    I want to create database in 10g manually and for this purpose
    I need help.
    since we can use OFA for storing Control files, and redolog file
    and datafile by describing them in Create database command but
    how to store any instance related file like spfile, pfile or network
    related file.
    once the oracle 10g database software is installed then if we want
    to create database then how can we separate the database file and
    all other instance files from software binaries because I've noted
    that creating database with DBCA create all instance files along with
    binary files of the software although DBCA give you option of creating
    database related file in some other location/directory.
    kindly help me in this I want to achieve above task in compliance with
    OFA
    Thanks and Regards,
    D.Abbasi

    Abbasi wrote:
    Hi,
    I want to create database in 10g manually and for this purpose
    I need help.
    since we can use OFA for storing Control files, and redolog file
    and datafile by describing them in Create database command but
    how to store any instance related file like spfile, pfile or network
    related file.
    once the oracle 10g database software is installed then if we want
    to create database then how can we separate the database file and
    all other instance files from software binaries because I've noted
    that creating database with DBCA create all instance files along with
    binary files of the software although DBCA give you option of creating
    database related file in some other location/directory.
    kindly help me in this I want to achieve above task in compliance with
    OFA
    Thanks and Regards,
    D.AbbasiTHe OFA spec (as best I recall) states that one of the levels of directory for all of your data files will be the db name. So if you name your database 'orcl', every file system in which you keep any files related to 'orcl' will be in a directory name 'orcl'.
    As for what happend when you created your db. Oracle will default to putting things in the Oracle home structure because that's the only thing he can guarantee will be there. But you had the option (indeed, the obligation) to override these defaults.
    BTW, when using dbca, if you chose any of the pre-canned database types, the database will be created by doing a restore from a pre-canned backup. If you chose 'custom' database, the database will be created by way of a CREATE DATABASE script. It would be instructive time well spent for you to go through dbca and select 'custom database', pay attention to all of the options as you work through, then at then end, deselect "create database" and select "generate scripts". Do the same for one of the pre-defined database types. Then study the scripts generated by each method.
    Edited by: EdStevens on Aug 16, 2009 8:46 PM

  • Need help in creating Database connection to Apache 4

    I desperately need help for my project. I'm doing a shopping cart project. Created a java bean to establish connection to my sql 7 server database. But the following always appear. I'm using dreamweaver mx to create my webpage and so I use its binding and components feature.
    Here's the error message I always get..
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    An error occurred at line: 36 in the jsp file: /TMP8ouafocg7v.jsp
    Generated servlet error:
    C:\tomcat4\work\Standalone\localhost\ArtGallery\TMP8ouafocg7v$jsp.java:163: Class org.apache.jsp.DBConn not found.
    DBConn connect = null;
    ^
    An error occurred at line: 36 in the jsp file: /TMP8ouafocg7v.jsp
    Generated servlet error:
    C:\tomcat4\work\Standalone\localhost\ArtGallery\TMP8ouafocg7v$jsp.java:166: Class org.apache.jsp.DBConn not found.
    connect= (DBConn)
    ^
    An error occurred at line: 36 in the jsp file: /TMP8ouafocg7v.jsp
    Generated servlet error:
    C:\tomcat4\work\Standalone\localhost\ArtGallery\TMP8ouafocg7v$jsp.java:171: Class org.apache.jsp.DBConn not found.
    connect = (DBConn) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "DBConn");
    ^
    3 errors, 1 warning
    Anyone out there, pls let me know the solution soon. Thanks!

    I was glad I came across this note. I recently started a tutorial on J2EE , and have run into exactly the same error. Have you found a solution? Can you share it with me?
    Thanks.....

  • Need help in Performance tuning for function...

    Hi all,
    I am using the below algorithm for calculating the Luhn Alogorithm to calculate the 15th luhn digit for an IMEI (Phone Sim Card).
    But the below function is taking about 6 min for 5 million records. I had 170 million records in a table want to calculate the luhn digit for all of them which might take up to 4-5 hours.Please help me performance tuning (better way or better logic for luhn calculation) to the below function.
    A wikipedia link is provided for the luhn algorithm below
    Create or Replace FUNCTION AddLuhnToIMEI (LuhnPrimitive VARCHAR2)
          RETURN VARCHAR2
       AS
          Index_no     NUMBER (2) := LENGTH (LuhnPrimitive);
          Multiplier   NUMBER (1) := 2;
          Total_Sum    NUMBER (4) := 0;
          Plus         NUMBER (2);
          ReturnLuhn   VARCHAR2 (25);
       BEGIN
          WHILE Index_no >= 1
          LOOP
             Plus       := Multiplier * (TO_NUMBER (SUBSTR (LuhnPrimitive, Index_no, 1)));
             Multiplier := (3 - Multiplier);
             Total_Sum  := Total_Sum + TO_NUMBER (TRUNC ( (Plus / 10))) + MOD (Plus, 10);
             Index_no   := Index_no - 1;
          END LOOP;
          ReturnLuhn := LuhnPrimitive || CASE
                                             WHEN MOD (Total_Sum, 10) = 0 THEN '0'
                                             ELSE TO_CHAR (10 - MOD (Total_Sum, 10))
                                         END;
          RETURN ReturnLuhn;
       EXCEPTION
          WHEN OTHERS
          THEN
             RETURN (LuhnPrimitive);
       END AddLuhnToIMEI;
    http://en.wikipedia.org/wiki/Luhn_algorithmAny sort of help is much appreciated....
    Thanks
    Rede

    There is a not needed to_number function in it. TRUNC will already return a number.
    Also the MOD function can be avoided at some steps. Since multiplying by 2 will never be higher then 18 you can speed up the calculation with this.
    create or replace
    FUNCTION AddLuhnToIMEI_fast (LuhnPrimitive VARCHAR2)
          RETURN VARCHAR2
       AS
          Index_no     pls_Integer;
          Multiplier   pls_Integer := 2;
          Total_Sum    pls_Integer := 0;
          Plus         pls_Integer;
          rest         pls_integer;
          ReturnLuhn   VARCHAR2 (25);
       BEGIN
          for Index_no in reverse 1..LENGTH (LuhnPrimitive) LOOP
             Plus       := Multiplier * TO_NUMBER (SUBSTR (LuhnPrimitive, Index_no, 1));
             Multiplier := 3 - Multiplier;
             if Plus < 10 then
                Total_Sum  := Total_Sum + Plus ;
             else
                Total_Sum  := Total_Sum + Plus - 9;
             end if;  
          END LOOP;
          rest := MOD (Total_Sum, 10);
          ReturnLuhn := LuhnPrimitive || CASE WHEN rest = 0 THEN '0' ELSE TO_CHAR (10 - rest) END;
          RETURN ReturnLuhn;
       END AddLuhnToIMEI_fast;
    /My tests gave an improvement for about 40%.
    The next step to try could be to use native complilation on this function. This can give an additional big boost.
    Edited by: Sven W. on Mar 9, 2011 8:11 PM

  • Need help in installing JBOSS along with Jdk version

    Hi,
    I am using Linux 64 bit Machine.
    I have Jdk1.5.0_18 and jboss-4.2.3.GA installed in my machine.
    But the JBOSS Server is failed in booting.
    What version of JBOSS Server needed for the 64 bit along with Jdk1.5.0_18
    Any help will be needful for me
    Thanks and Regards

    The name of this forum is "Database - General" not JBOSS, JDK, or "anything goes."
    Please delete this post and post your question in the appropriate forum.
    Thank you.

  • Need help. importing pictures to timeline with various length.

    Need help cant find old toturial
    I am trying to make a template for a picture movie where i have everything ready so i just need to add 250 pictures and then it will automaticly shift the pictures to the beat of the music. I once saw a toturial how to do this but cant find it. it was something with manually setting markers at the music beat and then just add all the pictures. but i must have missed something pls help..
    Bo

    Its called automate to sequence with unnumbered markers.
    http://tv.adobe.com/watch/learn-premiere-pro-cs5/gs04-making-a-rough-cut-in-adobe-premiere -pro/
    http://help.adobe.com/en_US/premierepro/cs/using/WS1c9bc5c2e465a58a91cf0b1038518aef7-7d1ba .html

  • Need help in updating database table from screen fields

    Hi,
    Can anyone tell me how to update the database table with the entries given in the fields of a screen ?...a procedure-wise explanation would be very helpful.
    Thank you.
    Moderator message: sorry, no beginner forums here, please search for available information or attend training.
    locked by: Thomas Zloch on Aug 12, 2010 3:16 PM

    Hi,
    Can anyone tell me how to update the database table with the entries given in the fields of a screen ?...a procedure-wise explanation would be very helpful.
    Thank you.
    Moderator message: sorry, no beginner forums here, please search for available information or attend training.
    locked by: Thomas Zloch on Aug 12, 2010 3:16 PM

  • Need Help Please: Audigy2 Value conflict with onboard sound

    <SPAN class=postbody>System info: Windows XP Home Edition, 2.4 GHz IntelPent4, 52MB of RAM; DDR 200(33MHz), MSI MS-6547 (645 Ultra) motherboard. I need help! Sigh...well I am trying to put in a Soundblaster Audigy2 into my computer. I am under the impression that I have to disable and remove all onboard sound b/c it conflicts with the new sound card, ?. I currently have onboard sound ( AC97 Audio Controller ). I went to add/remove programs and removed the AC97 from there. I also went to MyComputer/Properties/Hardware/DeviceManager/Sound,Video,andGameControllers/AC97AudioContoller and deleted it. st Question: Under DeviceManager/Sound,Video,GameControllers...Do I need to remove the Legacy Audio Drivers? I know that I have to delete the rest of the drivers for AC97 and out of chance would Legacy be those drivers? I am guessing no...Also, is there anything else that I have to delete for the on board sound program to be gone? 2nd Question: I went to BIOS, and since I have windows XP home edition I think that configuration is a little different from what I read(I wont bore you with that). So, where do I go to "disable" the onboard sound in BIOS for Windows XP HomeEdition? Also, I read something about making sure the "Chip" was disabled but I could be paranoid. Do I need to worry about that? If you made it through all that text I thank you dearly. I hope that I can get some help from someone b/c I know nothing. I am afraid of making the wrong choice on BIOS and messing everything up. Thank You so Much! Ross Message Edited by RossRude3 on 04-06-2005 0:48 AM

    Ross,
    To fully disable teh onboard audio you would need to go into the BIOS to disable the Onboard Audio chip there. The manual with your motherboard or PC should have more detail on where exactly to find this setting, as it will differ per BIOS type. Generally it should be under a heading like Integrated Peripherals, and should be marked as the Onboard Audio chip, or AC97 Audio.
    Cat

  • Need help in Custom component creation with cq

    Hi,
    I have created my own component in adobe cQ and able to drag an drop in any page. for each instance I am seeing the copy of
    component under node /content/mypage/commoncomp. If I edit the properties using design dialog  I can able to store values as
    expected.
    Need help in
    1) When I drag and drop the component it shows null for the property by deafult if I click save on edit dialog then the
    value is showing. The default value is not shown by default while drag and drop my component it requires atleast one time to
    click save from dialog using design mode
    2) I need to use the default properties of the orginal components which is root and use the duplicated properties if incase user edit the properties of duplicated component. This may be too messy.... to be more clear
    I want to use a common component in many pages but the properties of the components should be updated only when user edit it in design dialog utill then I need the page to use properties of root component.
    Thanks

    You just need to create your own version of PlumtreeTopBarView (original in com.plumtree.common.uiparts), and use CustomActivitySpace.xml to override that view with your own view. Your version would use some kidn fo logic to determine whether or not to display certain elements. TheUI Customization Guide should help quite a bit, and we have several quickstarts for overriding views you can start from.
    Is there some Help file in PT that I can reference that will enable me to find what namespace does GetRequestURL() belongs to?I would simply do a string compare. Tokenize the URL into the base address / control arguments, perhaps splitting on the "?" symbol; then tokenize the base address on the ".". You'll end up with three strings. For portal.plumtree.com, the three strings would portal, plumtree, and com. You can then use those string in the logig you add to PlumtreeTopBarView.
    David Phipps
    Plumtree Software

  • BI Statistics -- Need to display list of Queries with query counter

    Hi All,
    I am using the the infoobject
    0TCTBISBOBJ (BI Application Object)  - for to get the list of queries inthe system.
    I am also restricting the infoobject 0TCTBISOTYP(BI Application Object Type)-  to ELEM (Query) inthe filter area.
    I loaded load master data for 0TCTBWOBJCT_ATTR and 0TCTBWOBJCT_TEXT.
    The PROBLEM is  0TCTBISBOBJ (BI Application Object) is not only displaying queries but all the other elements like navigational attributes and some junk values like
    '$ABSEMA0
    '$VIRTUAL-000001
    Please help me isolate just queries for my display.
    Thanks,
    HM

    HI,
    Your query setup is correct, please check Note 936519 - Duplicate Records while loading 0TCTBWOBJCT master data, and many others.
    I have customers running stack 11 & 12 and had to apply dozens of notes to get TCT 7.0 to work properly. And even now about 3 notes per week are being released.
    Regards Patrick Rieken.

  • Need help/info on "database link of same name has an open connection"

    Hello,
    I am trying to create an application on html db (new in html db) to see if I can move data from one database (oracle 9i) say dbdev to another one called dbtest. I want to be able to select the data from html db app and by clicking on a button move them to dbtest ( right now only looking at data from one table ). This is what I have done so far:
    1. created a duplicated table of dbdev into html db with no data.
    2. created package with procedures to
    A. create a database link
    B. delete if there is a record on html db table
    C. go trough a loop (cursor) and get the data from dbdev
    D. drop the database link
    Now, when I do all of the above steps I get an error “database link of same name has an open connection" but when I don’t do the step C. I don’t get this error. So something is wrong in my step C. On my step C, I just open the cursor, do a for loop and insert the records into my html db table.
    Any idea!!!
    Thanks
    More questions to come…..

    never mind, I should not drop the database link with in the procedure.
    thx

  • Need help in performance

    hallow
    i doing this select and it take more then 10 minutes and i don't now way because
    object_key have just 60 entries ?
    how i can slve this problem?
    Regards
      SELECT * FROM covp APPENDING TABLE *covp
              FOR ALL ENTRIES IN object_key
               WHERE kokrs EQ '1000'
               AND   objnr EQ object_key-objnr
               AND   budat IN so_budat
               AND   stflg EQ space .

    Ways of Performance Tuning
    1.     Selection Criteria
    2.     Select Statements
    •     Select Queries
    •     SQL Interface
    •     Aggregate Functions
    •     For all Entries
    Select Over more than one internal table
    Selection Criteria
    1.     Restrict the data to the selection criteria itself, rather than filtering it out using the ABAP code using CHECK statement. 
    2.     Select with selection list.
    SELECT * FROM SBOOK INTO SBOOK_WA.
      CHECK: SBOOK_WA-CARRID = 'LH' AND
             SBOOK_WA-CONNID = '0400'.
    ENDSELECT.
    The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list
    SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
      WHERE SBOOK_WA-CARRID = 'LH' AND
                  SBOOK_WA-CONNID = '0400'.
    Select Statements   Select Queries
    1.     Avoid nested selects
    SELECT * FROM EKKO INTO EKKO_WA.
      SELECT * FROM EKAN INTO EKAN_WA
          WHERE EBELN = EKKO_WA-EBELN.
      ENDSELECT.
    ENDSELECT.
    The above code can be much more optimized by the code written below.
    SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
        FROM EKKO AS P INNER JOIN EKAN AS F
          ON PEBELN = FEBELN.
    Note: A simple SELECT loop is a single database access whose result is passed to the ABAP program line by line. Nested SELECT loops mean that the number of accesses in the inner loop is multiplied by the number of accesses in the outer loop. One should therefore use nested SELECT loops only if the selection in the outer loop contains very few lines or the outer loop is a SELECT SINGLE statement.
    2.     Select all the records in a single shot using into table clause of select statement rather than to use Append statements.
    SELECT * FROM SBOOK INTO SBOOK_WA.
      CHECK: SBOOK_WA-CARRID = 'LH' AND
             SBOOK_WA-CONNID = '0400'.
    ENDSELECT.
    The above code can be much more optimized by the code written below which avoids CHECK, selects with selection list and puts the data in one shot using into table
    SELECT  CARRID CONNID FLDATE BOOKID FROM SBOOK INTO TABLE T_SBOOK
      WHERE SBOOK_WA-CARRID = 'LH' AND
                  SBOOK_WA-CONNID = '0400'.
    3.     When a base table has multiple indices, the where clause should be in the order of the index, either a primary or a secondary index.
    To choose an index, the optimizer checks the field names specified in the where clause and then uses an index that has the same order of the fields. In certain scenarios, it is advisable to check whether a new index can speed up the performance of a program. This will come handy in programs that access data from the finance tables.
    4.     For testing existence, use Select.. Up to 1 rows statement instead of a Select-Endselect-loop with an Exit. 
    SELECT * FROM SBOOK INTO SBOOK_WA
      UP TO 1 ROWS
      WHERE CARRID = 'LH'.
    ENDSELECT.
    The above code is more optimized as compared to the code mentioned below for testing existence of a record.
    SELECT * FROM SBOOK INTO SBOOK_WA
        WHERE CARRID = 'LH'.
      EXIT.
    ENDSELECT.
    5.     Use Select Single if all primary key fields are supplied in the Where condition .
    If all primary key fields are supplied in the Where conditions you can even use Select Single.
    Select Single requires one communication with the database system, whereas Select-Endselect needs two.
    Select Statements SQL Interface
    1.     Use column updates instead of single-row updates
    to update your database tables.
    SELECT * FROM SFLIGHT INTO SFLIGHT_WA.
      SFLIGHT_WA-SEATSOCC =
        SFLIGHT_WA-SEATSOCC - 1.
      UPDATE SFLIGHT FROM SFLIGHT_WA.
    ENDSELECT.
    The above mentioned code can be more optimized by using the following code
    UPDATE SFLIGHT
           SET SEATSOCC = SEATSOCC - 1.
    2.     For all frequently used Select statements, try to use an index.
    SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
      WHERE CARRID = 'LH'
        AND CONNID = '0400'.
    ENDSELECT.
    The above mentioned code can be more optimized by using the following code
    SELECT * FROM SBOOK CLIENT SPECIFIED INTO SBOOK_WA
      WHERE MANDT IN ( SELECT MANDT FROM T000 )
        AND CARRID = 'LH'
        AND CONNID = '0400'.
    ENDSELECT.
    3.     Using buffered tables improves the performance considerably.
    Bypassing the buffer increases the network considerably
    SELECT SINGLE * FROM T100 INTO T100_WA
      BYPASSING BUFFER
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    The above mentioned code can be more optimized by using the following code
    SELECT SINGLE * FROM T100  INTO T100_WA
      WHERE     SPRSL = 'D'
            AND ARBGB = '00'
            AND MSGNR = '999'.
    Select Statements  Aggregate Functions
    •     If you want to find the maximum, minimum, sum and average value or the count of a database column, use a select list with aggregate functions instead of computing the aggregates yourself.
    Some of the Aggregate functions allowed in SAP are  MAX, MIN, AVG, SUM, COUNT, COUNT( * )
    Consider the following extract.
                Maxno = 0.
                Select * from zflight where airln = ‘LF’ and cntry = ‘IN’.
                 Check zflight-fligh > maxno.
                 Maxno = zflight-fligh.
                Endselect.
    The  above mentioned code can be much more optimized by using the following code.
    Select max( fligh ) from zflight into maxno where airln = ‘LF’ and cntry = ‘IN’.
    Select Statements  For All Entries
    •     The for all entries creates a where clause, where all the entries in the driver table are combined with OR. If the number of entries in the driver table is larger than rsdb/max_blocking_factor, several similar SQL statements are executed to limit the length of the WHERE clause.
         The plus
    •     Large amount of data
    •     Mixing processing and reading of data
    •     Fast internal reprocessing of data
    •     Fast
         The Minus
    •     Difficult to program/understand
    •     Memory could be critical (use FREE or PACKAGE size)
    Points to be must considered FOR ALL ENTRIES
    •     Check that data is present in the driver table
    •     Sorting the driver table
    •     Removing duplicates from the driver table
    Consider the following piece of extract
              Loop at int_cntry.
      Select single * from zfligh into int_fligh
      where cntry = int_cntry-cntry.
      Append int_fligh.
                          Endloop.
    The above mentioned can be more optimized by using the following code.
    Sort int_cntry by cntry.
    Delete adjacent duplicates from int_cntry.
    If NOT int_cntry[] is INITIAL.
                Select * from zfligh appending table int_fligh
                For all entries in int_cntry
                Where cntry = int_cntry-cntry.
    Endif.
    Select Statements Select Over more than one Internal table
    1.     Its better to use a views instead of nested Select statements.
    SELECT * FROM DD01L INTO DD01L_WA
      WHERE DOMNAME LIKE 'CHAR%'
            AND AS4LOCAL = 'A'.
      SELECT SINGLE * FROM DD01T INTO DD01T_WA
        WHERE   DOMNAME    = DD01L_WA-DOMNAME
            AND AS4LOCAL   = 'A'
            AND AS4VERS    = DD01L_WA-AS4VERS
            AND DDLANGUAGE = SY-LANGU.
    ENDSELECT.
    The above code can be more optimized by extracting all the data from view DD01V_WA
    SELECT * FROM DD01V INTO  DD01V_WA
      WHERE DOMNAME LIKE 'CHAR%'
            AND DDLANGUAGE = SY-LANGU.
    ENDSELECT
    2.     To read data from several logically connected tables use a join instead of nested Select statements. Joins are preferred only if all the primary key are available in WHERE clause for the tables that are joined. If the primary keys are not provided in join the Joining of tables itself takes time.
    SELECT * FROM EKKO INTO EKKO_WA.
      SELECT * FROM EKAN INTO EKAN_WA
          WHERE EBELN = EKKO_WA-EBELN.
      ENDSELECT.
    ENDSELECT.
    The above code can be much more optimized by the code written below.
    SELECT PF1 PF2 FF3 FF4 INTO TABLE ITAB
        FROM EKKO AS P INNER JOIN EKAN AS F
          ON PEBELN = FEBELN.
    3.     Instead of using nested Select loops it is often better to use subqueries.
    SELECT * FROM SPFLI
      INTO TABLE T_SPFLI
      WHERE CITYFROM = 'FRANKFURT'
        AND CITYTO = 'NEW YORK'.
    SELECT * FROM SFLIGHT AS F
        INTO SFLIGHT_WA
        FOR ALL ENTRIES IN T_SPFLI
        WHERE SEATSOCC < F~SEATSMAX
          AND CARRID = T_SPFLI-CARRID
          AND CONNID = T_SPFLI-CONNID
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    The above mentioned code can be even more optimized by using subqueries instead of for all entries.
    SELECT * FROM SFLIGHT AS F INTO SFLIGHT_WA
        WHERE SEATSOCC < F~SEATSMAX
          AND EXISTS ( SELECT * FROM SPFLI
                         WHERE CARRID = F~CARRID
                           AND CONNID = F~CONNID
                           AND CITYFROM = 'FRANKFURT'
                           AND CITYTO = 'NEW YORK' )
          AND FLDATE BETWEEN '19990101' AND '19990331'.
    ENDSELECT.
    1.     Table operations should be done using explicit work areas rather than via header lines.
    READ TABLE ITAB INTO WA WITH KEY K = 'X‘ BINARY SEARCH.
    IS MUCH FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY K = 'X'.
    If TAB has n entries, linear search runs in O( n ) time, whereas binary search takes only O( log2( n ) ).
    2.     Always try to use binary search instead of linear search. But don’t forget to sort your internal table before that.
    READ TABLE ITAB INTO WA WITH KEY K = 'X'. IS FASTER THAN USING
    READ TABLE ITAB INTO WA WITH KEY (NAME) = 'X'.
    3.     A dynamic key access is slower than a static one, since the key specification must be evaluated at runtime.
    4.     A binary search using secondary index takes considerably less time.
    5.     LOOP ... WHERE is faster than LOOP/CHECK because LOOP ... WHERE evaluates the specified condition internally.
    LOOP AT ITAB INTO WA WHERE K = 'X'.
    ENDLOOP.
    The above code is much faster than using
    LOOP AT ITAB INTO WA.
      CHECK WA-K = 'X'.
    ENDLOOP.
    6.     Modifying selected components using “ MODIFY itab …TRANSPORTING f1 f2.. “ accelerates the task of updating  a line of an internal table.
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1 TRANSPORTING DATE.
    The above code is more optimized as compared to
    WA-DATE = SY-DATUM.
    MODIFY ITAB FROM WA INDEX 1.
    7.     Accessing the table entries directly in a "LOOP ... ASSIGNING ..." accelerates the task of updating a set of lines of an internal table considerably
    Modifying selected components only makes the program faster as compared to Modifying all lines completely.
    e.g,
    LOOP AT ITAB ASSIGNING <WA>.
      I = SY-TABIX MOD 2.
      IF I = 0.
        <WA>-FLAG = 'X'.
      ENDIF.
    ENDLOOP.
    The above code works faster as compared to
    LOOP AT ITAB INTO WA.
      I = SY-TABIX MOD 2.
      IF I = 0.
        WA-FLAG = 'X'.
        MODIFY ITAB FROM WA.
      ENDIF.
    ENDLOOP.
    8.    If collect semantics is required, it is always better to use to COLLECT rather than READ BINARY and then ADD.
    LOOP AT ITAB1 INTO WA1.
      READ TABLE ITAB2 INTO WA2 WITH KEY K = WA1-K BINARY SEARCH.
      IF SY-SUBRC = 0.
        ADD: WA1-VAL1 TO WA2-VAL1,
             WA1-VAL2 TO WA2-VAL2.
        MODIFY ITAB2 FROM WA2 INDEX SY-TABIX TRANSPORTING VAL1 VAL2.
      ELSE.
        INSERT WA1 INTO ITAB2 INDEX SY-TABIX.
      ENDIF.
    ENDLOOP.
    The above code uses BINARY SEARCH for collect semantics. READ BINARY runs in O( log2(n) ) time. The above piece of code can be more optimized by
    LOOP AT ITAB1 INTO WA.
      COLLECT WA INTO ITAB2.
    ENDLOOP.
    SORT ITAB2 BY K.
    COLLECT, however, uses a hash algorithm and is therefore independent
    of the number of entries (i.e. O(1)) .
    9.    "APPEND LINES OF itab1 TO itab2" accelerates the task of appending a table to another table considerably as compared to “ LOOP-APPEND-ENDLOOP.”
    APPEND LINES OF ITAB1 TO ITAB2.
    This is more optimized as compared to
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    10.   “DELETE ADJACENT DUPLICATES“ accelerates the task of deleting duplicate entries considerably as compared to “ READ-LOOP-DELETE-ENDLOOP”.
    DELETE ADJACENT DUPLICATES FROM ITAB COMPARING K.
    This is much more optimized as compared to
    READ TABLE ITAB INDEX 1 INTO PREV_LINE.
    LOOP AT ITAB FROM 2 INTO WA.
      IF WA = PREV_LINE.
        DELETE ITAB.
      ELSE.
        PREV_LINE = WA.
      ENDIF.
    ENDLOOP.
    11.   "DELETE itab FROM ... TO ..." accelerates the task of deleting a sequence of lines considerably as compared to “  DO -DELETE-ENDDO”.
    DELETE ITAB FROM 450 TO 550.
    This is much more optimized as compared to
    DO 101 TIMES.
      DELETE ITAB INDEX 450.
    ENDDO.
    12.   Copying internal tables by using “ITAB2[ ] = ITAB1[ ]” as compared to “LOOP-APPEND-ENDLOOP”.
    ITAB2[] = ITAB1[].
    This is much more optimized as compared to
    REFRESH ITAB2.
    LOOP AT ITAB1 INTO WA.
      APPEND WA TO ITAB2.
    ENDLOOP.
    13.   Specify the sort key as restrictively as possible to run the program faster.
    “SORT ITAB BY K.” makes the program runs faster as compared to “SORT ITAB.”
    Internal Tables         contd…
    Hashed and Sorted tables
    1.     For single read access hashed tables are more optimized as compared to sorted tables.
    2.      For partial sequential access sorted tables are more optimized as compared to hashed tables
    Hashed And Sorted Tables
    Point # 1
    Consider the following example where HTAB is a hashed table and STAB is a sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE HTAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    This runs faster for single read access as compared to the following same code for sorted table
    DO 250 TIMES.
      N = 4 * SY-INDEX.
      READ TABLE STAB INTO WA WITH TABLE KEY K = N.
      IF SY-SUBRC = 0.
      ENDIF.
    ENDDO.
    Point # 2
    Similarly for Partial Sequential access the STAB runs faster as compared to HTAB
    LOOP AT STAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.
    This runs faster as compared to
    LOOP AT HTAB INTO WA WHERE K = SUBKEY.
    ENDLOOP.

  • SLOW Query ... Need help improving performance

    Database: Oracle 8i
    Note: I don't have a whole lot of experience with writing queries, so please forgive me for any dumb mistakes I most likely made.
    I have a query in which I have a SUM in two levels. I think this is probably the root cause of the very slow performance of the query. However, I just don't see any way around it, and can't come up with any other ways to speed up the query. The query itself only returns one line, the summary line. And, by slow, I mean it can take up to an hour or two. This is a query I need to run multiple times, based on some parameters that I cannot query from a database.
    The query basically calculates the current unit cost of a part. It has to sum up the issue cost of the part (cost of material issued to the part's order), the actual dollars put into a part (labor, etc.), and the burden dollars associated with the part. This sum has to be divided by the total quantity of parts completed on the part's order to get the unit cost. I have to account for the possibility that the quantity complete is 0, so that I don't end up dividing by 0.
    Below is my query, and sample data for it:
    SELECT     a.part_nbr
    ,     a.mo_nbr
    ,     a.unit_iss_cost
    ,     CASE
              WHEN     a.qty_complete_ind     ='Nonzero'
              THEN     SUM(a.act_dlrs/a.qty_complete)
              ELSE     0
         END                                             AS unit_dlrs
    ,     CASE
              WHEN     a.qty_complete_ind     ='Zero'
              THEN     SUM(a.act_dlrs)
              ELSE     0
         END                                             AS qty_0_dlrs
    FROM     (     SELECT     act.part_nbr                              AS part_nbr
              ,     act.order_nbr || '-' || act.sub_order_nbr          AS mo_nbr
              ,     ic.unit_iss_cost                         AS unit_iss_cost
              ,     SUM     (
                             act.act_dlrs_earned          +
                             act.act_brdn_dls_earned          +
                             act.tool_dlrs_earned          +
                             act.act_fix_brdn_dls_ea     
                        )                              AS act_dlrs
              ,     ord.qty_complete                         AS qty_complete
              ,     CASE
                        WHEN     ord.qty_complete     <>0
                        THEN     'Nonzero'
                        ELSE     'Zero'
                   END                                   AS qty_complete_ind
              FROM     ACT          act
              ,     ISSUE_COST     ic
              ,     ORD          ord
              WHERE     ord.ord_nbr          =act.order_nbr          AND
                   ord.sub_ord_nbr          =act.sub_order_nbr     AND
                   ord.major_seq_nbr     =act.maj_seq_nbr     AND
                   ic.ord_nbr          =act.order_nbr          AND
                   ic.sub_ord_nbr          =act.sub_order_nbr     AND
                        (act.order_nbr          =LPAD(?,10,'0'))     AND
                        (act.sub_order_nbr     =LPAD(?,3,'0'))          AND
                        (act.activity_date     <=?)               
              GROUP BY     act.part_nbr
              ,          act.order_nbr || '-' || act.sub_order_nbr
              ,          act.maj_seq_nbr
              ,          ord.qty_complete
              ,          ic.unit_iss_cost
         ) a
    GROUP BY     a.part_nbr
    ,          a.mo_nbr
    ,          a.unit_iss_cost
    ,          a.qty_complete_ind
    CREATE TABLE ACT
              creation_date          date
         ,     c_id               number (5,0)
         ,     part_nbr          varchar(25)
         ,     order_nbr          varchar(10)
         ,     sub_order_nbr          varchar(3)
         ,     maj_seq_nbr          varchar(4)
         ,     act_dlrs_earned          number (15,2)
         ,     act_brdn_dls_earned     number (15,2)
         ,     tool_dlrs_earned     number (15,2)
         ,     act_fix_brdn_dls_ea     number (15,2)
         ,     activity_date          date
         CONSTRAINT     ACT_PK
         PRIMARY KEY     (creation_date, c_id)
    );--Please note, issue_cost is actually a view, not a table, but by itself it runs very quickly
    CREATE TABLE ISSUE_COST
              unit_iss_cost     number(15,2)
         ,     ord_nbr          varchar(10)
         ,     sub_ord_nbr     varchar(3)
    );--Please note, ord table has a couple of foreign keys that I did not mention
    CREATE TABLE ORD
              ord_nbr          varchar(10)
         ,     sub_ord_nbr     varchar(3)
         ,     major_seq_nbr     varchar(4)
         ,     qty_complete     number (13,4)
    );Sample tables:
    ACT
    creation_date     c_id     part_nbr     order_nbr     sub_order_nbr     maj_seq_nbr     act_dlrs_earned     act_brdn_dls_earned     tool_dlrs_earned     act_fix_brdn_dls_ea     activity_date
    01/02/2000      12345     ABC-123          0000012345     001          0010          10.00          20.00               0.00               0.00               01/01/2000
    01/02/2000     12345     XYZ-987          0000054321     001          0030          100.00          175.00               10.00               10.00               01/01/2000
    01/03/2000     12347     ABC-123          0000012345     001          0020          25.00          75.00               5.00               1.00               01/02/2000
    01/03/2000     12348     ABC-123          0000012345     001          0020          75.00          120.00               25.00               5.00               01/02/2000
    01/03/2000     12349     XYZ-987          0000054321     001          0050          50.00          110.00               0.00               0.00               01/02/2000
    01/04/2000     12350     ABC-123          0000012345     001          0030          25.00          40.00               0.00               0.00               01/03/2000
    ISSUE_COST
    unit_iss_cost     ord_nbr          sub_ord_nbr
    125.00          0000012345     001
    650.00          0000054321     001
    ORD
    ord_nbr          sub_ord_nbr     major_seq_nbr     qty_complete
    0000012345     001          0010          10
    0000012345     001          0020          10
    0000012345     001          0030          0
    0000054321     001          0030          20
    0000054321     001          0050          19If insert statements are needed for the sample tables, let me know and I'll go re-figure out how to write them. (I only have read-only access to the database I'm querying, so creating tables and inserting values aren't things I ever do).
    Thanks in advance!

    For diagnosing where the time of your query is being spent, we don't need create table and insert statements. If we execute your query with only a handful of rows, the query will be very fast. What we do need to know, is the plan the optimizer takes to compute your result set, and the cardinalities of each step.
    Please read When your query takes too long ... carefully and post the full explain plan and tkprof output.
    Regards,
    Rob.

  • Need help on enhancement of 0CO_OM_OPA_1 with Material and Plant

    Hi,
    I have a requirement that need to build a BW report which shows Actual costs and Planned Costs of Service Orders. We are getting Actual costs from 0CO_OM_OPA_6 and now i am getting planned costs from 0CO_OM_OPA_1. For actual costs we are getting Service Orders, Material and plant from Satandard DS 0CO_OM_OPA_6. Where as For Planned Costs standard data source 0CO_OM_OPA_1 is not having Material and Plant information. For this we decided to enhance 0CO_OM_OPA_1 with Material and Plant.
    But we are not sure the source tables for material and plant and the logic to extract these data from the tables. Can anybody please help me out.
    Thanks for your supprt in advance.

    It's possible you may need to use a CO-PA (profitability analysis) datasource instead of 0CO_OM_OPA_6.  0CO_OM_OPA_6 extracts data from CO tables. 
    Based on the path you provided "...Profit. segment...", the requested data might exist with CO-PA.
    If you determine the required data resides in CO-PA, you'll have to create a datasource based on the operating concern.  You can perform a search within the online docs for steps to create this datasource.
    Hope this helps.
    Rod

  • I need help. Very bad service with subscriptions

    I have the worst service. Nobody helps me.
    I need to update my card to renew my subscription. I lost my membership 29.99 deal because I could not pay. Each time I do the process in the bank charges one dollar (allready 14 dollars), not a lot, but not good. I can not work.
    I call to the Mx phone number with brazilian time and it is open in the middle of the night until noon and nobody helps. Even I call to the US and nobody helps. My subscription is in hig level since two days and I have not a positive answer for my problem.
    What can i  do? I am in a problem because of these. Please Help me with my software. Really, really frustating.
    I am willing to pay more, loose my services, my promotions for being a long time custumer. but i need the software now! now, now.
    I am [email protected]

    Have you tried the Adobe Chat support, if that is available where you are?  The chat support that answers queries from the US is in India not the US although they usually type ok English.
    There could be some issues with the international banking network for authorizing credit and debit cards that Adobe doesn’t have direct control over, but at least someone should be able to tell you what is happening, I’d think.
    Your bank may only be “authorizing” a $1 charge, to test to see if there is money in a valid account.  An authorization doesn’t actually move money anywhere, so the $14 may come back little by little as the time expires on each authorization after a few days.

Maybe you are looking for

  • How do I copy a photo I received in an e-mail to iPhoto?

    How do I copy a photo I received in an e-mail to iPhoto?

  • MSI R6850 low 3dmark06 score

    Hey, I build a new PC about a month ago and I noticed that my graphics card isn't reaching it's potential about 16463 3DMarks. I didn't figure out how to put my specs below but I'll post them here. Motherboard: MSI 785GM-E65 bios version: 2.BO Proces

  • SQL Loader and Dates

    Hi, I have a date field stored in a text file, can anyone tell me what the control file entry for that field should be (if we assume a format of DDMMYYYY). thanks in advance, ED.

  • Why can't I arrange my tile to two up

    Open new File. Place image onto paper crop accept new image but I can't get arrange 2 up vertically as this is not highlighted. How do I get this please.

  • How do I get a network name?

    My printer always asked for a network name.  Where do I find that?