1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How many types of functions available in PL/SQL?

Discussion in 'SQL PL/SQL' started by RG Hegde, May 27, 2015.

  1. RG Hegde

    RG Hegde Forum Advisor

    Messages:
    185
    Likes Received:
    35
    Trophy Points:
    310
    Location:
    Pune
    Hello Al,

    How many types of functions available in PL/SQL ?

    like MEMBER Function,STATIC Function.

    If any one gone through that could you please help me to get the documents.
     
  2. ocprep

    ocprep Forum Advisor

    Messages:
    277
    Likes Received:
    76
    Trophy Points:
    410
    Location:
    Orlando, Florida
    I'm guessing you are referring to MEMBER/CONSTRUCTOR/STATIC methods -- but perhaps not.
    The 9.2 PL/SQL User's Guide and Reference had them all in one place. Later manuals have the information but separated further apart.

    http://docs.oracle.com/cd/A97630_01/appdev.920/a96624/13_elems32.htm


    MEMBER | CONSTRUCTOR | STATIC

    This keyword lets you declare a subprogram or call spec as a method in an object type spec. A constructor method must have the same name as the object type, while member and static methods must have names that are different from the object type or any of its attributes.

    MEMBER methods are invoked on instances of objects, and read or change the attributes of that particular instance:

    object_instance.method();

    CONSTRUCTOR methods create new instances of objects, and fill in some or all of the attributes:

    object_instance := new object_type_name(attr1 => attr1_value,
    attr2 => attr2_value);

    The system defines a default constructor method with one parameter for each object attribute, so you only need to define your own constructor methods if you want to construct the object based on a different set of parameters.

    STATIC methods are invoked on the object type, not any specific object instance, and thus must limit themselves to "global" operations that do not involve the object attributes:

    object_type.method()
     
    RG Hegde likes this.