Doubt in Overloading Concept in Packages

Hi,
I have two Stored Procedures are inside a package
sp_mem(mCursor REFCURSOR Datatype,MemberId INTEGER);
sp_mem(mCursor REFCURSOR Datatype, mEmailId INTEGER);
In the Above Procedures if the second Parameter is Member Id then the first SP will be executed.
In the Above Procedures if the Second Parameter is MemEmailId then the Second SP will be Executed.
This is the normal OverLoading Concept inside the package. But for me, i am returning the Recordset using a RefCursor.
I just want to know it is possible for returning the recordset using ref cursor with the overloading concept for both the SP.
Thanks,
Murali.V

Hello
You need to be careful with this type of overloading. Overloading is generally based around the position and data types of the parameters being supplied which are used to identify the "signature" of the particular procedure to call i.e.
sp_myproc(ref cursor, integer)
sp_myproc(ref cursor, date)
sp_myproc(ref cursor, varchar2)
sp_myproc(ref cursor, varchar2, integer)
etc etc
When you have 2 procedures that have the same signature, unless you specify the name of the parameter, there is no way to determine which procedure to call:
tylerd@DEV2> CREATE OR REPLACE PACKAGE pkg_test_overload
  2  IS
  3
  4     PROCEDURE sp_mem(mCursor sys_refcursor,MemberId INTEGER);
  5     PROCEDURE sp_mem(mCursor sys_refcursor, mEmailId INTEGER);
  6
  7  END;
  8  /
Package created.
tylerd@DEV2>
tylerd@DEV2> CREATE OR REPLACE PACKAGE BODY pkg_test_overload
  2  IS
  3
  4     PROCEDURE sp_mem(mCursor sys_refcursor,MemberId INTEGER)
  5     IS
  6
  7     BEGIN
  8
  9             NULL;
10
11     END;
12
13     PROCEDURE sp_mem(mCursor sys_refcursor, mEmailId INTEGER)
14     IS
15
16     BEGIN
17
18             NULL;
19
20     END;
21
22  END;
23  /
Package body created.
Package body created.
tylerd@DEV2> var mycursor refcursor
tylerd@DEV2> var memberid number
tylerd@DEV2> exec pkg_test_overload.sp_mem(:mycursor,:memberid)
BEGIN pkg_test_overload.sp_mem(:mycursor,:memberid); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00307: too many declarations of 'SP_MEM' match this call
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
tylerd@DEV2> exec pkg_test_overload.sp_mem(:mycursor,MemberId=>:memberid)
PL/SQL procedure successfully completed.
tylerd@DEV2> exec pkg_test_overload.sp_mem(:mycursor,mEmailId=>:memberid)
PL/SQL procedure successfully completed.To me, using named notation with overloading kind of defeats part of the objective...I'm not saying it's completely wrong, as sometimes I guess it's unavoidable, but I'd review the design carefully :-)
HTH
David
Message was edited by:
David Tyler
Oops, copied the wrong bit of the output! :-)

Similar Messages

  • Function Overloading concept in PL/SQL

    hi all,
    do we have Function Overloading concept in PL/SQL? If so, how to implement it? can anybody help me out with an example?

    Yep.
    SQL> create or replace
      2  package test_package as
      3
      4     function blah(param IN NUMBER) return number;
      5     function blah(param IN DATE) return number;
      6     function blah(param IN VARCHAR2) return number;
      7
      8     -- or
      9
    10     function blah(param IN NUMBER) return date;
    11     function blah(param IN NUMBER) return varchar2;
    12     function blah(param IN NUMBER) return char;
    13
    14  end test_package;
    15  /
    Package created.

  • Doubts in GeoRaster Concept.

    Hi everybody,
    I have few doubts in GeoRaster concepts.
    I did mosaicing of multiple Georasater objects using "sdo_geor.getRasterSubset()" and able to display image properly. But while doing this I come across few people suggestions. They said that mosaicing multiple rows together in a GeoRaster table is not going produce meaningful results because the interpolation methods wont have access to the data in the adjacent cells at the seams because cell needed exist in a different row (i.e. where two rows of GeoRaster either abut or overlap).
    I assume Oracle takes care of all this. Please suggest wheather my assumption is true or the statement given is true?
    Regards,
    Baskar
    Edited by: user_baski on May 16, 2010 10:49 PM

    Hi Jeffrey,
    Requirements:-
    I have to do mosaicing of 'n' number of Georaster objects. For eg, if table has 4 rows of GeoRaster object, then i have to create single image by mosaicing all the Georaster object based on the Envelope provided. (Note: I have to do this with Queries without using GeoRaster API)
    Workflow:-
    1. Get the connection and table details.
    2. Retrieve necessary information from the db like SRID, MAXPYRAMID, SPATIALRESOLUTION, EXTENT etc. For getting extent, I used SDO_AGGR_MBR function.
    3. With the help of "MDSYS.SDO_FILTER" and bouding box values, I create arraylist which contains raster id's retrieved from raster data table which covers the bouding box value provided in the filter command.
    4. Then I passed bounding box value into "sdo_geor.getCellCoordinate" function and I retrieved row and column number of Georaster image and created a number array which contains starting and ending row/column numbers.
    5. Then I had written a PL/SQL with "sdo_geor.getRasterSubset" function which takes the number array and raster id as input parameters, which inturn returns BLOB object.
    6. I am executing step 5 in a loop with all the raster id's that I got at step 3. For eg, arraylist size is 4, then I will have four BLOB object.
    7. Finally, I creating new image from the BLOB objects after some scaling and cropping based on the individual GeneralEnvelope of each raster id object.
    I had followed all the above steps and successfully created mosaic image.However, few people suggested that mosaicing in this way does not produce meaningful results because the interpolation methods wont have access to the data in the adjacent cells at the seams because cell needed exist in a different row. I assume Oracle will take care of these things. Moreover, they suggested to keep single row in GeoRaster table instead of muliple rows of Georaster object and suggested to use "SDO_GEOR.updateRaster" function to update a part of the raster object and the pyramids are rebuild automatically.
    So Please suggest which is the better way to do mosaicing. Wheather my assumption is correct or not?

  • Doubt in Dataguard concept

    Dear all,
    Please help me regarding this i am very much confused.....
    I had couple of doubts in dataguard concepts.
    1)When archive log is transferred from primary to standby ,
    a.Whether DBWR will be in active state or not in standby server.To write the contents in the archived redo log files which came from the primary to the datafiles of the standby server.
    b.I am using online redo logs in the standby server not standby redo logs , whether online redologs in the standby server will have any effect in shipping of redologs from the primary database,
    c. In my standby database online redo logs state is changing between CLEARING AND CLEARING CURRENT.How standby server redologs will change it state,
    Regards,
    Vamsi.

    Hi again,
    They are not used in a physical standby database. They exist in order to be used in a case of opening the standby database read-write (failover/snapshot standby). Here what documentation says:
    Online redo logs
    Every instance of an Oracle primary database and logical standby database has an associated online redo log to protect the database in case of an instance failure. Physical standby databases do not have an associated online redo log, because physical standby databases are never opened for read/write I/O; changes are not made to the database and redo data is not generated.
    Create an Online Redo Log on the Standby Database
    Although this step is optional, Oracle recommends that an online redo log be created when a standby database is created. By following this best practice, a standby database will be ready to quickly transition to the primary database role.
    ...

  • Doubt in some Concepts

    Hi everyone,
    I have doubts with some security concepts, i've been reading documents, but i can clear this things up.... here's the thing....
    What exactly are a keystore, certificate and .pfx or p12 files?
    i understood that a pfx or p12 files are keystores whose have inside public and private keys.... but in my concept a certificate also have a public key and a private key..so i can say that keystores are certificates.... but i'm messing this concepts up, pretty sure of that....
    Could anyone help me?
    Thanks in Advance
    Edited by: cs.santos on Jun 16, 2009 12:28 PM

    1. Certificates only have public keys in them
    2. PFX and PKCS12 are essentially the same thing.
    3. PKCS12 is a format that is typically used to store a single keypair, both the public and private parts.
    4. KeyStore is a java class the provides storage for keys of all kinds, as the name implies. The KeyStore class supports different formats; one of these is PKCS12

  • A doubt on overloading

    it is said that functions with same name and signature can't be overloaded only by different return types.
    but when i coded like as below,
    class sub{
    // declarations
    sub(){
    // initializations
    int sub(){
    return 100;
    the above code did'nt rise errors, and works simply as some function in the class. when invoked using the object it returns the integer 100.
    could anybody , please explain me the concept of java behind this.

    its not a question whether constructors are method or
    not. the question is overloading.No, the issue, in essence, is exactly that constructors are not methods. In the OP, we have a base constructor and a subclass method with the same name.
    The subclass method is not an "overload with different return type" (the actual question) because:
    - the base ctor is not a method
    => it is not inherited
    => therefore, it cannot be overloaded in the subclass.
    Even within the base class, you cannot "overload a constructor by a method" because again, a constructor is not a method. You are allowed to give your class a method with a constructor name (although it is discouraged) but it doesn't qualify as an overload.
    seocndly we can call constructors as special type of
    functions but i think it is hardly used.Care to demonstrate that?

  • Function overloading concepts

    I am a little doubtful about the output of the following code:
    public class Test {
         void c(Object a){}
         void c(Float a){}
         void c(Number a){}
         void m(){
              c(null);
         public static void main(String[] args) {
              Test t = new Test();
              t.m();
    I an not able to find out the reason why the Float version of the c() will be called?

    DeltaGeek wrote:
    Hendawy wrote:
    The reason behind this is that a null value is a void reference to, i.e. a pointer to nothing. Since it is a pointer (address), it is actually a number. That's why the float version is best matching in your code.Wow...just....not even close.
    When determining what method to call, the compiler will find the most specific method it can that matches the arguments you pass in. Since you're passing in an uncast null, it can match any reference type.
    In this case, Float happens to be the most specific reference type it could use. This is also why adding an overload for Integer will cause a compilation error, as you now have multiple methods with the maximum level of specificity.
    Also note that casting the null to one of Float or Integer would resolve the compile error but hide the design problem.But i have a doubt; if i follow your approach then this code must work:
    public class Test {
         void c(Object a){}
         void c(Float a){}
         void c(Number a){}
         void c(DerivedInteger a){}
         void m(){
              c(null);
         public static void main(String[] args) {
              Test t = new Test();
              t.m();
    class MyInteger extends Number{
         public double doubleValue() {
              return 0;
         public float floatValue() {
              return 0;
         public int intValue() {
              return 0;
         public long longValue() {
              return 0;
    class DerivedInteger extends MyInteger{
    because U is the most specific one,

  • Doubts on casting concepts in TAW12 part 1

    Can someone help me clarify a little confusion on Casting in materials provided by SAP Education on TAW12 part 1.
    I attended ILT and my instructor emphasized that: "wherever in this material we read 'Up-cast' or 'Down-cast', we should consider this as an error because what they meant to say is exactly the opposite".
    This has now left me confused especially after revising.
    Can someone please share some light on these terminologies and concept? especially in relation to materials provided on TAW12 ABAP Workbench Concept Part 1 (2013 SAP AG. All rights reserved)
    I have not been able to find much materials online for this section of the book and for many others.
    Any help would be greatly appreciated.
    Vince

    Hi Vince,
                   First thing, STOP worrying about the SAP material whether the contain is right/wrong.
                  Now, what I understand is that the instructor tried to explain the concepts in a easy way to remember but has that seems to have messed up your basics on up-cast & down-cast.
    I have looked in my sap material ( but its 2005 SAP AG reserved ).  The definition are fine.
    Anyways I'll try to explain in my style:
    Narrow casting( up-casting ):- Assigning of a subclass instance to a reference variable of type " reference to super class ". Here we navigate from a more detailed view to one with less details.
    Widening Cast( down-cast ):-  Assigning a super class to a sub class. From a less detailed view to more detailed view.
                             SUPER CLASS( vehicle ) less details
                                       |
                                       |
                                       |
                                SUB CLASS ( car, truck, bus, bike ) more details
    PS:- Try to understand the meaning from the example and then go back to the definition in the material.

  • Concept of package in java???

    as far i understood, packages create a namespace.
    In the beginning of a java file i say...
    package pack;then in some other java file I should be able to say...
    import pack.*;am i wrong? by the way both t6he java files are in the same directory. what am i doing wrong. my second program where i import the pack.* does not compile.

    To my understanding, the import statement specifies the class path you are going to refer, and the system will look up these packages in the classpath list you set in the system variable. Usually, the current directory is added to the list.
    For example, there are two classes A and B, and A is packaged in pack. both A and B are located in the directory pack. When you import pack.A, the system will look for pack/A in the current directory, but there is no such directory pack.
    Maybe one solution is to create a new directory pack under pack, and move A under pack/pack. It will look like this
    pack/pack/A
    pack/BA.java
    package pack;
    ......B.java
    import pack.A;
    .......Another solution may include ".." in the classpath variable.
    Maybe you can try!

  • Calling Overloaded procedures in Package

    hi all,
    I have a package
    create or replace package OverLoadedProcs is
    procedure transformDate(mydate date,myno number);
    procedure transformDate(mydate varchar2,myno number);
    procedure transformDate(myno number);
    end OverLoadedProcs;
    I have created Package Body too.
    when i try to call
    SQL> exec OverLoadedProcs.transformDate('26-oct-04',2)
    i am always taken to 2nd procedure.
    IS THERE ANY WAY TO ACCESS THE 1st PROCEDURE?
    Regards,
    S.

    You need to pass that parameter in as a DATE datatype if you want to hit the first procedure:
    sql>create or replace package OverLoadedProcs is
      2    procedure transformDate(mydate date,myno number);
      3    procedure transformDate(mydate varchar2,myno number);
      4    procedure transformDate(myno number);
      5  end OverLoadedProcs;
      6  /
    Package created.
    sql>create or replace package body OverLoadedProcs is
      2    procedure transformDate(mydate date,myno number)
      3    is
      4    begin
      5      dbms_output.put_line( 'First procedure' );
      6    end;
      7     
      8    procedure transformDate(mydate varchar2,myno number)
      9    is
    10    begin
    11      dbms_output.put_line( 'Second procedure' );
    12    end;
    13 
    14    procedure transformDate(myno number)
    15    is
    16    begin
    17      dbms_output.put_line( 'Third procedure' );
    18    end;
    19  end OverLoadedProcs;
    20  /
    Package body created.
    sql>begin
      2    OverLoadedProcs.transformDate(to_date('10/27/2004', 'mm/dd/yyyy'), 3);
      3    OverLoadedProcs.transformDate('10/27/2004', 3); 
      4    OverLoadedProcs.transformDate(3);
      5  end;
      6  /
    First procedure
    Second procedure
    Third procedure
    PL/SQL procedure successfully completed.

  • A doubt about mailing concept

    Hi i just ended up completing mail servlet from where i can send mail through a SMTP and recieve at
    my POP account.Attachments too can be included/downloaded in both cases.
    1>
    The problem is that when i login to pop account and see the messages after it is retrieved
    , i get only new messages and not the ones which have been viewed already as we do in
    Outlook express.When i see them through outlook express first and then go to inbox from my servlet,those messages are not there and i get Empty.
    2>Every time retrieval process starts to show same messages again.
    How to handle this ?.I find illustration of codes in java-mail working in same way .

    If this is the limitation of Javamail as i have not
    seen a single code either in demo or anywhere then i
    would say it is good for nothingIt's not a limitation of Java. You need to understand the POP protocol. I don't think there's a way with POP to read a message and leave it on the server. As far as I know, once you read a message, it comes off the server. You need to manage its storage after that. The IMAP protocol allows you to read a message but leave it on the server. Read up on these protocols, and to through the [url http://java.sun.com/developer/onlineTraining/JavaMail/]JavaMail tutorial

  • Doubt about the concept of HashSet and LinkedHashSet

    I read one of the SCJP 6 exam book, when talking about Set, it gives one definition:
    When using HashSet or LinkedHashSet, the objects you add to them must override hashCode(). If they don't override hashCode(), the default Object. hashCode() method will allow multiple objects that you might consider "meaningfully equal" to be added to your "no duplicates allowed" set.
    What I am getting confused is that IF the objects we add to them must override hashCode(), we must override equals() method also! Isn't it?
    Edited by: roamer on 2009?10?23? ??10:29

    jverd wrote:
    endasil wrote:
    When using HashSet or LinkedHashSet, the objects you add to them must override hashCode(). If they don't override hashCode(), the default Object. hashCode() method will allow multiple objects that you might consider "meaningfully equal" to be added to your "no duplicates allowed" set.This really is completely wrong. Duplicates being added to your set has nothing to do with not overriding hashCode, and everything to do with not overriding equals. No, if you override equals but not hashCode, you can get dupes. That is, two items that your equals method says are equal can make it into the Set.Sorry, to clarify, what I meant by that was that to avoid duplicates of meaningfully equal objects, you must override equals, and overriding hashCode is just a consequent of overriding equals (to maintain the equal objects have equal hashcodes invariant). Overriding hashCode alone will not, and cannot, prevent meaningfully equal duplicates if you don't first define meaningfully equal by overriding equals.
    In summary, it's wrong because
    1) You don't have to override hashCode() if you don't override equals (or rather, don't deviate from the default "two objects are equal if and only if they are the same object").
    2) If you have any other definition of meaningfully equal that you want enforced in a Set, you must override equals to correspond to that definition.
    3) If you override equals, you must override hashCode by the contract of hashCode and equals.
    That's why I was saying that the statement was completely wrong. It's taking a backwards approach.
    By not overriding equals, you're saying that no two separate instances can be meaningfully equal, so the default hashCode is fine. Yeah, I kind of figured for the statement to be meaningful, it is assumed that you have already overridden equals. Otherwise what's the point of even mentioning something two objects "meaningfully equal"?All this talk of "meaningfully equal" makes me think the opposite: that they haven't overridden equals, or haven't discussed it yet. Otherwise you could just say that the objects are equal, or are equal according to equals().
    I would question the authority of the source that said that.I would quesiton the source's ability to express himself clearly. :-)Yeah, maybe that's all it is. In that case, I suggest (to the OP) reading [Effective Java, Chapter 3|http://java.sun.com/developer/Books/effectivejava/Chapter3.pdf]. Best source I've seen for beginners to make sense of all this.
    Edited by: endasil on 26-Oct-2009 1:11 PM

  • Doubt in ooops concept..

    hi,
      I am using NW 7.1 trial version. when I try to do a simple ALV prog in WebDyn .
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
    lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'PRICE' ).
    when I try to execute this error is coming says, "spelling or comma error ?= is not valid" in the particular line where we enter the ?= operator...
    its working in ECC6.0
    kindly tell me the way...

    Hi,
    You should ask your question in the right forum which should be *Web Dynpro Abap".
    You will get better feed back.
    Regards,
    Olivier

  • Doubt on basic  concept

    Say we have a class called Animal which has a method called shout().
    we have another class called Dog which has a method callled bark().
    Dog class extends Animal class.
    so Dog class has 2 methods now
    1)shout()
    2)bark()
    If we declare like this
    Animal a=new Animal();//valid statement
    a.shout();//valid statement
    Dog d=new Dog();//valid statement
    d.shout();//valid statement
    d.bark();//valid statement
    Animal a=new Dog();
    a.shout();//valid statement
    a.bark();//invalid since type of reference variable is Animal
    Dog d=new Animal();
    why the above decalration is not valid?
    Animal object has shout() method
    By inheritance Dog class has both shout() and bark() methods.
    So with above type of declaration d.shout() should execute.But that is wrong.
    A subclass reference variable cannt point to a subclass object.I know this kind of statement.But can any one explain why?

    kirn291 wrote:
    Dog d=new Animal();
    why the above decalration is not valid?To a Dog variable you can only assign objects which are of type Dog, and Animal isn't.
    A Dog object is both of type Dog and of type Animal. This means Dog objects can be assigned to both Dog variables and Animal variables.

  • Doubt Live cache concept

    Hi Guru's
    1.  Coluld any one tell the use of livecache in livecache server.
    2.why it required only for APO sever and why won't we use it in BW server.
    Thanks,
    Pavan

    you can get all the required info on help.sap.com just serch for livecache. and also more information available under SAP liveCache technology

Maybe you are looking for

  • The TV show could not be used because the original file could not be found

    "The TV show “Blah-blah ep.23” could not be used because the original file could not be found. Would you like to locate it?" I know this problem is listed (and unanswered) from quite a few users in the forums for song files, but I haven’t found any t

  • Modifying data in Table Control thr' BDC

    Hi, I have a following requirement. I need to modify(update/delete) the data in the table control through BDC. The number of records of the table control, seen on the screen are only 4. If i need to modify 11th record, how do i go forward? Your help

  • Dual monitor output for Z68MA-ED55 (B3) with IGP ?

    Does Z68MA-ED55 (B3) board support dual or multi monitor output with IGP aka built-in intel HD 2000/3000 ( not with discrete graphic card ) like the  H67 boards ?

  • So Far No Improvement in Spam Protection

    Not seeing any improvement so far with the spam protection in Blog comments, despite the new BC upgrade yesterday that started Akismet spam protection.  Right after the update, I reinitialized my settings in Comments to require Comment Approval and t

  • LabVIEW 8.0 (Prof.Dev.System) and Embedded controller programming?

    Hallo! Can someone please tell me if it is possible with this development system (as it is) to build applications that will run on Adlink Geme-2000 Embedded Controllers (http://www.smallformfactors.com/products/search/fm/id/?17483) ? They run either