Can a function return two values???

Hi guys can a function return more than values?

Or even better return an Object.
ie
public class Tester{
     public static Multi getM()
          Multi m=new Multi();
          m.x="testing";
          m.y="new value";
     public static void main(String [] args)
          Multi mt=getM();
          System.out.println(mt.x);
          System.out.println(mt.y);
     class Multi{
          public String x;
          public String y;
}

Similar Messages

  • I Need to Return Two values or more from Function, Is this possible?

    Below is the offending query, I am trying to pass v_bu and v_po to this function, and after validations then return v_count and v_action is this possible in a function? I am having problem returning two values.
    see below code
    function po_edi_func(v_bu purchase_order.business_unit_id%type,
         v_po purchase_order.purchase_order_number%type)
         return number as pragma autonomous_transaction;
         v_count               number;
         v_ctdel               number;
         v_action          varchar2(1);
    begin
    select count(*)
    into v_count
    from sewn.purchase_order
    where business_unit_id=v_bu
    and purchase_order_number =v_po;
    if v_count > 0 then
         select count(*)
         into v_ctdel
         from sewn.purchase_order
         where business_unit_id=v_bu
    and purchase_order_number =v_po
         and purc_orde_status = 1;
         if v_count <> v_ctdel then -- ALl PO's Cancelled--
         v_action := 'U'; -- - NOT ALL PO DELETED --
         else
         v_action := 'D'; -- DELETED ALL PO--
         end if;
    else
         v_action := 'I';-- New PO INSERT--
    end if;
    commit;
    return v_count;
    end;

    Paul,
    This is becoming a nightmare to me, can you look at the below and tell me where I am having a problem
    This is the Function below
    CREATE OR REPLACE function po_edi_func(v_bu sewn.purchase_order.business_unit_id%type,
         v_po sewn.purchase_order.purchase_order_number%type,v_action_out OUT VARCHAR2)
         return number as pragma autonomous_transaction;
         v_count               number;
         v_ctdel               number;
         v_action          varchar2(1);
    begin
    select count(*)
    into v_count
    from sewn.purchase_order
    where business_unit_id=v_bu
    and purchase_order_number =v_po;
    if v_count > 0 then
         select count(*)
         into v_ctdel
         from sewn.purchase_order
         where business_unit_id=v_bu
    and purchase_order_number =v_po
         and purc_orde_status = 1;
         if v_count <> v_ctdel then -- ALl PO's Cancelled--
         v_action := 'U'; -- - NOT ALL PO DELETED --
         else
         v_action := 'D'; -- DELETED ALL PO--
         end if;
    else
         v_action := 'I';-- New PO INSERT--
    end if;
    commit;
    v_action_out := (lpad(v_count,8,'0')||lpad(v_action,1,' '));
    return v_action_out;
    end;
    and this is how I am calling it from my trigger which has to pass the v_bu and v_po values to be used in extracting data and returning the records
    see below
    if po_edi_func(v_bu,v_po) <> '' then;
    v_count:= (substr(v_action,1,8));
    v_action := substr(v_actione,9,1);
    else
    v_count:=0;
    v_action := 'I';
    end if;
    I need the extracted values of v_count and v_action for my app to reset some values

  • Can oracle  function return more than one value

    Hi All
    please answer can oracle function return more than one value
    need one schenario
    regards

    Can any function, irrespective of the language, return multiple values?
    OF COURSE NOT!!
    So why do you think Oracle will now suddenly do it differently than all other languages? Never mind that it is impossible for a function (a unit/module of code) returning a memory address, to return multiple memory addresses. The machine code that does that, has not been yet been designed/implemented.
    I am continually amazed that this question is asked. It is about something so fundamental in almost every single 3rd and 4th generation language... something that is taught right at the start... the definition of what a procedure and what a function is.
    Sorry, but I simply cannot pull punches on this subject and smooth it over. There is something fundamentally wrong with your training as a programmer if you have to ask such a question about a function.
    And whatever programming skills you build on such a foundation, will be seriously lacking.
    I kindly suggest that you get back to the very basics of programming - and review and revisit until you fully understand it. There are no shortcuts in becomming a good programmer.
    Message was edited by:
    Billy Verreynne

  • Return two values from autosuggest

    hi i have inputtext with autosuggest,i what to return two values when i select the values for example if i select cityname i must return cityname and citypostacode for that city.this is how i did my inputtext autosuggest
    <af:inputText label="#{bindings.Cityname.hints.label}" columns="20"
                                            maximumLength="#{bindings.Cityname.hints.precision}"
                                            id="itc4" simple="true"
                                          value="#{pageFlowScope.orgDetailsBean.addressBean.city}"
                                          partialTriggers="it19" autoSubmit="true"
                                          shortDesc="Enter City Name Or Click Refresh To re-enter City Name">
                                <af:autoSuggestBehavior suggestedItems="#{pageFlowScope.addressbean.oncitySuggest}"/>
                            <af:autoSuggestBehavior/>
                          </af:inputText>
        public List oncitySuggest(String searchCityName) {
        ArrayList<SelectItem> selectItems = new ArrayList<SelectItem>();
            searchCityName = searchCityName.toUpperCase();
        System.out.println(searchCityName);
        //get access to the binding context and binding container at runtime
        BindingContext bctx = BindingContext.getCurrent();
        BindingContainer bindings = bctx.getCurrentBindingsEntry();
        //set the bind variable value that is used to filter the View Object
        //query of the suggest list. The View Object instance has a View
        //Criteria assigned
        OperationBinding setVariable = (OperationBinding) bindings.get("setBind_city");
        setVariable.getParamsMap().put("value", searchCityName);
        setVariable.execute();
        //the data in the suggest list is queried by a tree binding.
        JUCtrlHierBinding hierBinding = (JUCtrlHierBinding) bindings.get("CityViewLOV1");
        //re-query the list based on the new bind variable values
        hierBinding.executeQuery();
        //The rangeSet, the list of queries entries, is of type
        //JUCtrlValueBndingRef.
        List<JUCtrlValueBindingRef> displayDataList = hierBinding.getRangeSet();
        for (JUCtrlValueBindingRef displayData : displayDataList){
        Row rw = displayData.getRow();
        //populate the SelectItem list
        selectItems.add(new SelectItem(
        (String)rw.getAttribute("Cityname"),
        (String)rw.getAttribute("Boxcode"),
        (String)rw.getAttribute("Citycode")));
        return selectItems;
        }

    KK-$$ wrote:
    Now I need 1 more column say, flag something like:
    open o_ref_cursor for select function_name( 2345) Emp_no ,  function_name_2 ( 2345) flag from table1 where x = y;But I don't want to define a new function function_name_2 to get flag value. Because emp_no and flag are both queried from the same table.
    So, Can you tell me how can I make 'function_name' to return two values using appropriate data-type ( or user defined data type?)?Your example could be solved like this (since it is in pl/sql):
    v_emp_no := function_name( 2345);
    v_flag := function_name_2 ( 2345);
    open o_ref_cursor for select v_emp_no Emp_no , v_flag flag from table1 where x = y;But I guess the example was still too simplicistic.

  • PL/SQL: Function returned without value in authentication schemes

    Hi all,
    finally i did the authentication shemes based on my function and my own table ,thank you all for help :-) ,but now when i enter
    1-correct user name &wrong password <it is gonna work,the authentication workin fine >
    i am gonna get <Invalid Login Credentials> which is right in case of wrong login
    2-wrong user name &wrong password <it is not gonna work>
    3-wrong user name &correct password <it not gonna work>
    in case of not working i am getting the following error:
    ORA-06503: PL/SQL: Function returned without value
    Error ERR-10460 Unable to run authentication credential check function.
    any help to solve this issue so that it will display <Invalid Login Credentials>
    in all cases of invalid login
    thanks in advance ,
    Ahmed,

    scott,you efforts was useful and i beleive that the error that i am getting it is from the function that i have can you please take a look on :
    FUNCTION CHECK_USER
    ( P_USERNAME IN varchar2,
    P_PASSWORD IN varchar2)
    RETURN boolean
    IS
    BEGIN
    for c1 in (select user_name, password from vms2_employee_details where user_name = P_USERNAME)
    loop
    if P_PASSWORD = c1.password then
    return true;
    ------dbms_output.put_line('the return from the function is true');
    else
    return false;
    ----dbms_output.put_line('the return from the function is false');
    end if;
    end loop;
    EXCEPTION
    WHEN no_data_found THEN
    return false;
    when others then
    return false;
    ----dbms_output.put_line('the return from the function is false');
    END;
    and tell me what do you think ,
    thanks,
    ahmed

  • ORA-06503: PL/SQL: Function returned without value

    Hello
    Having a bit of a problem with piplined functions.
    Why does this work :
    SET SERVEROUTPUT ON
    DECLARE
    TYPE SARRAY IS TABLE OF VARCHAR2(4000);
    CURSOR CU IS SELECT * FROM DX_XML_ATTENDANCE WHERE STUD_ID = 107777 AND BASE_ID = 94;
    T_STUD NUMBER(10);
    T_BASE NUMBER(10);
    T_DATE DATE;
    T_MARKS VARCHAR2(1000);
    LEN_MARKS NUMBER;
    PDATE DATE;
    SDATE DATE;
    EDATE DATE;
    SLEN NUMBER;
    WEEKLEN NUMBER;
    INIPOS NUMBER;
    MARRAY VARCHAR2(1000);
    SUBARRAY SARRAY := SARRAY();
    SFILL VARCHAR2(14) := '--------------';
    EPOS NUMBER;
    MY_REC     DX_XML_ATTENDANCE%ROWTYPE;
    BEGIN
    SUBARRAY.EXTEND(17);
    DBMS_OUTPUT.ENABLE(100000000);
    --FOR MY_REC IN CU
    OPEN CU;
    LOOP
         FETCH CU INTO MY_REC;
         EXIT WHEN (CU%NOTFOUND);
    T_STUD := MY_REC.STUD_ID;
    T_BASE := MY_REC.BASE_ID;
    T_DATE := TO_DATE(MY_REC.START_DATE, 'DD/MM/YYYY');
    T_MARKS := MY_REC.MARKS;
    LEN_MARKS := LENGTH(T_MARKS);
    EPOS := LEN_MARKS / 2;
    SDATE := ROUND(TO_DATE(T_DATE), 'W') - 1;
    INIPOS := TO_NUMBER(TO_CHAR(T_DATE, 'D'));
    SLEN := INIPOS + 3;
    PDATE := SDATE;
    EDATE := SDATE + EPOS;
    MARRAY := SUBSTR(T_MARKS, 1, SLEN);
    WEEKLEN := LENGTH(MARRAY);
    IF WEEKLEN < 14 THEN
         MARRAY := SUBSTR(SFILL, 1, 14 - WEEKLEN) || MARRAY;
    END IF;
    SUBARRAY(1) := T_STUD;
    SUBARRAY(2) := T_BASE;
    SUBARRAY(3) := PDATE;
    FOR i IN 4 .. 17 LOOP
         SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
    END LOOP;
    DBMS_OUTPUT.PUT_LINE(SUBARRAY(1)||' '||SUBARRAY(2)||' '||SUBARRAY(3)||' '||SUBARRAY(4)||' '||
         SUBARRAY(5)||' '||SUBARRAY(6)||' '||SUBARRAY(7)||' '||SUBARRAY(8)||' '||SUBARRAY(9)||' '||
         SUBARRAY(10)||' '||SUBARRAY(11)||' '||SUBARRAY(12)||' '||SUBARRAY(13)||' '||SUBARRAY(14)||' '||
         SUBARRAY(15)||' '||SUBARRAY(16)||' '||SUBARRAY(17));
    WHILE PDATE < EDATE LOOP
         PDATE := PDATE + 7;
         MARRAY := SUBSTR(T_MARKS, SLEN + 1, 14);
         WEEKLEN := LENGTH(MARRAY);
         IF WEEKLEN < 14 THEN
              MARRAY := MARRAY || SUBSTR(SFILL, 1, 14 - WEEKLEN);
         END IF;
         FOR i IN 4 .. 17 LOOP
              SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
         END LOOP;
         SUBARRAY(3) := PDATE;
    DBMS_OUTPUT.PUT_LINE(SUBARRAY(1)||' '||SUBARRAY(2)||' '||SUBARRAY(3)||' '||SUBARRAY(4)||' '||
         SUBARRAY(5)||' '||SUBARRAY(6)||' '||SUBARRAY(7)||' '||SUBARRAY(8)||' '||SUBARRAY(9)||' '||
         SUBARRAY(10)||' '||SUBARRAY(11)||' '||SUBARRAY(12)||' '||SUBARRAY(13)||' '||SUBARRAY(14)||' '||
         SUBARRAY(15)||' '||SUBARRAY(16)||' '||SUBARRAY(17));
         PDATE := PDATE + 7;
         SLEN := SLEN + 14;
    END LOOP;
    END LOOP;
    END;
    and this does not :
    CREATE OR REPLACE PACKAGE BODY PARSE_ATTENDANCE AS
    FUNCTION ENUM_MARKS(SEL_SQL IN VARCHAR2)
    RETURN TMP_ATT_DATA_TBL PIPELINED
    IS
    V_SQL           VARCHAR(1000):= SEL_SQL;
    V_CURSOR      SYS_REFCURSOR;
    V_ROW          TMP_ATT_HOLDING:=TMP_ATT_HOLDING(NULL, NULL, NULL, NULL);
    T_STUD           NUMBER(10);
    T_BASE           NUMBER(10);
    T_DATE           DATE;
    T_MARKS      VARCHAR2(1000);
    LEN_MARKS      NUMBER;
    PDATE          DATE;
    SDATE          DATE;
    EDATE          DATE;
    SLEN           NUMBER;
    WEEKLEN      NUMBER;
    INIPOS           NUMBER;
    MARRAY           VARCHAR2(1000);
    SUBARRAY      SARRAY := SARRAY();
    SFILL           VARCHAR2(14) := '--------------';
    EPOS           NUMBER;
    BEGIN
    SUBARRAY.EXTEND(17);
    OPEN V_CURSOR FOR V_SQL;
    LOOP
         FETCH V_CURSOR INTO V_ROW.STUD_ID, V_ROW.BASE_ID, V_ROW.START_DATE, V_ROW.MARKS;
         EXIT WHEN V_CURSOR%NOTFOUND;
    T_STUD := V_ROW.STUD_ID;
    T_BASE := V_ROW.BASE_ID;
    T_DATE := TO_DATE(V_ROW.START_DATE, 'DD/MM/YYYY');
    T_MARKS := V_ROW.MARKS;
    LEN_MARKS := LENGTH(T_MARKS);
    EPOS := LEN_MARKS / 2;
    SDATE := ROUND(TO_DATE(T_DATE), 'W') - 1;
    INIPOS := TO_NUMBER(TO_CHAR(T_DATE, 'D'));
    SLEN := INIPOS + 3;
    PDATE := SDATE;
    EDATE := SDATE + EPOS;
    MARRAY := SUBSTR(T_MARKS, 1, SLEN);
    WEEKLEN := LENGTH(MARRAY);
    IF WEEKLEN < 14 THEN
         MARRAY := SUBSTR(SFILL, 1, 14 - WEEKLEN) || MARRAY;
    END IF;
    SUBARRAY(1) := T_STUD;
    SUBARRAY(2) := T_BASE;
    SUBARRAY(3) := PDATE;
    FOR i IN 4 .. 17 LOOP
         SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
    END LOOP;
    PIPE ROW(TMP_ATT_DATA_OBJ(SUBARRAY(1),SUBARRAY(2),SUBARRAY(3),SUBARRAY(4),
         SUBARRAY(5),SUBARRAY(6),SUBARRAY(7),SUBARRAY(8),SUBARRAY(9),
         SUBARRAY(10),SUBARRAY(11),SUBARRAY(12),SUBARRAY(13),SUBARRAY(14),
         SUBARRAY(15),SUBARRAY(16),SUBARRAY(17)));
    WHILE PDATE < EDATE LOOP
         PDATE := PDATE + 7;
         MARRAY := SUBSTR(T_MARKS, SLEN + 1, 14);
         WEEKLEN := LENGTH(MARRAY);
         IF WEEKLEN < 14 THEN
              MARRAY := MARRAY || SUBSTR(SFILL, 1, 14 - WEEKLEN);
         END IF;
         FOR i IN 4 .. 17 LOOP
              SUBARRAY(i) := SUBSTR(MARRAY, i - 3, 1);
         END LOOP;
         SUBARRAY(3) := PDATE;
         PIPE ROW(TMP_ATT_DATA_OBJ(SUBARRAY(1),SUBARRAY(2),SUBARRAY(3),SUBARRAY(4),
         SUBARRAY(5),SUBARRAY(6),SUBARRAY(7),SUBARRAY(8),SUBARRAY(9),
         SUBARRAY(10),SUBARRAY(11),SUBARRAY(12),SUBARRAY(13),SUBARRAY(14),
         SUBARRAY(15),SUBARRAY(16),SUBARRAY(17)));
         PDATE := PDATE + 7;
         SLEN := SLEN + 14;
    END LOOP;
    END LOOP;
    END ENUM_MARKS;
    END PARSE_ATTENDANCE;
    (This is then called like SELECT * FROM
    TABLE(
    PARSE_ATTENDANCE.ENUM_MARKS(
    'SELECT STUD_ID, BASE_ID, START_DATE, MARKS
    FROM DX_XML_ATTENDANCE WHERE STUD_ID = 107777
    AND BASE_ID = 94'))
    I get the same error, around this section near the bottom :
         PDATE := PDATE + 7;
         SLEN := SLEN + 14;
    Can any one help?

    Here is an example. you are missing an return statement.
    SQL> create or replace type varchar2_table is table of varchar2(10) ;
      2  /
    Type created.
    SQL> show errors
    No errors.
    SQL> create or replace function get_data return varchar2_table pipelined is
      2  begin
      3      pipe row(('Test')) ;
      4  end ;
      5  /
    Function created.
    SQL> show errors
    No errors.
    SQL> select * from table(get_data) ;
    ERROR:
    ORA-06503: PL/SQL: Function returned without value
    ORA-06512: at "KKISHORE.GET_DATA", line 3
    no rows selected
    SQL> create or replace function get_data return varchar2_table pipelined is
      2  begin
      3      pipe row(('Test')) ;
    4 return ;
      5  end ;
      6  /
    Function created.
    SQL> show errors
    No errors.
    SQL> select * from table(get_data) ;
    COLUMN_VAL
    Test
    SQL>

  • ORA-06503: Function returned without value at WWV_FLOW_WEBSERVICES_API

    Hi, I use APEX_WEB_SERVICE.MAKE_REQUEST function to call web service however stuck with ORA-06503 exception. It would be nice to hear comment from someone who knows APEX_WEB_SERVICE from inside.
    ORA-06503: PL/SQL: Function returned without value
    ORA-06512: at "APEX_040000.WWV_FLOW_WEBSERVICES_API", line 125
    ORA-06512: at "NEC_VLD.NEC_DVS_WS", line 77
    The error occurs about 60% of my test case calls and always with the same parameter values. I thought something bad on web service side however I've tested it with the same parameter values on SoapUI tool and it works just fine. The parameter itself is fixed length varchar2 variable (e.g. 636BB6EFF19941420F00010000007B00000000000000).
    My environments
    APEX
    4.0.1 - no luck
    upgrade to 4.0.2 - no luck
    plain 4.0.2 install - no luck
    Databases
    10.0.2
    11.0.2
    Procedure to call web service:
    procedure getDocumentByID(
    p_xhdoc in varchar2) is
    l_envelope clob;
    l_resp_msg XMLType;
    begin
    l_envelope := '<?xml version="1.0" encoding="UTF-8"?>';
    l_envelope := l_envelope||'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sap="http://saperion.dvs.affecto.lt/">
    <soapenv:Header/>
    <soapenv:Body>
    <sap:getDocumentByID>
    <id>'||p_xhdoc||'</id>
    </sap:getDocumentByID>
    </soapenv:Body>
    </soapenv:Envelope>';
    l_resp_msg := apex_web_service.make_request(
    p_url => get_ref_value('DVS_DOC_WS_URL'),
    p_action => get_ref_value('DVS_DOC_WS_ACTION'),
    p_envelope => l_envelope,
    p_username => null,
    p_password => null);
    end;
    Regards,
    Tomas

    Never mind sorry! I've just tried granting APEX_040000 permissions for this particular Network ACL and now it works! Can I suggest that apex_web_service.make_request needs some better error handling however.
    Here's the fix...
    BEGIN
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
          acl       => 'mywebservice.xml'
        , principal => 'APEX_040000'
        , is_grant  => TRUE
        , privilege => 'connect'
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(
          acl       => 'mywebservice.xml'
        , principal => 'APEX_040000'
        , is_grant  => TRUE
        , privilege => 'resolve'
      COMMIT;
    END;

  • ORA-06503 Function returned without value

    Hi All,
    I'm getting ORA-06503: PL/SQL: Function returned without value error on this function..... can u guide me where Im going wrong?
    Cheers!
    I
    FUNCTION XX(P_Trial_No IN PATIENT_VISITS.TRIAL_NO%TYPE,
    P_PATIENT_VISIT_NO IN PATIENT_VISITS.PATIENT_VISIT_NO%TYPE) RETURN NUMBER IS
    L_Sequence_No Patient_Visit_Designs.Sequence_No%TYPE;
    BEGIN
    -- Retrieves and returns sequence Number from patient visit designs
    IF p_patient_visit_no IS NOT NULL THEN
    SELECT Sequence_No
    INTO L_Sequence_No
    FROM Patient_Visit_Designs pvd
    WHERE pvd.Trial_No = P_Trial_No AND
    pvd.Patient_Visit_No = P_Patient_Visit_No;
    RETURN L_Sequence_No;
    ELSE
    RETURN NULL;
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END XX;

    CREATE OR REPLACE FUNCTION xx (
       p_trial_no           IN   patient_visits.trial_no%TYPE,
       p_patient_visit_no   IN   patient_visits.patient_visit_no%TYPE
       RETURN NUMBER
    IS
       l_sequence_no   patient_visit_designs.sequence_no%TYPE;
    BEGIN
       l_sequence_no := NULL;
    -- Retrieves and returns sequence Number from patient visit designs
       BEGIN
          IF p_patient_visit_no IS NOT NULL
          THEN
             SELECT sequence_no
               INTO l_sequence_no
               FROM patient_visit_designs pvd
              WHERE pvd.trial_no = p_trial_no
                AND pvd.patient_visit_no = p_patient_visit_no;
          END IF;
       EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             l_sequence_no := NULL;
       END;
       RETURN l_sequence_no;
    END xx;

  • How do I return two values from a stored procedure into an "Execute SQL Task" within SQL Server 2008 R2

    Hi,
    How do I return two values from a
    stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
    Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
    Something like ?
    CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
    @intPeriod INT,
    @strPeriod_Length NVARCHAR(1),
    @dtStart NVARCHAR(8) OUTPUT,
    @dtEnd NVARCHAR(8) OUTPUT
    AS
    then within the SSIS component; -
    Kind Regards,
    Kieran. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
    Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
    Add a script task to check ssis variables values using,
    Msgbox(Dts.Variables("User::strExtractStartDate").Value)
    Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
    Regards, RSingh

  • Whee the function return the value store in java

    in c if i write this program
    int add()
    return 1;
    main()
    add();
    if i run this program it give s error that lvalue required
    but in java it works fine though the function return some value

    in c if i write this program
    int add()
    return 1;
    main()
    add();
    if i run this program it give s error that lvalue
    requiredYou mean, if you try to run it as a C program it gave an error?
    Then take your question to a "C" discussion forum. This is Java.
    >
    but in java it works fine though the function return some value
    In Java this does NOT work fine.
    It definitely does not compile! So you cannot run it.

  • How can a function return a constant reference to an object

    how can a function return a constant reference to an object so that the calling party dont have rights to change it.
    like this example
    class obj = somefunc();
    obj.changeit(); // this line lust give error saying that its read only..
    somefunc()
    return criticalobj;
    in c++ we can achieve this by using the const pointer to the object.. how can we do this in java???

    arun160411 wrote:
    in c++ we can achieve this by using the const pointer to the object.. how can we do this in java???Of course the first thing anyone learns about const pointers is how to cast away constness, so this is completely useless, up there with the chastity movement's thong underwear with the stop sign on it. If you can read this, you're too close!

  • Can a function return more than one item or object?

    Hi I am trying to move text movies and textfields around a stage. This is a learning curve for me. I am confused by an example I have found on the internet.
    http://forums.adobe.com/community/flash/flash_actionscript
    What type of object is
    var letter:Object = getLetterObject(_text.charAt(i));  // in the draw function
    as it has properties
    letter.stepDegrees = _totalAngle / numOfLetters;
    getLetterObject()
    seems to return lotts of stuff which would not be done in other languages like C
    return
    movie:movie,
    field:field,
    widthInDegrees:0,
    fieldWidth:field.width,
    fieldHeight:field.height
    I would like to get my head around this as this is a good example of what I need. Well parts of it actualy.
    I understand that the text field is added as a child to the Movieclip. I would have expected just a MovieClip object returned.
    full code including the function  getLetterObject()
    =======
    package 
    import flash.display.DisplayObject;
    import flash.display.MovieClip;
    import flash.geom.Rectangle;
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.text.TextFormat;
    import flash.text.TextFormatAlign;
    public class CurvedText extends MovieClip
    public static const DIRECTION_UP:String = "up";
    public static const DIRECTION_DOWN:String = "down";
    public var showLetterBorder:Boolean = false;
    public var showCurve:Boolean = false;
    private var _letterHolder:MovieClip;
    private var _text:String;
    private var _radius:Number;
    private var _letters:Array;
    private var _widthOfText:Number = 0;
    private var _startAngle:Number = 0;
    private var _endAngle:Number = 360;
    private var _totalAngle:Number = 0;
    private var _textFormat:TextFormat;
    private var _direction:String;
    public function CurvedText(text:String = "", radius:Number = 200, startAngle:Number = 0, endAngle:Number = 360, direction:String = "up", textFormat:TextFormat = null)
    _text = text;
    _radius = radius;
    _startAngle = startAngle;
    _endAngle = endAngle;
    _direction = direction;
    _textFormat = textFormat;
    _letters = [];
    _totalAngle = Math.abs(_startAngle) + Math.abs(_endAngle);
    public function draw():void
    // checking if there is any text set
    if(_text == "")
    return;
    // clearing the letters' holder
    if(_letterHolder && contains(_letterHolder))
    removeChild(_letterHolder);
    _letterHolder = new MovieClip();
    addChild(_letterHolder);
    // adding letters
    var numOfLetters:int = _text.length;
    for(var i:int=0; i<numOfLetters; i++)
    var letter:Object = getLetterObject(_text.charAt(i));
    letter.stepDegrees = _totalAngle / numOfLetters;
    _letters.push(letter);
    _widthOfText += letter.fieldWidth;
    _letterHolder.addChild(letter.movie);
    // positioning
    position();
    // draw the curve
    if(showCurve) {
    _letterHolder.graphics.lineStyle(1, 0xFF0000, 1);
    _letterHolder.graphics.drawCircle(0, 0, _radius);
    private function getLetterObject(letter:String):Object
    // setting default text format
    if(!_textFormat)
    _textFormat = new TextFormat();
    _textFormat.align = TextFormatAlign.CENTER;
    _textFormat.font = "Verdana";
    _textFormat.size = 12;
    _textFormat.color = 0x000000;
    // creating the field
    var movie:MovieClip = new MovieClip();
    var field:TextField = new TextField();
    field.width = 10;
    field.defaultTextFormat = _textFormat;
    field.embedFonts = true;
    field.multiline = false;
    field.autoSize = TextFieldAutoSize.CENTER;
    field.text = letter;
    field.x = -field.width / 2;
    field.y = -field.height / 2;
    if(showLetterBorder)
    field.border = true;
    movie.addChild(field);
    return  // RETURNS more than one value?
    movie:movie,
    field:field,
    widthInDegrees:0,
    fieldWidth:field.width,
    fieldHeight:field.height
    private function position():void
    // position the letters
    var numOfLetters:int = _letters.length;
    var degrees:Number = _startAngle;
    for(var i:int=0; i<numOfLetters; i++)
    var angle:Number = _letters[i].stepDegrees + degrees;
    if(_direction == DIRECTION_DOWN)
    angle -= 180;
    _letters[i].movie.scaleY = -1;
    } else {
    xValue = _radius * Math.cos((angle-90)/180*Math.PI);
    yValue = _radius * Math.sin((angle-90)/180*Math.PI);
    var xValue:int = _radius * Math.cos((angle-90)/180*Math.PI);
    var yValue:int = _radius * Math.sin((angle-90)/180*Math.PI);
    _letters[i].movie.x = xValue;
    _letters[i].movie.y = yValue;
    _letters[i].movie.rotation = angle;
    degrees += _letters[i].stepDegrees;
    // position the holder
    var bounds:Rectangle = _letterHolder.getBounds(this);
    _letterHolder.x = -bounds.x;
    _letterHolder.y = -bounds.y;
    if(_direction == DIRECTION_DOWN)
    _letterHolder.scaleX = -1;

    Hi
    I still think I need an Object parent child linkage diagram on this to get my head around it.
    It seems that things are reversed so that it is Object:value. Kind of confusing to see movie:movie.
    var letter:Object = getLetterObject(_text.charAt(i));
    letter holds the following objects
    MovieClip:Movie
    TextField:field
    widthInDegrees:0  // What is this. What type is a  widthInDegrees
    fieldWidth:field.width // Same as above
    fieldHeight:field.height  // Same as above
    And to cap it all, back in the calling function draw()
    letter.stepDegrees = _totalAngle / numOfLetters;  //  What is stepDegrees a property of? MovieClip,TextField,widthInDegrees,fieldWidth or fieldHeight
    I can understand the first two but not the last three
    For example widthInDegrees is not mentioned anywhere in the code. and
    letter.stepDegrees // implies that stepDegrees is a property of Object:letter.
    Do you throw a property and value blindly at the letter object and let flash work out which object it is a property of?
    MovieClip & TextField do not have this property. Searched the web for this information. We need an equivelent of MSDN.
    Desmond.

  • Funct return two values

    hi,
    can i make a function return more than one value ?
    thanks.
    n/

    Nicholas said he wanted to use this in Forms 6i. Well, 9i Forms does not support stored procedures that return object values, so I doubt very much that6i does.
    I suggest using a procedure with two OUT parameters:
    PROCEDURE get_default_qty (
    p_supp_id IN edtrad.orcrsupp.supp_id%TYPE
    , p_item_no IN edtrad.orcrstit.stit_item_id%TYPE
    , p_ord_id IN edtrad.orcrodet.odet_order_id%TYPE
    , p_qty OUT NUMBER
    , p_val2 OUT VARCHAR2)
    IS
    qty_not_found EXCEPTION;
    PRAGMA EXCEPTION_INIT ( qty_not_found, -20004 );
    v_qty edtrad.orcrdlvd.dlvd_qty_delivrd%TYPE;
    v_val2 VARCHAR2(9);
    CURSOR qty
    IS
    SELECT vd.dlvd_qty_delivrd, "value_two"
    FROM edtrad.orcrdlvd vd,
    edtrad.orcrodet dt
    WHERE vd.dlvd_supp_id = p_supp_id
    AND vd.dlvd_order_id = p_ord_id
    AND dt.odet_item_id = p_item_no
    AND vd.dlvd_order_id = dt.odet_order_id
    AND vd.dlvd_ord_line_no = dt.odet_line_no ;
    BEGIN
    OPEN qty;
    FETCH qty INTO v_qty, v_val2;
    IF ( qty%NOTFOUND ) THEN
    CLOSE qty;
    RAISE qty_not_found;
    END IF;
    CLOSE qty;
    p _qty := v_qty ;
    p _val2 := v_val2;
    END get_default_qty ;
    Notes
    (1) You must fetch a cursor into a matching set of variables (or define a %ROWTYPE).
    (2) set_default_qty is a bad name for this method. set implies value changing. This method doesn't alter anything, it simply retrieves data. Consequently, it should be called get_default_qty.
    Cheers, APC

  • Can F4IF_INT_TABLE_VALUE_REQUEST FM return a value in a global variable?

    Hi everybody,
    I need to use F4IF_INT_TABLE_VALUE_REQUEST FM because I have to let users select an specific option before choosing another value. The point is that I need to save in a program global variable what the user selects, and decide something with it in the program.
    Is it possible that F4IF_INT_TABLE_VALUE_REQUEST FM returns the value in a sinple variable or it has to be paramter?
    I look in a lot of previous threads but I didn't find anything, and I don't know if it's possible.
    Thanks and kind regards,
    MMP.

    Hi,
    Sure you can. All you need to do is to store what the function returns in your global variable. It don't need to be returned back to screen field.
    DATA: BEGIN OF VALUES OCCURS 0,
             CARRID TYPE SPFLI-CARRID,
             CONNID TYPE SPFLI-CONNID,
           END OF VALUES.
    DATA: VALUES_TAB TYPE TABLE OF VALUES,
              G_VALUE TYPE SPFLI-CONNID.  "global variable to store what is returned
    "in PAI first populate your table
      SELECT  CARRID CONNID
        FROM  SPFLI
        INTO  CORRESPONDING FIELDS OF TABLE VALUES_TAB
        UP TO 10 ROWS.
    "then call the function but don't return the value to screen field
    "If you specify the import parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the useru2019s selection is
    "returned to the corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
    "selection is returned into the table instead.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                RETFIELD         = 'CONNID'
                VALUE_ORG        = 'S'
           TABLES
                VALUE_TAB        = VALUES_TAB
                RETURN_TAB      = RETURN_TAB.
    "now simply read first row of return tab and store the value returned there in some global var
    READ RETURN_TAB INDEX 1.
    MOVE RETURN_TAB-FIELDVAL TO G_VALUE.
    Regards
    Marcin

  • Can Evaluate function return object type

    Hi
    Evaluate function can be used to call db functions in OBIEE. I have a function which returns an object ( pl/sql table).
    Created a simple report in Oracle Answers and added following in one of the columns
    evaluate( 'get_ccid(%1)' as t_ccid , @{p_request})
    When I try to run this in Oracle answers, getting syntax error. If same function returns varchar or number it works well.

    evaluate( 'get_ccid(%1)' as t_ccid , @{p_request})Eakta, You syntax seems to be wrong here. What type of data your presentation variable contains here ?? You are saying its working fine with Number datatype..so can you try..somthing like below with some default value..
    EVALUATE('get_ccid(%1)',@{p_request}{2})
    OR
    EVALUATE('get_ccid(%1)' as varchar(250),@{p_request}{ABC})
    Also, refer
    Syntax for Evaluate function in OBIEE
    http://108obiee.blogspot.com/2009/04/using-presentation-variable-from-first.html
    Hope its useful

Maybe you are looking for