Decode is bad to use

Is it true that Decode should be avoided because it makes the query run slow.I am told this constantly in my organization by sql developer.Is it true.

I never use case, because I think it is slower.
SYS@LSC63 AS SYSDBA/10.2.0.1
SQL> create table scott.t11 as select rownum r, trunc(dbms_random.value(1,5)) v
  2 from (select null from dual group by cube(null,null,null,null,null,null,null,null,null,null)),(select null from dual group by cube(null,null,null,null,null,null,null,null,null,null))
SYS@LSC63 AS SYSDBA/10.2.0.1
SQL> exec runstats_pkg.rs_start;
PL/SQL procedure successfully completed.
SYS@LSC63 AS SYSDBA/10.2.0.1
SQL> select sum(decode(v,1,10,2,20,30)) from scott.t11;
SUM(DECODE(V,1,10,2,20,30))
                   23606180
SYS@LSC63 AS SYSDBA/10.2.0.1
SQL> exec runstats_pkg.rs_middle
PL/SQL procedure successfully completed.
SYS@LSC63 AS SYSDBA/10.2.0.1
SQL> select sum(case v when 1 then 10 when 2 then 20 else 30 end) from scott.t11;
SUM(CASEVWHEN1THEN10WHEN2THEN20ELSE30END)
                                 23606180
SYS@LSC63 AS SYSDBA/10.2.0.1
SQL> exec runstats_pkg.rs_stop(500)
Run1 ran in 851 hsecs
Run2 ran in 2709 hsecs
run 1 ran in 31.41% of the time
Name                                  Run1        Run2        Diff
STAT...Elapsed Time                    856       2,713       1,857
STAT...session pga memory           65,536           0     -65,536
Run1 latches total versus runs -- difference and pct
Run1        Run2        Diff       Pct
3,339       5,624       2,285     59.37%
PL/SQL procedure successfully completed.
SYS@LSC63 AS SYSDBA/10.2.0.1
SQL>

Similar Messages

  • How to find out which BADIs are used

    Hi Experts,
    Is there any tcode where I can give the transaction or program name and find out which BADIs are used in that transaction.
    thanks
    sankar

    Dear Sankar,
    You can first check available BAdis and then go to SE19 to see what all have been implemented.
    Please check this sample program from other thread to find BADI and enhancement for a given transaction code. You just need to create a custom program in your system by cut and paste below codes.
    REPORT ZTEST.
    TABLES: TSTC,
    TADIR,
    MODSAPT,
    MODACT,
    TRDIR,
    TFDIR,
    ENLFDIR,
    SXS_ATTRT ,
    TSTCT.
    DATA: JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
    DATA: FIELD1(30).
    DATA: V_DEVCLASS LIKE TADIR-DEVCLASS.
    PARAMETERS: P_TCODE LIKE TSTC-TCODE,
    P_PGMNA LIKE TSTC-PGMNA .
    DATA: WA_TADIR TYPE TADIR.
    START-OF-SELECTION.
    IF NOT P_TCODE IS INITIAL.
    SELECT SINGLE * FROM TSTC WHERE TCODE EQ P_TCODE.
    ELSEIF NOT P_PGMNA IS INITIAL.
    TSTC-PGMNA = P_PGMNA.
    ENDIF.
    IF SY-SUBRC EQ 0.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'PROG'
    AND OBJ_NAME = TSTC-PGMNA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    IF SY-SUBRC NE 0.
    SELECT SINGLE * FROM TRDIR
    WHERE NAME = TSTC-PGMNA.
    IF TRDIR-SUBC EQ 'F'.
    SELECT SINGLE * FROM TFDIR
    WHERE PNAME = TSTC-PGMNA.
    SELECT SINGLE * FROM ENLFDIR
    WHERE FUNCNAME = TFDIR-FUNCNAME.
    SELECT SINGLE * FROM TADIR
    WHERE PGMID = 'R3TR'
    AND OBJECT = 'FUGR'
    AND OBJ_NAME EQ ENLFDIR-AREA.
    MOVE : TADIR-DEVCLASS TO V_DEVCLASS.
    ENDIF.
    ENDIF.
    SELECT * FROM TADIR INTO TABLE JTAB
    WHERE PGMID = 'R3TR'
    AND OBJECT in ('SMOD', 'SXSD')
    AND DEVCLASS = V_DEVCLASS.
    SELECT SINGLE * FROM TSTCT
    WHERE SPRSL EQ SY-LANGU
    AND TCODE EQ P_TCODE.
    FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
    WRITE:/(19) 'Transaction Code - ',
    20(20) P_TCODE,
    45(50) TSTCT-TTEXT.
    SKIP.
    IF NOT JTAB[] IS INITIAL.
    WRITE:/(105) SY-ULINE.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    Sorting the internal Table
    sort jtab by OBJECT.
    data : wf_txt(60) type c,
    wf_smod type i ,
    wf_badi type i ,
    wf_object2(30) type C.
    clear : wf_smod, wf_badi , wf_object2.
    Get the total SMOD.
    LOOP AT JTAB into wa_tadir.
    at first.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 'Enhancement/ Business Add-in',
    41 SY-VLINE ,
    42 'Description',
    105 SY-VLINE.
    WRITE:/(105) SY-ULINE.
    endat.
    clear wf_txt.
    at new object.
    if wa_tadir-object = 'SMOD'.
    wf_object2 = 'Enhancement' .
    elseif wa_tadir-object = 'SXSD'.
    wf_object2 = ' Business Add-in'.
    endif.
    FORMAT COLOR COL_GROUP INTENSIFIED ON.
    WRITE:/1 SY-VLINE,
    2 wf_object2,
    105 SY-VLINE.
    endat.
    case wa_tadir-object.
    when 'SMOD'.
    wf_smod = wf_smod + 1.
    SELECT SINGLE MODTEXT into wf_txt
    FROM MODSAPT
    WHERE SPRSL = SY-LANGU
    AND NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    when 'SXSD'.
    For BADis
    wf_badi = wf_badi + 1 .
    select single TEXT into wf_txt
    from SXS_ATTRT
    where sprsl = sy-langu
    and EXIT_NAME = wa_tadir-OBJ_NAME.
    FORMAT COLOR COL_NORMAL INTENSIFIED ON.
    endcase.
    WRITE:/1 SY-VLINE,
    2 wa_tadir-OBJ_NAME hotspot on,
    41 SY-VLINE ,
    42 wf_txt,
    105 SY-VLINE.
    AT END OF object.
    write : /(105) sy-ULINE.
    ENDAT.
    ENDLOOP.
    WRITE:/(105) SY-ULINE.
    SKIP.
    FORMAT COLOR COL_TOTAL INTENSIFIED ON.
    WRITE:/ 'No.of Exits:' , wf_smod.
    WRITE:/ 'No.of BADis:' , wf_badi.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'No userexits or BADis exist'.
    ENDIF.
    ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(105) 'Transaction does not exist'.
    ENDIF.
    AT LINE-SELECTION.
    data : wf_object type tadir-object.
    clear wf_object.
    GET CURSOR FIELD FIELD1.
    CHECK FIELD1(8) EQ 'WA_TADIR'.
    read table jtab with key obj_name = sy-lisel+1(20).
    move jtab-object to wf_object.
    case wf_object.
    when 'SMOD'.
    SET PARAMETER ID 'MON' FIELD SY-LISEL+1(10).
    CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
    when 'SXSD'.
    SET PARAMETER ID 'EXN' FIELD SY-LISEL+1(20).
    CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
    ENDCASE.
    Alternatively, you can do the following:
    1. For what ever transaction u want the enhancement .. just check for the System-->status (menu) and find out the PROGRAM name....
    2. Double click on to the program name and go inside the program (Abap editor)
    3. Search for "Call Customer-function " ... and u'll get some search results .. If u get results then u have enhancement in that tcode .....
    4. Then it actually calls a Function module .... copy the Function module name .... go to SE80 (object navigator) click on "Repository Information system" then Customer Enhancements .... Give the Function module name in the "Components" field and click Execute ....
    ull get a list of Enhancements related to that Componene....
    5. Choose which ever enhancement will suit ur business need ..
    6. Go to CMOD... create a project .... assign ur enhancement ... and then code ur logic.... activate ur enhancement in CMOD ....... Ur Buisness need will be solved...
    For a user exit......
    Finding whether there is any User Exit or not for tcode VA42
    1. For what ever transaction u want the user exit .. just check for the System-->status (menu) and find out the PROGRAM name.... ( The program name would be for our scenario "SAPMV45A" )
    2. Double click on to the program name and go inside the program (Abap editor)
    3. Search for the word "USEREXIT" .... u ll find all the user exits in the search result .. and find ur's then ...
    Hope this will help.
    Regards,
    Naveen.

  • Plz help me about my Iphone  5s battary life is so bad without using in the night keep on after 6 hours  morning when i open battary  % lose 60 percentage  with out using

    Plz help me about my Iphone  5s battary life is so bad without using in the night keep on after 6 hours  morning when i open battary  % lose 60 percentage  with out using plz help me..

    Maximize iPhone Battery (iOS7):
    1) Turn off Airdrop: Control Center >AirDrop > Off
    2) Limit background app refresh. Turn it off for applications such as Google/Facebook.Settings > General > Background App Refresh
    3) Turn off automatic updates: Settings > iTunes & App Store >  Updates and Apps (off)
    4) Unneccessary Location Services: Settings > Privacy > Location Services > System Services > Off (uncheck as needed)
    5) Turn off Paralax: Settings > General > Accessibility > Reduce Motion
    6) Siri, and her 'raise to speak.' Turn it off: Settings > General > Siri > Raise to Speak
    7) Exclude items from Spotlight search as needed: Settings > General > Spotlight Search
    8) Remove unneccessary notifications: Settings > Notification Center > None (per app basis)
    9) Make sure auto-brightness is on, or reduce the brightness to 25% or less if desired.Settings > Wallpapers & Brightness
    10) Use Still backgrounds only: Settings > Wallpapers & Brightness> Choose Wallpaper
    11) Fetch email instead of "Push":  Settings > Mail, Contacts, Calendar > Fetch New Data >Push(off) & Fetch every 15 minutes
    12) Disable LTE if needed: Settings > Cellular > Enable 4G/LTE (OFF)
    13) Reduce Autolock: Settings > General > Auto-Lock > 1 Minute
    14) Disable Vibrations with Ring: Settings > Sounds > Vibrate on Ring (off)
    15) Close Applications regularly: Double Tap Home Button > Swipe up on App to close

  • On Completer of Service Confirmation - Which BADI to use

    Hi Experts,
    I am creating a service confirmation from the Service Order, once service confirmation is done then click on Complete button and then Save.
    I want to do coding at the time of hitting the complete button.For this which is the BADI to use.
    Thanks in Advance for your reply,
    Praveen

    Hi Praveen,
    Are you using the SAP GUI to develop this scenario or some other  technology to achieve the same.
    In SAP GUI - the One Order Function Module CRM_ORDER_MAINTAIN will create the Document for you. The same can be saved using the CRM_ORDER_SAVE.
    Let me know if this solves your query.
    Thanks,
    Samantak.

  • Only BADi is used in enhancement spot when customer createion?

    Only BADi is used in enhancement spot when customer createion?

    Only BADi is used in enhancement spot when customer createion?

  • Siri sounds bad when using Bluetooth

    Siri sounds bad when using Bluetooth, but the phone calls sound great.

    Can a few of you help me with a test? I have a Jawbone 2 & a Jawbone Icon. Both exhibit a strange behavior with my iPhone 4. If either of these headsets are on, paired & connected AND a call is answered or initiated, things are fine.
    When it all goes downhill is in this scenario:
    My headset is OFF. I receive or make a call and mid-call, I decide to turn on the headset (which I keep off to save battery). The Jawbone connects and automatically switches the iPhone from PHONE to JAWBONE. This is all normal right? Okay here's the problem. The call quality has static, sounds muffled and the caller tells me I sound like I'm in a tin can. If I then switch back to the phone (through the iPhone page of Sources) and then back again, to the Jawbone, most times--quality is back to normal. Obviously this is not something we all want to be doing. Can anyone do this test with their headset .. any brand and even some of you with Icons? It would be good to know if the culprit is the Bluetooth Headset or the iPhone. Remember, it's important that you make a call with your Bluetooth headset in the OFF position and then turn it on mid-call to use it.

  • My ipod nano gen 4 is stolen! He is my first love with ipod. Can I lock this device by use serial number of the device? I don't want any bad guys use or do anything with my love one. Please let me know if have the way to do thanks.

    My ipod nano gen 4 is stolen! He is my first love with ipod. Can I lock this device by use serial number of the device? I don't want any bad guys use or do anything with my love one. Please let me know if have the way to do thanks.

    zenith_nm wrote:
    My ipod nano gen 4 is stolen! He is my first love with ipod. Can I lock this device by use serial number of the device? I don't want any bad guys use or do anything with my love one. Please let me know if have the way to do thanks.
    Nope!
    http://support.apple.com/kb/HT2526 How to report lost or stolen Apple product

  • Is it bad to use iPad while charging?

    Is it bad to use iPad while charging?

    No this is not a problem. But you should be charging the device using the charger that came with it and have that lugged into a known good wall outlet.

  • Name  the BADI that used to generate the report RSWUWFMLEC

    Hi,
      Please mention the name of the BADI that used to generate or trigger the report RSWUWFMLEC.
    regards,
    George.

    RSWUWFMLEC. is program which is used to generate mails.
    it is trigerred by scheduled jobs...
    it is not triggered by any BADI....

  • Performance is bad wile using qaaws in xcelsius - tips to improve?

    Post Author: RMS
    CA Forum: Xcelsius and Live Office
    Hi,
         Im using qaaws as the source for my xceslsius dashboard.
    I am able to create and fetch data using the web services and also display it in components in my model.
    However, the performace is really BAD! Does anyone know how to tune up qaaws performance? Another strange thing that is happening is, when i have my xcelsius up and running, and i click on the web service connector, if i also have a deski query runnning at the same time,  my web service takes FOREVER to show a change in the model. Its almost like nothing is  happening.
    Does anyone know what qaaws and BOXI services have in common? Does qaaws alos have to be managed thru the CCM or the CMC? (server, etc?)
    ANY help will be appreaciated!!
    Thanks!!

    Jason,
    This may not apply to your dashboard, depending on the nature of the data you're bringing back, but I try to minimize the number of separate queries by combining all the ones with the same 'shape' into one query.  For example, if you have several queries bringing back 12 rows - one for each of the past 12 months, you can combine them into a single query with multiple columns.  You can then make use of Excel functions such as VLookup to pick out the particular columns needed for displaying each chart.  You can also click on the 'row' line in the data manager to outline the entire area being brought back, rather than having to do each column individually.
    Again, this may not be applicable for your needs, but I've also found that I could eliminate using query parameters by bringing back a larger amount of data into the spreadsheet in the initial load and then using the Excel functions to pick up the data being requested in the user controls for displaying in the charts.  Using that monthly example above, for instance, you could bring back several years worth of data (at a cost of only 12 rows / year in the spreadsheet), and then use the lookup functions to bring up the year requested in a user control.
    Hope those ideas help,
    Peter

  • Bad connection using Skype on Ipad and IMac

    I have skype on my imac and on my ipad. I am trying to skype someone who is using my ipad in Spain. last night we spoke easily and it was very clear. Tonight it is really bad, with what seems to be a lot of interference and also breaking up. Using WiFi at both ends. I also updated my version of skype on my iMac, this evening before calling? Any ideas, very much appreciated x

    That is probably the nature of Skype. Generally when I use it which is at least twice a week it is reasonable, other times excellent and others very poor, with dropped calls and frozen video.
    If you both have good internet connections, i.e you both can connect to other web sites OK then it is just the way it is sometimes.
    Unless of course any body else can suggest other ideas to help.

  • BADI cant use an internal table with header line

    hi,
         In BADI, we cant use an internal table with header line, and I am calling a function module which requires internal table as import parameter, now, the table I am passing is without a header line, So how to solve this problem ?

    You can use a type and then create an internal table of that type.
    types :
    begin of t_<example>
    *field list
    end of t_<example>
    data :
    gt_<table> type standard table of t_<example>
    pass this to the FM

  • Why DECODE can only be used in sql statement

    Hi,
    Why the sql1 works but sql2 doesn't.
    sql 1 ) Select decode(1,0,0,1) into var from dual;
    sql 2 ) var = decode(1,0,0,1);
    Kindly clarify.
    Regards,
    Kishore

    Hi Purvesh,
    2nd works fine for 11g onwards.
    Really?
    Got the same error when executed the below (on Oracle 11.2.0.3.0)
    SQL> DECLARE
      2    var_x NUMBER := 1;
      3    var_y VARCHAR2(10);
      4  BEGIN
      5    var_y := Decode(var_x, 1, 'Yes', 'No');
      6    Dbms_Output.PUT_LINE('var_x: '||var_x);
      7    Dbms_Output.PUT_LINE('var_y: '||var_y);
      8  END;
      9  /
      var_y := Decode(var_x, 1, 'Yes', 'No');
    ERROR at line 5:
    ORA-06550: line 5, column 12:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL
    statement only
    ORA-06550: line 5, column 3:
    PL/SQL: Statement ignored
    Please explain me the same.

  • Do i need to purchase Livecyle barcoded forms to decode regular barcode generated using Acrobat9pro?

    I am trying to use Barcode function on Adobe acrobat pro version..I could not figure out..how can i autopopulate forms using Barcode from one PDF document( form) to next PDF document( form)..i am missing something in between those?

    The barcode is actually a mechanism that is used to retrieve data from a printed form. If you have your form inside Acrobat then you can simply use the Tools, Forms, Data Export function to extract and then possibly re-import the data from your form.
    If you do have a printed form that you are scanning you will need to write the process that decodes and then populates your form again from the extracted data.

  • Is it bad to use a non apple charger to charge my macbook air?

    I just ordered a replacement charger on eBay and realized that it was a non apple charger, is it bad to still use it?

    Yes!!
    I recommend not using it.  Recall that some iPhone fires were actually started by using non-approved iPhone chargers.

Maybe you are looking for