What is the difference betwee decode & case function

Hi
What is the difference betwee decode & case function
1.decode can't used in pl/sql 1) case can be user
2.in decode we can't use (>,<,>=) 2) we can use
any other do u have....
thanks in advance....

DECODE works with expressions which are scalar values.
CASE can work with predicates and subqueries in searchable form.
There is one more Important difference between CASE and DECODE
DECODE can be used Only inside SQL statement....
But CASE can be used any where even as a parameter of a function/procedure
Eg:-
SQL> create or replace procedure pro_01(n number) is
  2  begin
  3  dbms_output.put_line(' The number  = '||n);
  4  End;
  5  /
Procedure created.
SQL> set serverout on
SQL> var a varchar2(5);
SQL> Begin
  2  :a := 'ONE';
  3  End;
  4  /
PL/SQL procedure successfully completed.
SQL> Begin
  2   pro_01(Decode(:a,'ONE',1,0));
  3  End;
  4  /
pro_01(Decode(:a,'ONE',1,0));
ERROR at line 2:
ORA-06550: line 2, column 9:
PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL
statement only
ORA-06550: line 2, column 2:
PL/SQL: Statement ignored
SQL> Begin
  2    pro_01(case :a when 'ONE' then 1 else 0 end);
  3  End;
  4  /
The number  = 1
PL/SQL procedure successfully completed.Message was edited by:
Avi
Message was edited by:
Avi

Similar Messages

  • What is the difference between subroutine and function module?

    What is the difference between subroutine and function module?

    Hi,
    they can both return values.
    FMs are mainly used when a routine is to be performed by many programs.
    Subroutines (forms) are generally only executed within one program.
    You can perform routines from other programs, but it's not often done.
    both forms and FMs are reusable modularization units.
    To distinguish we generally say that forms are used for internal modularization and
    FMs are used for external modularization.
    To decide on which to implement, consider whether you need the content to be used just for a limited program
    or wheteher it can be called from many independent programs.
    For the first purpose it is better to implement a form whereas for the second we implement an FM.
    However, ABAP does not isolate the usage context.
    That is; you can call a form from another program within whose code the form is not actually implemented.
    However, this requires attention since the form may utilize global variables.
    The same issue holds for FMs.
    FMs are encapsulated in function groups and function groups may have global variables that can be globally
    used by all FMs inside it.
    Thanks,
    Reward If Helpful.

  • What is the difference betwee STRUCTRUE AND INTERNAL TABLE

    what is the difference betwee STRUCTRUE AND INTERNAL TABLE

    Hi
    <b>Internal table  </b>            
    Internal Tables are runtime objects.
    A.     The lines of an internal table always have the same structure
    B.     You have to define the structure of the internal table at the begining.
    C.     Internal tables require special work area for interface     
    Types:
    STANDARD table
    Key access to a standard table uses a linear search. This means that the time required for a search is in linear relation to the number of table entries.
    You should use index operations to access standard tables.
    SORTED table
    Defines the table as one that is always saved correctly sorted.
    Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries.
    HASHED table
    Defines the table as one that is managed with an internal hash procedure
    You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.                                                                               
    <b> Structure         </b>                                                             
        Structure are data dictionary objects.     Tcode -SE11                                                                        
         No data records exist in the database for a structure. Structures are used for the interface definition between programs or between screens and programs.                                             
    Reward points if this helps.
    Manish
    Message was edited by:
            Manish Kumar

  • What's the difference between BRM predef functions isSet and nilled

    Hello again experts,
    Just a little question:
    What's the difference between BRM predef functions -  isSet() versus nilled() ?
    Thanks in advanced

    Hi There,
    Check out [this|http://help.sap.com/saphelp_nwce72/helpdata/en/e6/9a62d540184161aaa08af5dea3e2ee/frameset.htm]. You will find the details of SAP provided difference between the two in this document.
    Best regards,
    Bala

  • What is the difference between procedure and function?

    Hi,
    i want to know the difference between procedure and function.
    Also, i want to know types(if they exists) of procedures and functions .
    Regards

    Also, please try and use the SEARCH functionality offered by the forum, it's always possible someone has asked the question before you.
    Functions vs Stored Procedures
    Is one such instance.

  • What is the difference b/w ALV Function Module and ALV Methods?

    Hello Friends,
          Can anybody help me in finding out the difference between ALV Function Modules and ALV methods?
    Thanks & Regards
    Sathish Kumar

    Hi Sathish,
    Plz go through this info. It is very useful.
    hi,
    chk these excellent links.
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    OOPs:
    Check this for basic concepts of OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Tabstrip
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
    Editable ALV
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
    Tree
    http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
    General Tutorial for OOPS
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
    Rewords some points if it is helpful.
    Rgds,
    P.Naganjana Reddy

  • What is the difference betwee 16 and 32?

    What is the biggest difference between 16 and 32 on an ipad 2 wifi and 3G?

    Other than the additional 16GB, there's absolutely no difference.
    The amount of storage you need is dependent upon:
    * The size of your music collection.
    * Whether you want to load and watch videos on it, and how many you plan to keep on it.
    * The number of photos you want to sync to it.
    * The number of apps you want to keep on it. (Beware: Apps are addictive).

  • What are the differences between all these functions? stdev.p, stdevpa, stdev, stdeva, stdev.s

    I cannot get the main idea of the function of all these formulas on excel although I can understand the concept of standard deviation.... Kindly help me out... 

    May be the below link would help you to understand the differences
    http://www.excelfunctions.net/standard-deviation-in-excel.html

  • What is the difference between the function declared in the package and pac

    What is the difference between defining a function in the package and package body ?
    Edited by: user10641405 on Nov 19, 2009 1:29 PM

    If you describe a package, you will only see the functions declared in the spec.
    If you only declare them in the body then they are not available to other packages (they are private to the package, not public)

  • What is the difference between J2EE Engine vs WAS in SAP

    Hello All,
    What are the differences between J2EE engine included with BW 3.0B and the WAS 6.20 ? what are the limitations of J2EE engine in terms of functionality.
    Thanks in advance
    Ravi

    Hello Nitzan,
    Thanks for the response. Just to clarify my question, There is a J2EE engine as part of BW 3.0B. What is the difference in terms of functionality of J2EE engine which comes bundled with BW 3.0B versus say WAS 6.20.
    1. The J2EE engine which comes bundled with BW 3.0B, is it a run time or a full product where a java app can be developed and deployed to integrate with BW or do you need WAS for that purpose.
    Thanks & regards
    Ravi

  • What Is The Difference Between Budget Cost And Regular Cost For Resources?

    What's the difference betwee budget cost and regular cost for resources?
    Here is the explanation which I didn't understand from the book;
    In planning your departmental retreat, suppose you
    have specific budget targets
    for certain cost categories, $2,500
    for travel expenses, $500 for printing,
    and $1,000 for conference room rentals. Using Project’s budget resource
    feature, you can define your budget
    for different categories
    of items. You can then group your resources to
    com-pare your budgeted
    costs to your planned costs. This way, you
    can view your travel budget
    of $2,500 side by side with your planned
    costs of, say, $3,700,
    and immedi- ately see that your next
    goal is to find a way to trim those travel
    costs.

    Hi,
    You have to differenciate the proejct budget from the project cost:
    The project budget is the amount of money which has been allocated to your project by the executive board based on the estimation you provided. This is not meant to be changed unless you go through a change request process, justifying why you need to change
    (increase) the budget, meaning asking more money. Consequently it will not be related in MS Project with the tasks, assignments. It is entered on the project summary and can be meanly used in portfolio reports where you can consolidate yours budgets (you can
    have several different budgets) among a set of projects.
    The project cost is something which lives, changes along the project lifecycle. It is meant to be updated on a weekly or biweekly basis from the team members tasks updates approved by the project manager. Then the PM updates the remaining work thus the project
    cost.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |
    You say that the budget cost is total money which committee gave you for the project.
    But the book refer budget cost for every resource. I don't understand that.
    " In planning your departmental retreat, suppose you
    have specific budget targets
    for certain cost categories, $2,500
    for travel expenses, $500 for printing,
    and $1,000 for conference room rentals. Using Project’s budget resource
    feature, you can define your budget
    for different categories
    of items. You can then group your resources to
    com-pare your budgeted
    costs to your planned costs. This way, you
    can view your travel budget
    of $2,500 side by side with your planned
    costs of, say, $3,700,
    and immedi- ately see that your next
    goal is to find a way to trim those travel
    costs. "
    For example here travel budget cost is 2500 whereas planned cost is 3700. Planned cost of travel expense is created by the project manager. Who does define travel budget cost?
    Let's say an employee's cost is 20 dollars per hour and I write it on the project. So how much is this employee's budget cost, Who does define it, From whom do I learn that data?

  • What is the differents between subroutine

    what is  the differents between subroutine and function module
               plz explain cliarly

    Hi,
    ABAP contains the following kinds of procedures:
    Subroutines
    Subroutines are principally for local modularization, that is, they are generally called from the program in which they are defined. You can use subroutines to write functions that are used repeatedly within a program. You can define subroutines in any ABAP program.
    Function Modules
    Function modules are for global modularization, that is, they are always called from a different program. Function modules contain functions that are used in the same form by many different programs. They are important in the R/3 System for encapsulating processing logic and making it reusable. Function modules must be defined in a function group, and can be called from any program.
    Methods
    Methods describe the functions and behavior of classes and their instances in ABAP Objects. Methods must be defined in classes. When you call them, you must observe certain special rules of object-oriented programming.
    A subroutine is a block of code introduced by FORM and concluded by ENDFORM.
    FORM <subr> [USING   ... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ]
                [CHANGING... [VALUE(]<pi>[)] [TYPE <t>|LIKE <f>]... ].
    ENDFORM.
    Function Modules
    Function modules are procedures that are defined in function groups (special ABAP programs with type F) and can be called from any ABAP program. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
    Function modules allow you to encapsulate and reuse global functions in the R/3 System. They are stored in a central library. The R/3 System contains a wide range of predefined function modules that you can call from any ABAP program. Function modules also play an important role in database updates and in remote communications between R/3 Systems or between an R/3 System and a non-SAP system.
    Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running. You can test function modules without having to include them in a program using the Function Builder.
    The Function Builder also has a release process for function modules. This ensures that incompatible changes cannot be made to any function modules that have already been released. This applies particularly to the interface. Programs that use a released function module will not cease to work if the function module is changed.

  • What is the difference between the normal function module and bapi function

    hi,
    what is the difference between the normal function module and bapi function module.

    Hi
    BAPI stands for Business API(Application Program Interface).
    A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
    You can make your function module remotely enabled in attributes of Function module but
    A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
    Regards
    Anji

  • 1)Now I use Lightrom 5.7 how to upgrade to 6 or CC? 2) What is the difference between 6 and CC vercion? 3) When I used lightromm 3, I could see inEXIF the distance in meters till the object I took, in the later virsions that function disappeared, it is ve

    1)Now I use Lightrom 5.7 how to upgrade to 6 or CC?
    2) What is the difference between 6 and CC version?
    3) When I used lightromm 3, I could see in EXIF the distance in meters till the object I took, in the later virsions that function disappeared, it is very sad  I am stiil waiting and hope that it would be possibble in the new  versions. Or this indication may  possible by setting?

    1)Now I use Lightrom 5.7 how to upgrade to 6 or CC?
    Purchase the standalone upgrade from here: Products
    Download CC version from here: Explore Adobe desktop apps | Adobe Creative Cloud
    2) What is the difference between 6 and CC version?
    See this comparison chart: Compare Lightroom versions | Adobe Photoshop Lightroom CC
    3) When I used lightromm 3, I could see in EXIF the distance in meters till the object I took, in the later virsions that function disappeared, it is very sad  I am stiil waiting and hope that it would be possibble in the new  versions. Or this indication may  possible by setting?
    Rob Cole's ExifMeta plugin displays the Subject Distance field (and much more).  Unfortunately, his Web site appears to be down again.  He used to be very active here, but he hasn't posted in several months.

  • What are the differences between ECC5.0 and 6.0 new GL functionality

    Hi Experts,
    What are the differences between ECC5.0 and 6.0 new GL functionality.
    If we want to implement IFRS, I think New GL functionality is very helpful, but why sap is recommending only for ECC6.0 new GL functionality, Eventhough this functionality is available in ECC5.0.
    Best Regards,
    Dharani

    Dear,
    ECC 5.0 vs. ECC 6.0/SAP ERP 6.0
    Functionality not available in the new G/L with mySAP ERP 2004 and ERP Central Component (ECC) 5.0:
    Transfer prices
    Statistical key figures
    Euro translation
    Audit Information System (AIS)
    Archiving
    Data retention tool
    Regards,
    Chintan Joshi.

Maybe you are looking for

  • HP Spectre 13 touch screen malfunctio​n

    The touchscreen on my Ultrabook malfunctions in a seemingly random fashion. It appears to randomly and independently trigger the touchscreen in a clearly visible vertical line about two thirds of the way across the screen. The screen reacts as if it

  • Footer extends longer in Preview Mode then in Design Mode

    I have attached two JPEGS that show my footer in "Design" mode and in "Preview" mode.  In "Design" mode the footer is perfect.  It is the size and distance it needs to be at.  However, when viewing it in "Preview Mode", the footer extends downward fa

  • Solaris 10 11/06 SXCR booting from USB-DVDROM is OK!!

    Hi!! I confirm that SXCR 11/06 is able to installing from a USB-DVDROM!! Yesterday I can install Solaris 10 in my Thinkpad X40 with no problems. I have posted this because many people is asking for install with this method in other forums Cheers!

  • Equals on array

    Hi, guys, recently, i wondered about something : how come "equals" on an array will return true if and only if the reference is the same? what i mean is illustrated by the following code:      public static void main (String[] args) {           int[]

  • SAP BI and SAP ECC6 with 2 production clients

    Dear Expert, Can you advise us in an orientation to be taken for SAP BI? In term of SAP ECC6 architecture, we have two clients in production: client 100 (A) and client 400 (B). Within client 100, there is a company code 1000 with designation A and wt