Function Overloading in PL/SQL

Hi Guyz,
I have 2 questions regarding function overloading.
1) Is it necessary for the functions to be inside a package to perform function overloading ?
2) I have 2 functions :-
a) function check_hello( P_INPUT1 VARCHAR2, P_INPUT2 NUMBER) RETURN BOOLEAN
b) function check_hello( P_INPUT1 VARCHAR2, P_INPUT2 NUMBER) RETURN VARCHAR2
The difference is the return type . I dont think this is possible since the signature of the arguments are the same. I just need to confirm that its not possible.
Thanks.

Hi,
user3913664 wrote:
Hi Guyz,
I have 2 questions regarding function overloading.
1) Is it necessary for the functions to be inside a package to perform function overloading ?Yes; stand-alone functions cannot be overloaded.
2) I have 2 functions :-
a) function check_hello( P_INPUT1 VARCHAR2, P_INPUT2 NUMBER) RETURN BOOLEAN
b) function check_hello( P_INPUT1 VARCHAR2, P_INPUT2 NUMBER) RETURN VARCHAR2
The difference is the return type . I dont think this is possible since the signature of the arguments are the same. I just need to confirm that its not possible.Exactly. How could you, the system, or anyone else determine which one to use?
Give them different names, or add another argument if you really want them to have the same name.

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.

  • Error ORA-06502 When using function REPLACE in PL/SQL

    Hi,
    I have a PL/SQL procedure which gives error 'Error ORA-06502 When using function REPLACE in PL/SQL' when the string value is quite long (I noticed this with a string 9K in length)
    variable var_a is of type CLOB
    and the assignment statement where it gives the error is
    var_a := REPLACE(var_a, '^', ''',''');
    Can anyone please help!
    Thanks

    Even then that shouldn't do so:
    SQL> select overload, position, argument_name, data_type, in_out
      2  from all_arguments
      3  where package_name = 'STANDARD'
      4  and object_name = 'LPAD'
      5  order by 1,2
      6  /
    OVERLOAD   POSITION ARGUMENT_NAME                  DATA_TYPE                      IN_OUT
    1                 0                                VARCHAR2                       OUT
    1                 1 STR1                           VARCHAR2                       IN
    1                 2 LEN                            BINARY_INTEGER                 IN
    1                 3 PAD                            VARCHAR2                       IN
    2                 0                                VARCHAR2                       OUT
    2                 1 STR1                           VARCHAR2                       IN
    2                 2 LEN                            BINARY_INTEGER                 IN
    3                 0                                CLOB                           OUT
    3                 1 STR1                           CLOB                           IN
    3                 2 LEN                            NUMBER                         IN
    3                 3 PAD                            CLOB                           IN
    4                 0                                CLOB                           OUT
    4                 1 STR1                           CLOB                           IN
    4                 2 LEN                            NUMBER                         INI wonder what happened?

  • Function overloading advantage..

    Hi,
    One of the package feature is function overloading i.e same name objects with different parameters or different datatype parameters.
    how does it(function overloading) increase the performance ?
    what are the benefits with function overloading ?
    Thanks in advance.
    RP

    how does it(function overloading) increase the performance ?It doesn't.
    what are the benefits with function overloading ?Consider this:
    SQL> CREATE OR REPLACE PACKAGE pkg AS
      2     PROCEDURE print(p IN VARCHAR2);
      3     PROCEDURE print(p IN DATE, msk IN VARCHAR2 := 'DD-MON-YYYY');
      4     PROCEDURE print(p IN NUMBER);
      5     PROCEDURE print(p IN VARCHAR2, totem IN VARCHAR2);
      6  END;
      7  /
    Package created.
    SQL>
    SQL> CREATE OR REPLACE PACKAGE BODY  pkg AS
      2   PROCEDURE print(p IN VARCHAR2) IS
      3   BEGIN
      4    dbms_output.put_line(p||'!');
      5   END;
      6   PROCEDURE print(p IN DATE, msk IN VARCHAR2 := 'DD-MON-YYYY' ) IS
      7   BEGIN
      8    print(to_char(p, msk));
      9   END;
    10   PROCEDURE print(p IN NUMBER) IS
    11   BEGIN
    12    print(to_char(p));
    13   END;
    14   PROCEDURE print(p IN VARCHAR2, totem IN VARCHAR2) IS
    15   BEGIN
    16    print(totem||' '||p);
    17   END;
    18  END;
    19  /
    Package body created.
    SQL>
    SQL> set serveroutput on
    SQL>
    SQL> exec pkg.print(user)
    B!
    PL/SQL procedure successfully completed.
    SQL> exec pkg.print(sysdate)
    07-MAR-2006!
    PL/SQL procedure successfully completed.
    SQL> exec pkg.print(sysdate, 'HH24:MI:SS')
    11:18:59!
    PL/SQL procedure successfully completed.
    SQL> exec pkg.print(1234)
    1234!
    PL/SQL procedure successfully completed.
    SQL> exec pkg.print(user, '>>>')
    B!PL/SQL procedure successfully completed.
    SQL> exec pkg.print(to_char(sysdate), 'HH24:MI:SS')
    HH24:MI:SS 07-MAR-06!
    PL/SQL procedure successfully completed.
    SQL> I can pass any value into my package without having to worry about its datatype. Similarly I can pass different numbers of arguments into the procedure without worrying. Of course, a similar effect can be gained from using default values but we don't always want that.
    Incidentally, note what happened when I passed in a date as a character string.
    Cheers, APC

  • How to test a simple PL SQL function from another PL SQL script

    Hi,
    I have created a function. Now i need to test that whether it is returning the correct values or not.
    For that, i have written anothe pl sql script and trying to call this function. Im passing all the IN parameters in that function. I assume here that OUT parameters will provide me the result. Im trying to display the OUT parameter one by one to see my result.
    I'm using toad as sql client here connected with oracle.
    pl sql script:-
    DECLARE
    BEGIN
         DBMS_OUTPUT.PUT_LINE('$$$$$$$ VINOD KUMAR NAIR $$$$$$$');
         FETCH_ORDER_PRODUCT_DATA(320171302, 1006, 6999,
    ODNumber OUT VARCHAR2, Line_Number OUT VARCHAR2,
    ServiceID OUT VARCHAR2, BilltoNumber OUT VARCHAR2,
    AnnualPrice OUT NUMBER, CoverageCode OUT VARCHAR2)
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ODNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | Line_Number );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ServiceID );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | BilltoNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | AnnualPrice );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | CoverageCode );
    END;
    Function:-
    Program Name : SPOT_Order_Product_Data_For_CFS.sql
    Description : Function to Validate parameters from CFS
    By : Vinod Kumar
    Date : 08/19/2011
    Modification History
    By When TAR Description
    CREATE OR REPLACE FUNCTION FETCH_ORDER_PRODUCT_DATA(orderNumber IN VARCHAR2, customerNumber IN VARCHAR2,
    productLine IN VARCHAR2, ODNumber OUT VARCHAR2,
    Line_Number OUT VARCHAR2, ServiceID OUT VARCHAR2,
    BilltoNumber OUT VARCHAR2, AnnualPrice OUT NUMBER,
    CoverageCode OUT VARCHAR2)
    RETURN VARCHAR2 IS
    lv_err_msg VARCHAR2(100) := '';
    lv_bucket_id VARCHAR2(14);
    lv_bill_number VARCHAR2(30);
    lv_anual_price NUMBER;
    lv_coverage_code VARCHAR2(8);
    lv_quote_num NUMBER(10) := NULL;
    lv_line_num NUMBER(5) := 0;
    lv_customer_number VARCHAR2(30) := customerNumber;
    lv_product_id VARCHAR2(14) := productLine;
    lv_count_quote NUMBER := 0;
    lv_quote_status VARCHAR2(5);
    lv_quote_version NUMBER(2):=0;
    BEGIN
    IF INSTR(orderNumber, '-') = 0 THEN
    lv_quote_num := orderNumber;
    ELSE
    lv_quote_num := SPT_Delimiter(orderNumber, 1, '-');
    lv_line_num := SPT_Delimiter(orderNumber, 2, '-');
    END IF;
    --Check status of the quote COM, APP
    SELECT COUNT(*) INTO lv_count_quote FROM sot_order_header WHERE ORDER_NUMBER=lv_quote_num
    AND ORDER_STATUS IN ('APP', 'COM') AND CUSTOMER_NUMBER = lv_customer_number;
    IF lv_count_quote = 0 THEN
    lv_err_msg := 'Invalid Order number';
    RETURN lv_err_msg;
    END IF;
    -- Fetch the latest version on SPOT quote
    SELECT MAX(VERSION_NUMBER) INTO lv_quote_version FROM SPT_QUOTE_HEADER WHERE QUOTE_NUMBER = lv_quote_num
    AND CUSTOMER_NUMBER = lv_customer_number;
    -- If quote is valid fetch the data in OUT parameters
    IF lv_line_num = 0 THEN
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.LINE_NUMBER, b.BUCKET_ID,
    b.ANNUAL_REF_RATE_USD, b.COVERAGE_CODE
    INTO lv_bill_number,lv_line_num,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
    lv_err_msg := 'Multiple PIDs existing in the SPOT order, please provide the SPOT order + line number as input data';
    RETURN lv_err_msg;
    END;
    ELSE
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.BUCKET_ID, b.ANNUAL_REF_RATE_USD,
    b.COVERAGE_CODE
    INTO lv_bill_number,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id
    AND b.LINE_NUMBER = lv_line_num;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
              lv_err_msg := 'Multiple SPOT lines exist with same parameter';
              RETURN lv_err_msg;
    END;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    lv_err_msg := '@@@ EXCEPTION THROWN @@@ '|| SUBSTR(SQLERRM,1,120);
    RETURN lv_err_msg ;
    END;
    Don't look at the function, it might have errors but my primary concern is how to test this function. Once I start doing its testing then only i can understand any bugs(if any).
    My pl sql is not so good. Im still learning. I don't understand IN and OUT parameters are.
    I just know that IN parameters r those whick we pass in to the function wen we call it and OUT parameters are those through which we get the result.
    Thanks in advance
    Vinod Kumar Nair

    20100511 wrote:
    I wondered how I could test the output of the function from within TOAD?I usually create the following function in my developer schema:
    create or replace function BoolToChar( b boolean ) return varchar2 is
    begin
      if b then
        return( 'TRUE' );
      else
        return( 'FALSE' );
      end if;
    end;To test a function like yours, the following will do in SQL*Plus/TOAD/etc:
    begin
      DBMS_OUTPUT.put_line(
        BoolToChar( XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934)  )
    end;
    I'm probably doing 101 things wrong here, but thought I'd ask anyway and risk being shouted at.Shout at? You reckon? I thought people risked being beaten with a lead pipe, or pelted with beer cans and stale pretzels - which makes being shouted at a really safe and viable alternative. {noformat};-){noformat}

  • Function as Attribute in SQL raising error

    I have a problem
    I have a stored procedure 'test_p' and a function 'test_sub'. The Stored Procedure 'test_p' calls function 'test_sub' from a SQL. What I'd like to have is the error from the function to be raised to the 'parent' stored procedure. What happens is, the error occurs in the function. The SQL will therefore not be executed, but code in the stored procedure after the sql will still be executed. It seems that errors from a function called in a sql won't have any impacts to the errorhandling in the stored procedure. Besides that the value of the variable v_errorcode in the stored procedure after the call to the function is still 0 event tough i fill the variable in the exception case in the function.
    Anybody has an idea how to raise the error from the underlying function to the stored procedure and whats wrong why the value of the variable v_errorcode in the stored procedure is still 0 after the function call ?
    Appreciated urs
    create or replace PACKAGE pkg_test IS
    v_errorcode NUMBER;
    v_errormsg VARCHAR2(200);
    --cursor
    TYPE tc_ref_cursor is REF CURSOR;
    --general types
    SUBTYPE t_nav_type is VARCHAR2(1);
    FUNCTION test_sub(
    p_c_test IN VARCHAR2) return NUMBER;
    PROCEDURE test_P(
    p_nav_type IN t_nav_type,
    p_ref_cur IN OUT tc_ref_cursor
    end pkg_test;
    show errors;
    create or replace PACKAGE BODY pkg_test IS
    PROCEDURE test_P(
    p_nav_type IN t_nav_type,
    p_ref_cur IN OUT tc_ref_cursor)
    is
    x number;
    e_nomultyccyfound EXCEPTION;
    begin
         DBMS_OUTPUT.PUT_LINE('Errorcode before initialize : ' || v_errorcode);
         v_errorcode := 0;
    open p_ref_cur for
    select test_sub('E') as tee from dual;
    DBMS_OUTPUT.PUT_LINE('This Output in case of errorraising of test_sub sould not be shown');
    DBMS_OUTPUT.PUT_LINE('Errorcode raised from function test_sub : ' || v_errorcode);
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('Error Package');
    RAISE;
    end test_P;
    function test_sub(
    p_c_test IN VARCHAR2
    ) return NUMBER
    as
    retval NUMBER;
    e_nomultyccyfound EXCEPTION;
    begin
    retval := 0;
    if p_c_test = 'E' then
         raise e_nomultyccyfound;
    end if;
    RETURN retval;
    exception
    when e_nomultyccyfound then
         v_errorcode := -20200;
         v_errormsg := 'Error in Function';
    RAISE_APPLICATION_ERROR(-20200,'Error in Function');
    when OTHERS then
    retval := 0;
    return retval;
    end test_sub;
    end pkg_test;
    show errors;

    Hi,
    Call your Function independently.In your code FUNCTION
    is not getting executed , so you are not seeing the
    error getting raised.
    In your code change
    open p_ref_cur for select test_sub('E') as tee from dual;
    to
    x := test_sub('E');
    Now call your procedure and you will find the correct results which you are expecting.
    Regards,
    Arun M

  • Analyze: PL/SQL function body returning an SQL query

    I need to obtain the final SQL returned by the PL/SQL function.
    I will be using this final SQL in a procedure.
    Please provide some advise on how to obtain the SQL. I have already looked in the DBMS_SQL package but I am not sure if that is the right place to look into.
    Regards,
    Sumit

    I am trying to modify the export_to_excel package from Denes kubicek to provide me an excel from PL/SQL function body returning an SQL query.
    Here is the simplified PLSQL code in the region source.
    declare
    l2 varchar2(2000) null;
    begin
    l2:= 'Select NAME,ORIGINATED,OWNER,ORIGINATOR,';
    l2:= l2 || 'DESIGNATED_UNIT,SOURCE,';
    l2:= l2 || 'REFERENCE';
    l2:= l2 || ' from MV_DETAILED_DATA';
    return l2;
    end;
    I would like to get the SQL returned from this PLSQL and use it in a procedure to get the Excel.
    As you mentioned earlier "copy the generated query string into an application item". [ +In the PL/SQL function body returning an SQL query, copy the generated query string into an application item. The app item value can then be passed as a parameter value to the procedure+ ]
    I do not know how to dynamically excute this PLSQL in the region source and obtain the returned value in my procedure.
    Best Regard,
    Sumit.

  • Log Function behaving diffently in SQL vs Pl/SQL

    Hello
    This equation works OK in SQL but its implementation in PL/SQL throws an error:
    SELECT CAST(LOG(2,32) as FLOAT) FROM DUAL;
    Returns: 5
    vs
    x FLOAT := 0;
    x := CAST(LOG(2,32) as FLOAT) ;
    PLS-00382: expression is of wrong type
    Incidentally I ran into a situation where LOG(2,32) return 5 in SQL but returns 4 where formatted TRUNC(LOG(2,32),0)
    Any assistance would be appreciated

    [email protected] wrote:
    This is not so much specific to LOG function. More a so "rounding behavior" of SQLPLUS due to environment default settings.??? It has nothing to do with rounding. You'll get same PLS-00382 for pretty much any built-in function:
    SQL> declare
      2  x FLOAT := 0;
      3  begin
      4  x := CAST(LOG(2,32) as FLOAT) ;
      5  end;
      6  /
    x := CAST(LOG(2,32) as FLOAT) ;
    ERROR at line 4:
    ORA-06550: line 4, column 11:
    PLS-00382: expression is of wrong type
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    SQL> declare
      2  x FLOAT := 0;
      3  begin
      4  x := CAST(POWER(2,32) as FLOAT) ;
      5  end;
      6  /
    x := CAST(POWER(2,32) as FLOAT) ;
    ERROR at line 4:
    ORA-06550: line 4, column 11:
    PLS-00382: expression is of wrong type
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    SQL> declare
      2  x FLOAT := 0;
      3  begin
      4  x := CAST(mod(3,2) as FLOAT) ;
      5  end;
      6  /
    x := CAST(mod(3,2) as FLOAT) ;
    ERROR at line 4:
    ORA-06550: line 4, column 11:
    PLS-00382: expression is of wrong type
    ORA-06550: line 4, column 1:
    PL/SQL: Statement ignored
    SQL> Oracle still maintains two separate engines for SQL and PL/SQL. And the above bug is obviously related to that. Now same built-in function has separate implementation SQL and PL/SQL. In PL/SQL it is package STANDARD. At first I thought it is where bug manifests itself. However:
    SQL> SELECT CAST(sys.standard.LOG(2,32) as FLOAT) FROM DUAL;
    CAST(SYS.STANDARD.LOG(2,32)ASFLOAT)
                                      5
    SQL> So most likely bug is caused by FLOAT implementation in PL/SQL.
    SY.

  • Function Call returning old SQL Query

    Hello All,
    I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. Inside this function, once the SQL is built, I am inserting this SQL into a log table, for logging purpose.
    Note: my function has only one parameter which is a string. This string accepts a name:value pairs with a delimiter which I breakdown inside the function. But this functionality is working fine.
    Issue:
    When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
    </code>
    When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
    </code>
    When I open the logs, I see the SQL being built is the earlier one.
    As a test I closed the session and ran (Age = 20, Gender = F) first. It works fine. When I run a different parameter string, it always mimics the earlier function call.
    Is CACHING in play here. I tried both the following:
    <code> dbms_result_cache.bypass(FALSE);
    dbms_result_cache.flush;
    </code>
    I tried multiple tests, with different parameters and only the first one runs fine and second one copied the earlier. However, when I open two sessions on two different windows it doesn't happen.
    Also, in the Logging table I am capturing the input string as a confirmation, which is coming correctly. But the SQL being build mimics the earlier call.
    I tried to set the variable which hold the SQL Statement to empty (v_sql := '';) at the beginning and also at the end. Still no use.
    Kindly help if I am over looking anything.
    Regards,
    Aj

    Aj09 wrote:
    I have a Pipeline Function which creates a SQL within (Dynamic SQL that gets stored in a LONG variable) based on the parameter STRING passed to the function. The LONG data type has been replaced by the LOB data type. Oracle specifically recommends not using the old LONG data type.
    Issue:
    When I run the function with parameter with a STRING say (Age = 20, Gender = M) for the first time, it works.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:M'));
    </code>
    When I change the parameters to (Age = 20, Gender = F), it gives me the results of the earlier function call.
    <code>SELECT * FROM TABLE (
    PIPE_FUN_SEARCH_PKG.get_search_records ('EMP_AGE:20|EMP_GENDER:F'));
    </code>The tag is ** - not *<code>*.
    Why a pipeline function? Why dynamic SQL? Are you using +DBMS_SQL+ to create the dynamic cursor? If not, why not? Only +DBMS_SQL+ allows dynamic binding in PL/SQL. Without that, your code will burn a lot of additional CPU on hard parsing and trash and fragment Shared Pool memory.
    When I open the logs, I see the SQL being built is the earlier one.
    How do you record the current SQL? Are you using a static variable to capture the SQL statement generated?
    From what you have described - this is yet another horribly flawed approach in all respects. To data modelling. To relational databases. To Oracle. To SQL.
    Reinventing the SQL language for data retrieval as a pipeline function using a funky parameter interface - sorry, I just don't get that. It is an insane approach.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Will ellipsis contradict function overloading

    Recently I was reading the Oracle tech magazin. There was an article in it about the next java major release ( J2SE 1.5 tiger). It said the tiger release will support the ellipsis ("...") concept for parameter passing. I have seen this in C/C++ for passing variable number of arguments in functions like printf() or scanf(). I am not sure has there such a concept already in java but if we are going to have such a mechanism, wont that affect the function overloading concept? Please post ur opinions
    thanks
    boolee

    The method will have a signature ending in (I think the current spec says) Object[], so it shouldn't affect the method overloading much.

  • Function overloading in flex?

    Hi
    Is it possible to function overloading in flex?
    Any send me example.
    Regards
    D.Mahesh Babu

    ActionScript aims to follow the EcmaScript 4 language specification which does not include method overloading. The two have diverged somewhat because EcmaScript 4 is still in a proposal stage and is subject to change. Read more here:
    http://en.wikipedia.org/wiki/ECMAScript
    A proposed EcmaScript feature called generic functions may offer capabilties similar to method overloading. It is possible such a feature may find its way into ActionScript 4, but I'm not aware of any official announcements to that effect.

  • Avoid procedure or function calls between a SQL operation and an implicit cursor test

    when i analyse this code with code expert

    atpidgeon wrote:
    when i analyse this code with code expert
                            UPDATE P_PM_CONTROL_COUNT
                            SET AVAIL_SEG = AVAIL_SEG -1,
                                ALLOCATION = ALLOCATION -1
                            WHERE PM_UNIT_TYPE_ID = vrectab(1)
                            AND USAGE_DATE = vrectab(2)
                            AND SEGMENT_CODE = vrectab(5)
                            AND ALLOCATION - UNITS_RESERVED > 0;
                            IF sql%rowcount = 0 then --Added block and exception to prevent invetory going negative when placing multi units in same unit type out of service.
                                vErrMsg := 'Could not process your out of service request because your selection for unit '|| vrectab(3) || ' at ' || pvPropertyId || ' for ' || vrectab(2) || ' would cause segment ' || vrectab(5) || ' to be over allocated.';
                                RAISE SegOverAllocated;
                            END IF;
    i get "Avoid procedure or function calls between a SQL operation and an implicit cursor test.",as far has i know
    iff you're doing a sql%rowcount    after an update.. trying to see how many rows were updated...  you dont want procedure or function calls between the update and the sql% line
    correct me if im wrong and how would i fix it?or maybe i shouldnt
    You correct it by NOT executing function calls as part of the UPDATE statement.
    1. Issue the function calls BEFORE the update statement
    2. save the function results into variables
    3. use those variables in the UPDATE statement.
    v_rectab1 := vrectab(1);
    v_rectab2 := vrectab(21);
    v_rectab5 := vrectab(5);
    UPDATE P_PM_CONTROL_COUNT 
                            SET AVAIL_SEG = AVAIL_SEG -1,
                                ALLOCATION = ALLOCATION -1
                            WHERE PM_UNIT_TYPE_ID = v_rectab1
                            AND USAGE_DATE = v_rectab2
                            AND SEGMENT_CODE = v_rectab5
                            AND ALLOCATION - UNITS_RESERVED > 0;

  • How can i migrate Power Builder 8.0 Function into oracle PL/SQL

    Hi Oracle Experts...
    How can i migrate Power Builder 8.0 Function into oracle PL/SQL.. I had migrate some of the coding from PB to PL/SQL. But i don't know how can i convert PB structure(here structure is a data type) into oracle PL/SQL.
    Instead of structure what is the equivalent in oracle plsql
    Below i pasted my POWER BUILDER FUNCTION:
    Long ll_perd,ll_lnperd,ll_mon,ll_effmon,ll_instno,ll_odno
    Decimal{5} ldl_actual,ldl_diff,ldl_inst
    Datetime ldt_first,ldt_exp,ldt_oddt, ldt_lastprod
    String ls_instmode,ls_inst
    str_batch lstr_od //Structure to store odamt and oddate
    Select pay_c_final,lon_d_expiry, lon_d_lastprod
    Into     :ls_inst,:ldt_exp, :ldt_lastprod
    From      loan_mast
    Where branch_c_code = :gs_branch and
              act_c_type      = :as_actype and
              act_c_no           = :as_acno;
    If Sqlca.Sqlcode = -1 Then
         f_message('FT-0189',Sqlca.Sqlerrtext)
         lstr_od.batchslno = -1
         Return lstr_od
    End If
    If adt_prodt > ldt_exp Then
         Select Ceil(months_between(:adt_prodt,:ldt_exp)) Into :lstr_od.batchslno From dual;
         lstr_od.cheqdt = ldt_exp
         lstr_od.batchslno = DaysAfter(Date(ldt_lastprod), Date(adt_prodt))
    Else
         If ls_inst = 'N' Then
              If adt_prodt > ldt_exp Then
                   Select Ceil(months_between(:adt_prodt,:ldt_exp)) Into :lstr_od.batchslno From dual;
                   lstr_od.cheqdt = ldt_exp
              Else
                   lstr_od.batchslno = 1
              End If
         ElseIf ls_inst = 'Y' Then
              Select first_d_due,lon_c_instperd,lon_n_perd
              Into     :ldt_first,:ls_instmode,:ll_lnperd
              From     loan_mast
              Where branch_c_code = :gs_branch and
                        act_c_type      = :as_actype and
                        act_c_no          = :as_acno;
              If Sqlca.Sqlcode = -1 Then
                   f_message('FT-0189',Sqlca.Sqlerrtext)
                   lstr_od.batchslno = -1
                   Return lstr_od // Return Structure
              End If
              Select Ceil(months_between(:adt_prodt,:ldt_first)) Into :ll_mon from dual;
              If ll_mon > 0 Then
                   Select Nvl(ln_n_balance,0),Nvl(ln_n_instlamt,0),Nvl(ln_n_instlno,0)
                   Into     :ldl_actual,:ldl_inst,:ll_instno
                   From     loan_inst_sch
                   Where act_c_type = :as_actype and
                             act_c_no     = :as_acno and
                             ln_d_effdate = (Select Max(ln_d_effdate)
                                                           From     loan_inst_sch
                                                           Where act_c_type = :as_actype and
                                                                     act_c_no     = :as_acno and
                                                                     ln_d_effdate < :adt_prodt);
                   If Sqlca.Sqlcode = -1 Then
                        f_message('FT-0224', Sqlca.Sqlerrtext)
                        lstr_od.batchslno = -1
                        Return lstr_od
                   ElseIf Sqlca.Sqlcode = 100 Then
                        lstr_od.batchslno = 1
    *                    Return lstr_od*
                   End If
                   If adl_bal > ldl_actual Then
                        If ldl_inst > 0 Then
                             lstr_od.batchslno = (adl_bal - ldl_actual) / ldl_inst
                        End If
                   Else
                        lstr_od.batchslno = 1
                   End If     
                   If lstr_od.batchslno = 0 Then lstr_od.batchslno = 1
                   //For full OD
                   If ll_mon > ll_lnperd Then
                        lstr_od.batchslno = (ll_mon - ll_lnperd) + lstr_od.batchslno
                   End If
                   If ls_instmode = 'Q' Then
                        lstr_od.batchslno = lstr_od.batchslno * 3
                   ElseIf ls_instmode = 'H' Then
                        lstr_od.batchslno = lstr_od.batchslno * 6
                   ElseIf ls_instmode = 'Y' Then
                        lstr_od.batchslno = lstr_od.batchslno * 12
                   End If
                   Select :adt_prodt - :lstr_od.batchslno Into :lstr_od.cheqdt From dual;
                   If ls_instmode = 'M' Then
                        ll_odno = ll_instno - lstr_od.batchslno // To get OD Date
                        Select ln_d_effdate
                        Into     :lstr_od.cheqdt
                        From     loan_inst_sch
                        Where act_c_type = :as_actype and
                                  act_c_no     = :as_acno and
                                  ln_n_instlno = :ll_odno;
                        If Sqlca.Sqlcode = -1 Then
                             f_message('FT-0224', + Sqlca.Sqlerrtext)
                             lstr_od.batchslno = -1
                             Return lstr_od
                        End If
                   End If
              Else
                   lstr_od.batchslno = 1
              End If
         End If
    End if
    Return lstr_od
    Thanks in adance
    Arun M M

    What are you going to return the structure to? What I would normally use here if the code was going to be used by other PL/SQL would be a PL/SQL object type.
    However, if PowerBuilder is still in the equation (you're moving the logic to PL/SQL but keeping PowerBuilder for the GUI ), then you'll have to return something else, because PowerBuilder doesn't understand PL/SQL object types. Perhaps passing a REF CURSOR as a OUT argument and populating it from the procedure. PowerBuilder could then retrieve the result of the procedure using a stored procedure based DataWindow.

  • Function overloading ... Is there any benefit ?

    Where is the benefit if I write this ..
    using function overloading :
    add(Integer, Integer);
    add(String, String);
    instead of
    addInt(Integer, Integer);
    addStr(String, String);
    Is there any benefit ?

    why you are saying "add() *does not contain an argument type name*"?The statement that you are still claiming to find unclear was 'embed the argument type names in the function name'. The function name 'add()' doesn't do that. Your alternative function name 'addInt() does do that. 'Int'. A type name. Embedded in the function name.
    Am I missing something ?Yes. I don't see how you can agree that add() is shorter than addInt() without also seeing that the difference consists precisely of the embedded type name. Frankly, I don't think you have been reading very carefully.

  • Function Overloading in sql

     is there any way by which one can over load function with out affecting any change in .net code or sql proc or function which refer that function

    No, there is no way to "overload" a function.
    However, what you are describing can be done by creating a layer of stored procs and views the .Net code calls instead of direct accessing the database.  This gives the SQL developer the ability to change the physical database and change the layer
    to match the same output, without changing the .Net code.
    See "Stored procedures vs dynamic SQL":
    http://msdn.microsoft.com/en-us/library/ee658127.aspx

Maybe you are looking for

  • Issue with Trading Partner Identification - Files are not picked

    Hi, As per user guide and also the following note http://www.oracle.com/technology/products/integration/b2b/pdf/B2B_TN_013_EDI_VAN_Identify_TP_based_on_ ISA_GS_ID.pdf I did uncomment the following line #oracle.tip.adapter.b2b.edi.identifyFromTP = Int

  • ITunes does not recognize ripped CDs-- Help!

    Last night, I ripped (or imported, whatever term you'd like to use) The Wall by Pink Floyd into my iTunes library, and everything was perfectly fine (in fact, i'm listening to it from my library right now).  However, tonight when I tried to rip the r

  • 3rd Generation iPod shows "plug" icon and arrow after restore

    ...and nothing else. Attempts to turn it on result in the apple logo appearing and then the plug, then it dies. Tried plugging it into the computer. Tried plugging it into the wall. Nothing. Won't go into disk mode. Any ideas? Thanks in advance...

  • Uploading Picture or image in to CRM Product

    Hi to All, I want to upload picture or image in to CRM product. what r the steps to get image in to CRM product.

  • Is RADIUS and other external auth unsecure?

    I just finished setting up RADIUS on our database. As best as I can tell, the client is the one doing the authentication...I'm guessing this because if I have my SID setup for the RADIUS controlled database (with user identified externally) with the