Error in assigning value to local variable

i am writing a stored procedure in which i have pass parameter if parameter value is zero then i assign a previously declared variable null else that value
syntax is this
create or replace
PROCEDURE usp_Add_Update_Insurance
p_CityID IN NUMBER DEFAULT NULL
as
v_CityID number(10,0);
begin
IF p_CityID = 0 THEN
BEGIN
v_CityID := NULL;-----giving error in this line
else
v_CityID:=p_CityID;
END;
END IF;
end
begin
///some query
end
please help someone

I think there is no added value by putting those Begin/End.
The simplest solution is just remove them
Create Or Replace
Procedure Usp_Add_Update_Insurance (
     P_Cityid In Number Default Null
) As
     V_Cityid Number(10,0);
Begin
     If P_Cityid = 0 Then    
          V_Cityid := Null;
     Else
          V_Cityid:=P_Cityid;
     End If;
     -- do something with V_Cityid    
End; The only reason for having Begin/End is if you want to catch some exceptions or perform some strange local variable declarations. But it does not seems to be case here.
MJ

Similar Messages

  • Can we assign value to a variable in PL/SQL Loop

    Hi
    Can we assign value to a variable in PL/SQL Loops?
    DECLARE
    V_Num NUMBER;
    BEGIN
    LOOP
    V_Num := 10;
    DBMS_OUTPUT.put_line(V_num);
    V_Num := V_Num - 1;
    EXIT WHEN V_Num = 0;
    END LOOP;
    END;
    In the above program, Can we assign V_num with a value 10????????
    Thanks & Regards,
    Hari Babu
    Edited by: 1004977 on Jun 5, 2013 2:40 AM

    Hi,
    1004977 wrote:
    Hi
    Can we assign value to a variable in PL/SQL Loops?
    DECLARE
    V_Num NUMBER;
    BEGIN
    LOOP
    V_Num := 10;
    DBMS_OUTPUT.put_line(V_num);
    V_Num := V_Num - 1;
    EXIT WHEN V_Num = 0;
    END LOOP;
    END;
    In the above program, Can we assign V_num with a value 10????????Yes; the example you posted does that.
    When the loop starts, the value 10 is assigned to v_num. You should see that value displayed by the put_line statement.
    After that, v_num is set to 10 - 1 = 9.
    Next, the EXIT condition is evaluated. At this point, v_num is 9, not 0, so the loop runs again. V_num is set to 10 again, and the loop continues forever (or, in some versions, until the dbms_output buffer is filled and an error occurs.)

  • Assigning value to a variable.

    i have one doubt.
    we can assign value to a variable either in declaration section or in exectuion section.
    so please explain when and wherer should we assign value to a variable.
    thank you very much.

    I think the best way to look at it is...
    If you don't want your variable(s) to have default values that are NULL, assign a value in the declaration section, otherwise assign it where you feel like.
    If you take an example of:
    declare
      v_sum number := 0; -- default variable to 0
      cursor cur_test is
    begin
      for i in cur_test
      loop
        v_sum := 0; -- set variable to 0 before the loop
        loop
          exit when .. some condition ..
          v_sum := v_sum + ..
        end loop;
      end loop;
    end;
    /.. we have a need to set the variable v_sum to 0 before each iteration of the internal loop, so there's little point in having it defaulted to 0 in the declaration section, hence I wouldn't typically default it there and would typically have the code as..
    declare
      v_sum number; -- no point in defaulting it
      cursor cur_test is
    begin
      for i in cur_test
      loop
        v_sum := 0; -- set variable to 0 before the loop
        loop
          exit when .. some condition ..
          v_sum := v_sum + ..
        end loop;
      end loop;
    end;
    /It all depends on what you're doing and what seems the most logical or preferred option.
    Defaulting values in the declaration section can let you see clearly what the starting values are for things, but only if you really need to do it.

  • Assign value to ODI variable from Jython

    Hello Experts,
    I have a procedure where I'm using Jython code. I want to assign a value to an ODI project variable from a Jython function:
    Example:
    #COUNTER = len(v_jythonList) ---> being #COUNTER the ODI project variable and len() the jython function
    Now, i noticed that using ODI variables adds # sign which is use for comments in Jython code. Is there a way to assign values to ODI variables from Jython script?
    Please help!.
    Thanks.
    Pablo.

    Hi,
    Does this post help you :- How to assign value for a ODI variable from Jython Script
    Doc id 424579.1 on metalink should help.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Best way to get the values of local variables

    What is currently the best way to get the values of local variables. I know it is not currently possible to set watchpoints on local variables, but what are the best workarounds?

    You have to use StackFrame methods, eg, visibleVariables and getValues. To get a StackFrame for a thread, that thread has to be suspended, eg, by a BreakpointEvent.

  • Cannot assign value to a Variable of Complex Type beyond index 1

    Hello:
    I have a variable defined as a complex type as followed. I tried to assign a value to each of the two elements but it only allows me to assign to the 'element#1.
    This statement that tries to assign a value into element#2 will not work, if I assign with '[1]' for the first element it will work:
    <copy> <---- THIS WORKS
    <from expression="'John'"/>
    <to variable="My_Variable"
    part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item[1]/ns9:pname"/>
    </copy>
    <copy> <---- THIS DOES NOT WORK
    <from expression="'John'"/>
    <to variable="My_Variable"
    part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item[2]/ns9:pname"/>
    </copy>
    Is there something wrong with my definition below that allows only element#1 to be refererenced but not element#2???? Am I missing some kind of initialization that is needed to initialize both elements????
    Here are my message and Complex Type definitions:
    <variable name="My_Variable" messageType="ns8:args_out_msg"/>
    <message name="args_out_msg">
    <part name="My_Collection" element="db:My_Collection"/>
    </message>
    <element name="My_Collection">
    <complexType>
    <sequence>
    <element name="Collection" type="db:Collection_Type" db:index="2" db:type="Array" minOccurs="0" nillable="true"/>
    <element name="Ret" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    <complexType name="Collection_Type">
    <sequence>
    <element name="Collection_Item" type="db:Collection_Type_Struct" db:type="Struct" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
    </sequence>
    </complexType>
    <complexType name="Collection_Type_Struct">
    <sequence>
    <element name="pname" db:type="VARCHAR2" minOccurs="0" nillable="true">
    <simpleType>
    <restriction base="string">
    <maxLength value="25"/>
    </restriction>
    </simpleType>
    </element>
    </sequence>
    </complexType>
    The error msg it gives me is as followed:
    [2010/09/04 00:47:59] Error in <assign> expression: <to> value is empty at line "254". The XPath expression : "" returns zero node, when applied to document shown below:less
    oracle.xml.parser.v2.XMLElement@1fa7874
    [2010/09/04 00:47:59] "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.less
    -<selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    -<part name="summary">
    <summary>
    XPath query string returns zero node.
    According to BPEL4WS spec 1.1 section 14.3, The assign activity &lt;to&gt; part query should not return zero node.
    Please check the BPEL source at line number "254" and verify the &lt;to&gt; part xpath query.
    </summary>
    </part>
    </selectionFailure>
    Thanks
    Newbie

    Hello:
    Base on the suggestion to use 'append' instead of 'copy', I tried to define a 'singleNode' which is of type 'Collection_Type_Struct' so I can append this individual 'struct' into my array (i.e. as the 2nd. element of my array "/ns9:My_Collection/ns9:Collection/ns9:Collection_Item"), but I am getting an error in defining this variable as:
    <variable name="singleNode" element="Collection_Type_Struct"/> <--- error
    Can someone tell me how should I define "singleNode" so I can put a value in it and then append this 'singleNode' into the array:
    <variable name="singleNode" element=" how to define this????"/>
    <assign>
    <copy>
    <frem expression="'Element2Value'"/>
    <to variable="singleNode"
    part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item/ns9:pname"/>
    </copy>
    </assign>
    <bpelx:assign>
    <bpelx:append>
    <from variable="singleNode" query="/ns9:My_Collection/ns9:Collection/ns9:Collection_Item"/>
    <to variable="My_Variable"
    "part="My_Collection"
    query="/ns9:My_Collection/ns9:Collection"/>
    </bpelx:append>
    </bpelx:assign>
    Again here is my definition in my .xsd file:
    <element name="My_Collection">
    <complexType>
    <sequence>
    <element name="Collection" type="db:Collection_Type" db:index="2" db:type="Array" minOccurs="0" nillable="true"/>
    <element name="Ret" type="string" db:index="3" db:type="VARCHAR2" minOccurs="0" nillable="true"/>
    </sequence>
    </complexType>
    </element>
    <complexType name="Collection_Type">
    <sequence>
    <element name="Collection_Item" type="db:Collection_Type_Struct" db:type="Struct" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
    </sequence>
    </complexType>
    <complexType name="Collection_Type_Struct">
    <sequence>
    <element name="pname" db:type="VARCHAR2" minOccurs="0" nillable="true">
    <simpleType>
    <restriction base="string">
    <maxLength value="25"/>
    </restriction>
    </simpleType>
    </element>
    </sequence>
    </complexType>
    Thanks for any help!!!!

  • Assigning value to a variable in Script Component.

    I'm pretty new to SSIS development and need to figure out a problem with assigning a value to a user defined variable. I created a pretty simple package. It reads a flat file, extracts date from a header record and subsequently uses derived column component
    to reformat data to the desired output format. One of the columns (FileRunDate,
    string, length 8) in the derived component is defined as a string and in the expression I'm assigning it to a variable I set earlier in the script component -
    @[User::vRunTimeDate]. When the process runs, the output file gets generated, however FileRunDate reflects
    originally set varible's value. It seems that the variable assignment in the script task does not work, even though in the debug mode, I do see how the value is being set. The variable has an attribute of ReadWrite. Is it due to the fact that the value is
    being set in the same workflow?
    Any feedback is greatly appriciated.

    Unfortunately I'm unable to add a screenshot of the process, for some reason I get an error message when I try to do that. In a nutshell the entire workflow consist of flat file source component, following by a script component (this is where I read and
    assign the variable) 
        public override void PostExecute()
            IDTSVariables100 vars;
            base.PostExecute();
            // Set run date
            if (strRunDate != null)
                VariableDispenser variableDispenser = (VariableDispenser)this.VariableDispenser;
                variableDispenser.LockForWrite("User::vRunTimeDate");
                variableDispenser.GetVariables(out vars);
                // Set the variable
                vars["User::vRunTimeDate"].Value = strRunDate;
                //Unlock the variable 
                vars.Unlock();
                //Variables.vRunTimeDate = strRunDate;
    then goes conditional split ( filtering out unwanted records), which is connected to a derived column component (this is where one of the columns get assigned a variable's value), one more script component (this where I identify
    specific data element and do a replace command) and finally flat file destination.
    BTW, the article in the provided URL clearly states that variable won't reflect assigned value till the entire workflow has finished. If that's the case, then I think I know my
    answer. Is there is such a thing as putting execution of different steps in a different step, so anything executed subsequently will see that value?

  • Dynamically assign value to bind variable in a view object before pageload

    I found that it is extreamely hard to find an example to assign the bind variable in View object at runtime using a data attribute defined in Human task activity. Most of the available samples use a Literal value to do the assignment. In my case, I want to dynamically display the content by assigning the data attribute in Human task to the bind variable in view object before a pageload.
    I do not want to bind the view object to some command component to click a button or link in order to make it work (Unnecessary components in my page).
    The issue is how to access the data attribute in Human task in the java code of client interface in AppModule? or is there a way that I can access the data attribute in Groovy script expression of the bind variable? or if I can access the process data object defined in my BPM process to do the assignment at runtime?
    Really need help on the issue, and I cannot believe that it is so hard to accomplish.
    Thank you very much,

    chk this
    Passing default value to bind variable on page load.
    http://adfcodebits.blogspot.com/2010/03/bit-2-setting-bind-variable-value.html

  • Urgent - Assign Value To Bounded Variables

    In My Application Module I Create View With Bound Variables in The Where Condition, I Create Manual JSP To List The Data From The View As Reports Done.
    Pls. Tell Me How & Where I Can Assign Value To The Bounded Values At Run Time
    Regards
    ABG

    If your datasource tag introduces a scripteable vairiable named 'ds' you can use a scriptlet as follows:
    <%
    ds.getRowSet().setWhereClauseParam(int index, Object value);
    %>
    the index is the parameter index, the value is the value of tha parameter. Please look at the BC4J runtime Javadoc for more information.

  • Assigning cursor select values to local variables

    Hello,
    I am stuck...I need to figure out how to assign the values I"m pulling from my SELECT statement (IN A CURSOR) . Seems easy, and it probably is, but I"m stuck.
    Here's the code. Any help woudl be great!
    CREATE OR REPLACE PROCEDURE prod_sales_sum_sp
    IS
    CURSOR cur_order
    IS
      SELECT sum(total), sum(quantity),to_char(dtordered, 'mon'), to_char(dtordered, 'yyyy'), idproduct
        FROM (
          SELECT bb_basketitem.quantity, total, dtordered, idproduct
          FROM bb_basket, bb_basketitem
           WHERE bb_Basket.idbasket=bb_Basketitem.idbasket
      GROUP BY idproduct);
    lv_qty bb_basket.quantity%type;
    lv_total bb_basket.total%type;
    lv_month bb_prod_sales.month%type;
    lv_year bb_prod_sales.year%type;
    lv_prodid bb_basketitem.idproduct%type;
    lv_sumqty bb_prod_sales.qty%type;
    lv_sumtotal bb_prod_sales.total%type;
    BEGIN
    FOR rec_order IN cur_order LOOP
      UPDATE bb_prod_sales
      SET
        idproduct=lv_prodid,
        month=lv_month,
        year=lv_year,
        qty=lv_sumqty,
        total=lv_sumtotal
       WHERE lv_prodid=idproduct;
    END LOOP;
    END;
    /

    Gah!
    Here's what I have:
    CREATE OR REPLACE PROCEDURE prod_sales_sum_sp
    IS
    CURSOR cur_order
    IS
      SELECT sum(total) total, sum(quantity) quantity,to_char(dtordered, 'mon') month, to_char(dtordered, 'yyyy') year, idproduct product
        FROM (
          SELECT bb_basketitem.quantity, total, dtordered, idproduct
          FROM bb_basket, bb_basketitem
           WHERE bb_Basket.idbasket=bb_Basketitem.idbasket
      GROUP BY idproduct);
    BEGIN
    FOR rec_order IN cur_order LOOP
      UPDATE bb_prod_sales
      SET
        idproduct=product,
        month=month,
        year=year,
        qty=quantity,
        total=total
       WHERE lv_prodid=idproduct;
    END LOOP;
    END;
    /I've tried in teh UDPATE doing:
    qty=rec_cursor.quantity;
    But that gives the error that rec_cursor.quantity is an invalid identifier.
    Do I need to assign aliases in the INNER SELECT statement as well? I dont' see why...but I'm not seeing this either. :)
    How about this:
    CREATE OR REPLACE PROCEDURE prod_sales_sum_sp
    IS
    CURSOR cur_order
    IS
      SELECT sum(total) total, sum(quantity) quantity,to_char(dtordered, 'mon') month, to_char(dtordered, 'yyyy') year, idproduct product
        FROM (
          SELECT bb_basketitem.quantity, total, dtordered, idproduct
          FROM bb_basket, bb_basketitem
           WHERE bb_Basket.idbasket=bb_Basketitem.idbasket
      GROUP BY idproduct);
      quantity=rec_cursor.quantity;
    BEGIN
    FOR rec_order IN cur_order LOOP
      UPDATE bb_prod_sales
      SET
        idproduct=product,
        month=month,
        year=year,
        qty=quantity,
        total=total
       WHERE lv_prodid=idproduct;
    END LOOP;
    END;
    /Message was edited by:
    horax

  • Error while assigning values to Array using Copy operation

    Hi,
    I am using the following code to copy a string value 'Text' and 'UDFTypeTitle' to the 1st and 2nd position of an array:-
    <assign name="Assign1">
    <copy>
    <from expression="string('Text')"/>
    <to variable="Invoke1_ReadUDFValues_InputVariable" part="params"
    query="/ns1:ReadUDFValues/ns1:Field[position()=1]"/>
    </copy>
    <copy>
    <from expression="string('UDFTypeTitle')"/>
    <to variable="Invoke1_ReadUDFValues_InputVariable" part="params"
    query="/ns1:ReadUDFValues/ns1:Field[position()=2]"/>
    </copy>
    </assign>
    I am getting the following error for the 2nd copy:-
    XPath query string returns zero node.
    The assign activity of the to node query is returning zero node.
    Either the to node data or the xpath query in the to node was invalid.
    According to BPEL4WS spec 1.1 section 14.3, verify the to node value at line number 103 in the BPEL source
    If I am removing the 2nd copy I am not getting any error.
    The structure of ns1:*ReadUDFValues* is as follows:-
    - <xsd:complexType name="ReadUDFValues">
    - <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="Field" type="tns:UDFValueFieldType" />
    <xsd:element minOccurs="0" name="Filter" type="xsd:string" />
    <xsd:element minOccurs="0" name="OrderBy" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>
    The structure of ns1:ReadUDFValues/ns1:*Field* is as follows:-
    xsd:simpleType name="UDFValueFieldType">
    - <xsd:restriction base="xsd:string">
    <xsd:enumeration value="CodeValue" />
    <xsd:enumeration value="ConditionalIndicator" />
    <xsd:enumeration value="Cost" />
    <xsd:enumeration value="CreateDate" />
    <xsd:enumeration value="CreateUser" />
    <xsd:enumeration value="Description" />
    <xsd:enumeration value="Double" />
    <xsd:enumeration value="FinishDate" />
    <xsd:enumeration value="ForeignObjectId" />
    <xsd:enumeration value="Indicator" />
    <xsd:enumeration value="Integer" />
    <xsd:enumeration value="IsBaseline" />
    <xsd:enumeration value="IsTemplate" />
    <xsd:enumeration value="IsUDFTypeCalculated" />
    <xsd:enumeration value="IsUDFTypeConditional" />
    <xsd:enumeration value="LastUpdateDate" />
    <xsd:enumeration value="LastUpdateUser" />
    <xsd:enumeration value="ProjectObjectId" />
    <xsd:enumeration value="StartDate" />
    <xsd:enumeration value="Text"/>
    <xsd:enumeration value="UDFCodeObjectId" />
    <xsd:enumeration value="UDFTypeDataType" />
    <xsd:enumeration value="UDFTypeObjectId" />
    <xsd:enumeration value="UDFTypeSubjectArea" />
    <xsd:enumeration value="UDFTypeTitle"/>
    </xsd:restriction>
    </xsd:simpleType>
    Could you please suggest a solution?
    I also tried with position 0, 1 . still the same error.
    Regards,
    Sam

    Hi Naresh,
    The structure of ReadUDFValues is as follows:-
    - <xsd:complexType name="ReadUDFValues">
    - <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="Field" type="tns:UDFValueFieldType" />
    <xsd:element minOccurs="0" name="Filter" type="xsd:string" />
    <xsd:element minOccurs="0" name="OrderBy" type="xsd:string" />
    </xsd:sequence>
    </xsd:complexType>
    The structure of ns1:ReadUDFValues/ns1:Field is as follows:-
    xsd:simpleType name="UDFValueFieldType">
    - <xsd:restriction base="xsd:string">
    <xsd:enumeration value="CodeValue" />
    <xsd:enumeration value="ConditionalIndicator" />
    <xsd:enumeration value="Cost" />
    <xsd:enumeration value="CreateDate" />
    <xsd:enumeration value="CreateUser" />
    <xsd:enumeration value="Description" />
    <xsd:enumeration value="Double" />
    <xsd:enumeration value="FinishDate" />
    <xsd:enumeration value="ForeignObjectId" />
    <xsd:enumeration value="Indicator" />
    <xsd:enumeration value="Integer" />
    <xsd:enumeration value="IsBaseline" />
    <xsd:enumeration value="IsTemplate" />
    <xsd:enumeration value="IsUDFTypeCalculated" />
    <xsd:enumeration value="IsUDFTypeConditional" />
    <xsd:enumeration value="LastUpdateDate" />
    <xsd:enumeration value="LastUpdateUser" />
    <xsd:enumeration value="ProjectObjectId" />
    <xsd:enumeration value="StartDate" />
    <xsd:enumeration value="Text"/>
    <xsd:enumeration value="UDFCodeObjectId" />
    <xsd:enumeration value="UDFTypeDataType" />
    <xsd:enumeration value="UDFTypeObjectId" />
    <xsd:enumeration value="UDFTypeSubjectArea" />
    <xsd:enumeration value="UDFTypeTitle"/>
    </xsd:restriction>
    </xsd:simpleType>

  • Error while assigning Payload to container variable, Activate SXI_Cache

    Hi experts,
    I have a BPM-Szenario. There is a ContainerOperation where I want to fill a Container Variable with a Payload variable. Unfourtunately I get an error in TA sxi_cache: "The value of expression "&.....&" cannot serve as the source of an Assignment.
    My question is, is it really unpossible to do this?
    By the way: After them my bpm in sxi_cache is blocked. Also if i delete the container operation it is a lot of luck to activate my bpm.
    My actions to activate the BPM are:
    IR - F7 = all is ok
    ID - Delete IP and Create the IP new
    SLD-Cache - Activate in IR and ID
    SXI_Cache - Delta and Full Cache Refresh
    TA SWWL - There are no error work items
    All actions do have no influence to the sxi_cache.
    Are there any ideas from the experts?
    Best
    Mathias

    Hello Mathias,
    How do you assign the container varaible? Are you sure, that your XPath-expression is correct? Is your target container a simple typed container?
    Best regards
    Joachim

  • Execute SQL Task: Cannot assign value to the variable

    DECLARE
    @PartitionDate varchar(8),
    @Date int
    SELECT
    @PartitionDate = MAX(PartitionDate)
    FROM PartitionLog (NOLOCK)
    SELECT
    @Date = MIN(DateKey)
    FROM DimDate WHERE CAST(DateKey as varchar(8)) > @PartitionDate
    IF NOT CONVERT(varchar(8),GETDATE(),112) = @PartitionDate
    SELECT @PartitionDate = CAST(DateKey as varchar(8))
    FROM DimDate (NOLOCK)
    WHERE DateKey = @Date
    SELECT @PartitionDate AS PartitionDate ,
    'IISDW_' + @PartitionDate AS PartitionName
    GO
    I have the above SQL stmt in the excute SQL task and declared 2 variable "PartitionDate" and "PartitionName" in the Package, the RESULT SET I hav given as "Single Row" and when I run the ETL I get the error as 
    [Execute SQL Task] Error: An error occurred while assigning a value to variable "PartitionDate": "Exception from HRESULT: 0xC0015005".

    Does your package variable datatype match the datatype of your parameter?
    Is your Package variable assigned to the parameter in the task editor?
    And does the parameter name in the task editor match the parameter names in your stored procedure?

  • Is an assigned value to an variable in the domain of the data element

    Hi
    how can I check if the value, which I want to assign to an variable is in the domain of the data element of that variable.
    Example:
    I defined a data element myDataElement. The Elementary Type of myDataElement is the Domain myDomain.
    myDomain has the Format: Char with Length 1 and the fixed values 'A' and 'B'.
    The following code works, but IMHO should not:
    DATA testVar TYPE myDomain.
    testVar = 'Foo'.
    The value of testVar is now: 'F' .
    As 'F' is not in the fixed values, this is a behaviour which I don't want. How can I prevent this from not happening (without using a bunch of IFs)?
    In such a case, it were nice if an exception were raised.
    Regards
    Gilles

    Thanks Gungor.
    I tried it with DDUT_DOMVALUES_GET. Works so far. I think I will write some FMs on my own, like this one:
    FUNCTION z_valueisindomain.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(IV_DOMAINNAME) TYPE  DDOBJNAME
    *"     REFERENCE(IV_EVALUATING_VALUE) TYPE  ANY
    *"  EXPORTING
    *"     REFERENCE(EV_DESTINATION) TYPE  ANY
    *"  EXCEPTIONS
    *"      ILLEGAL_INPUT
    *"      NOT_IN_DOMAIN
      DATA domainvalues TYPE TABLE OF dd07v.
      CALL FUNCTION 'DDUT_DOMVALUES_GET'
        EXPORTING
          name          = iv_domainname
        TABLES
          dd07v_tab     = domainvalues
        EXCEPTIONS
          illegal_input = 1
          OTHERS        = 2.
      IF sy-subrc <> 0.
        RAISE illegal_input.
      ENDIF.
      DATA oneline TYPE dd07v.
      LOOP AT domainvalues INTO oneline.
        IF oneline-domvalue_l EQ iv_evaluating_value.
          ev_destination = iv_evaluating_value.
          EXIT.
        ENDIF.
      ENDLOOP.
      IF ev_destination IS INITIAL.
        RAISE not_in_domain.
      ENDIF.
    ENDFUNCTION.
    I'm pretty new to ABAP, so this FM might not be very elegant.
    Regards
    Gilles

  • Error while assigning values to Table type

    Hi,
    I am trying to insert some values to a Collection type , while doing that I am facing an error ,
    " PLS-00306: wrong number or types of arguments in call to
    'XXSCP_AVL_CSP_SQR_O_TP' "PFB my collection type declaration and and assignment .
    Object type :
    TYPE XXSCP_AVL_CSP_SQR_O_TP AS                 
    OBJECT  (                                      
                PLAN_ID             NUMBER,        
                SR_INSTANCE_ID      NUMBER,        
                INVENTORY_ITEM_ID   NUMBER,        
                BASE_ITEM_ID        NUMBER,             
                 ITEM_NAME           VARCHAR2(50),      
                 SUPPLIER_ID         NUMBER,            
                SUPPLIER_SITE_ID    NUMBER,        
                NORMAL_BUY_USAGE    VARCHAR2(5),   
                AVAILABLE_QUANTITY  NUMBER ,       
                SPL_PEG_FLAG        VARCHAR2(10),  
                SQR_LINE_ID         VARCHAR2(2000),
                SQR_NUMBER          VARCHAR2(2000),
                SQR_MOQ             NUMBER,        
                BPA_PO_LINE_ID      NUMBER,        
                SUGG_BPA_NUMBER     VARCHAR2(30),  
                BPA_BUY_PRICE_BASIS VARCHAR2(10),  
                BPA_LINE_NUM        NUMBER,        
                BPA_PO_LINE_LOC_ID  NUMBER,        
                BPA_CURRENCY_CODE   VARCHAR2(10),  
                BPA_PRICE           NUMBER,        
                BPA_PO_HEADER_ID    NUMBER,        
                BPA_EXPIRATION_DATE DATE,          
                BPA_QUANTITY        NUMBER,        
                ORIG_AVAILABLE_QTY  NUMBER         
    Table type :
    TYPE XXSCP_AVL_CSP_SQR_C_TP AS TABLE OF XXSCP_AVL_CSP_SQR_O_TP;Declaraion:
    l_tab_avl_csp_sqr   XXSCP_AVL_CSP_SQR_C_TP := XXSCP_AVL_CSP_SQR_C_TP();Assignment in body :
    l_tab_avl_csp_sqr.EXTEND(1);
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := XXSCP_AVL_CSP_SQR_O_TP();
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).plan_id           := l_tab_planorders (i).l_num_plan_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sr_instance_id    := l_tab_planorders (i).l_num_sr_instance_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).inventory_item_id := l_tab_planorders (i).l_num_inventory_item_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).base_item_id      := l_tab_planorders (i).l_num_base_item_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).item_name         := l_tab_planorders (i).l_chr_item_name;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).supplier_id       := l_tab_planorders (i).l_num_supplier_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).supplier_site_id  := l_tab_planorders (i).l_num_supplier_site_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).available_quantity := l_rec_pegged_list (j).remaining_aval_qty;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).spl_peg_flag       := 'Y';
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_line_id        := l_rec_pegged_list (j).sqr_line_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_number         := l_rec_pegged_list (j).sqr_number;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sqr_moq            := l_rec_pegged_list (j).sqr_moq;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_po_line_id     := l_rec_pegged_list (j).bpa_po_line_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).sugg_bpa_number    := l_rec_pegged_list (j).bpa_number;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_buy_price_basis := l_rec_pegged_list (j).bpb_type;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_line_num        := l_rec_pegged_list (j).bpa_line_num;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_po_line_loc_id  := l_rec_pegged_list (j).bpa_lloc_id;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_currency_code   := l_rec_pegged_list (j).bpa_curr_code;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_price           := l_rec_pegged_list (j).bpa_price;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_expiration_date := l_rec_pegged_list (j).bpa_expiration_date ;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).bpa_quantity        := l_rec_pegged_list (j).bpa_quantity ;
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT).orig_available_qty  := l_rec_pegged_list (j).remaining_aval_qty ;Can anyone help in this issue.
    Thanks in advance,
    Rakesh
    Edited by: Venkat Rakesh on Apr 24, 2013 12:18 AM

    you need to add an empty-arg user-defined constructor for your type in order to use, "l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := XXSCP_AVL_CSP_SQR_O_TP();"
    create or replace
    TYPE XXSCP_AVL_CSP_SQR_O_TP AS                 
    OBJECT  (                                      
                PLAN_ID             NUMBER,        
                SR_INSTANCE_ID      NUMBER,        
                INVENTORY_ITEM_ID   NUMBER,        
                BASE_ITEM_ID        NUMBER,             
                 ITEM_NAME           VARCHAR2(50),      
                 SUPPLIER_ID         NUMBER,            
                SUPPLIER_SITE_ID    NUMBER,        
                NORMAL_BUY_USAGE    VARCHAR2(5),   
                AVAILABLE_QUANTITY  NUMBER ,       
                SPL_PEG_FLAG        VARCHAR2(10),  
                SQR_LINE_ID         VARCHAR2(2000),
                SQR_NUMBER          VARCHAR2(2000),
                SQR_MOQ             NUMBER,        
                BPA_PO_LINE_ID      NUMBER,        
                SUGG_BPA_NUMBER     VARCHAR2(30),  
                BPA_BUY_PRICE_BASIS VARCHAR2(10),  
                BPA_LINE_NUM        NUMBER,        
                BPA_PO_LINE_LOC_ID  NUMBER,        
                BPA_CURRENCY_CODE   VARCHAR2(10),  
                BPA_PRICE           NUMBER,        
                BPA_PO_HEADER_ID    NUMBER,        
                BPA_EXPIRATION_DATE DATE,          
                BPA_QUANTITY        NUMBER,        
                ORIG_AVAILABLE_QTY  NUMBER,
    Constructor
                constructor function XXSCP_AVL_CSP_SQR_O_TP return self as result
    create or replace
    TYPE body XXSCP_AVL_CSP_SQR_O_TP AS                 
    Constructor
                constructor function XXSCP_AVL_CSP_SQR_O_TP return self as result
                is
                begin
                  return;
                end;
    end;        alternatively, assign your attributes as you construct your instance:
    l_tab_avl_csp_sqr.EXTEND(1);
    l_tab_avl_csp_sqr(l_tab_avl_csp_sqr.COUNT) := new XXSCP_AVL_CSP_SQR_O_TP(
      l_tab_planorders (i).l_num_plan_id,
      l_tab_planorders (i).l_num_sr_instance_id.
      l_tab_planorders (i).l_num_inventory_item_id,
      l_tab_planorders (i).l_num_base_item_id,
      l_tab_planorders (i).l_chr_item_name,
      l_tab_planorders (i).l_num_supplier_id,
      l_tab_planorders (i).l_num_supplier_site_id,
      l_rec_pegged_list (j).remaining_aval_qty,
      'Y',
      l_rec_pegged_list (j).sqr_line_id,
      l_rec_pegged_list (j).sqr_number,
      l_rec_pegged_list (j).sqr_moq,
      l_rec_pegged_list (j).bpa_po_line_id,
      l_rec_pegged_list (j).bpa_number,
      l_rec_pegged_list (j).bpb_type,
      l_rec_pegged_list (j).bpa_line_num,
      l_rec_pegged_list (j).bpa_lloc_id,
      l_rec_pegged_list (j).bpa_curr_code,
      l_rec_pegged_list (j).bpa_price,
      l_rec_pegged_list (j).bpa_expiration_date,
      l_rec_pegged_list (j).bpa_quantity,
      l_rec_pegged_list (j).remaining_aval_qty );Gerard
    Edited by: gaverill on Apr 23, 2013 12:12 PM

Maybe you are looking for

  • Error on File upload. Error processing wwv_flow.accept.

    Hi, I'm developing an application to upload and download files using Oracle XE 10g and APEX 3.2.0.00.27 on OS Windows XP. The file upload page is very simple: one file browse item, a submit button and a report based on the wwv_flow_files table.... an

  • F4 functionality

    Hi All, In F110(Automatic Payment Run) transaction when we click F4 on rundate/identification fields we get list of values. when we select any identification or date automatically the other field also gets populated with some value. In the same way f

  • Sample editor functions greyed (checked previous discussions)

    Hi All, I have the same problem many have reported earlier. I tried the tips given bouncing in place, ensuring write access is there. but still the same problem. Please find the screenshots.

  • No existen registros coincidentes  Objeto Definido por el usuario (OUDO)

    Hola  a todos EL sistema me esta mandando el siguiente error No existen registros coincidentes  Objeto Definido por el usuario (OUDO) (ODBC -2028) Esto al tratar de crear una factura de proveedores, he revisado varias notas y post con mensjes similar

  • Can't Run Bluetooth Examples (Error 1)

    I am trying to set up Labview to control an Arduino via Bluetooth. I'm just starting out by attempting to connect my smartphone using the Advanced  Bluetooth Server/Advanced Bluetooth Client example vis. I plugged in my Bluetooth dongle and the dongl