Assign value to Object type variable

CREATE OR REPLACE TYPE emp AS OBJECT (
empid NUMBER,
age NUMBER,
dob date);
CREATE OR REPLACE TYPE emp _tab AS TABLE OF emp;
Pls hlep me assign value to the object type variable in loop..(assume there is 5 10 records in emp table)
declare
v_emp_tt emp _tab ;
begin
for i in (select empid ,age ,dob from emp ) Loop
v_emp_tt := i.empid; --this is wrong pls help me correct it.
end loop;
end;
thanks,

I would keep the type/object naming convention distinct from the table name.
In terms of assignment:
CREATE OR REPLACE TYPE to_emp AS OBJECT
(empid NUMBER,
age NUMBER,
dob date);
CREATE OR REPLACE TYPE tt_emp AS TABLE OF emp;
declare
v_emp tt_emp;
begin
select to_emp_obj(emp_id, age, dob)
bulk collect into v_emp
from emp;
end;

Similar Messages

  • Assigning value to array type variable in a loop

    Hi
    I have a scenario in which i am assigning value from a array type variable(x) to the invoke variable of a database adapter. The variable x is exact replica of the invoke variable.
    My copy operation in assign activity looks like this-
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters"/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    </copy>
    It is inside a while loop activity.
    PS *()* are square brackets
    But it is erroring out at run time.
    Does anybody has an alternate idea to assign value to an array type?.
    i have seen that while extracting value from an array type variable it works fine
    A similar kind of operation is shown below.
    <copy>
    <from variable="Var" part="InputParameters"
    query="/ns7:InputParameters *(* bpws:getVariableData('iterator') *)* "/>
    <to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"
    part="InputParameters"
    query="/ns7:InputParameters"/>
    </copy>
    Thanks
    Ayush
    Edited by: Ayush fujitsu on Aug 14, 2009 4:36 AM

    Hi Ayush
    I suppose you are getting some error like "source node returns multiple elements".
    In second case there is no problem because you are assigning *InputParameters[bpws:getVariableData('iterator')]* (+suppose InputParameters[1]+) to target. Here it works fine because you are fetching oonly 1 value from source and assigning it to the target.
    Now in first case you are saying copy InputParameters to target[1] suppose. You know that source is an array which contains multiple index so which index field from the source will be assigned to the target.
    Try your process with only 1 source value it will work but when multiple values will be there it will fail. You have to merge both the cases and it will look like
    *<copy>*
    *<from variable="Var" part="InputParameters"*
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *<to variable="Invoke_call_XXDPI_EDI_852_PKG_InputVariable"*
    part="InputParameters"
    query="/ns7:InputParameters ( bpws:getVariableData('iterator') ) "/>
    *</copy>*
    And the easiest way to do this is by the transform activity as said above.
    Regards
    Suryaveer
    Edited by: Suryaveer on Aug 15, 2009 11:19 PM

  • What target property must be specified while passing a object type variable to child package in SSIS 2012

    What target property must be specified while passing a object type variable to child package in SSIS 2012???

    As shown below, there is variable strVar and it's Value property is selected. Likewise you have to select the property that you need to pass.
    Please refer:
    http://www.bidn.com/blogs/MikeDavis/ssis/155/passing-variable-values-from-parent-package-to-child-ssis
    -Vaibhav Chaudhari

  • How can I obtain an object-type variable in Forms 6i?

    i create an object-type in oracle 8i database like this:
    TYPE OBJ_TYPE_NUMBER AS OBJECT
    FIELD1 NUMBER,
    MEMBER PROCEDURE INIT, ...
    i create a variable of this object-type in a stored procedure in Oracle 8i:
    v_Number OBJ_TYPE_NUMBER(10);
    and then call it's method:
    v_Number.INIT;
    it work's!
    But when I try to compile a previous variable declaration
    (v_Number OBJ_TYPE_NUMBER;) in Oracle Forms 6i I see only an error message.
    So my question is How can I declare and use an object-type variable in Forms 6i?

    Hi,
    the release after Forms 6i is Forms9i. Forms9i does have the PLSQL engine of Oracle 9.0.0.2 database which means that it should knwo how to handle object types in PLSQL.
    Frank

  • Passing Values to Object Type Attributes

    Hi Experts,
    I need to pass values to object type attributes amount,channel and company code from zprogram.
    I have got FM 'SWO_INVOKE'.But in this FM how will I pass values to 3 attributes.
    I have created object type through SWO1 .Is it necessary to call FM SWO_CREATE before FM 'SWO_INVOKE'.
    Please suggest.
    Regards,
    Kaustubh.

    Hi,
    I guess you will have to Initialize business object first by using the function module "SWO_CREATE' and then call the other function module to pass the attributes. I am not sure, but please check by passing the attribute name and value to the tables parameter 'CONTAINER'.
    CONTAINER-ELEMENT = <Attribute name>.
    CONTAINER-VALUE = <value from the Zprogram>.
    Hope this will help.
    Thanks,
    Samson

  • 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

  • Assigning values to a javascript variable

    Hi,
    Using request dispatcher, i'm forwarding the control to a html from a servlet like this(obj.forward(/index.html?field1=value1&field2=value2).
    In the receiving end, ie., in the html i would like to assign those 2 field1,field2 values to a javascript variables. Javascript located in the index.html.
    I don't know how to do this.
    Pls any one help me to get of this pblm
    Thanks in Advance
    Kannan.T

    Hi thanks for ur reply,
    You r telling while forwarding a request from one
    servlet to another servlet, we can't add query
    string(requestparameters). But then how come this
    code is working?
    RequestDispatcher
    rdis=getServletContext().getRequestDispatcher("/MyServ
    let?type=normal");
    rdis.forward(req,res);Well I owe an apology here - I was not completely correct. I have tested and found that you can indeed add parameters that way. The catch is that these parameters are nested to that forwarded /included resource. It is not available in the original jsp or to some other resource included from the original jsp unless ofcourse you add the parameter again.
    >
    please give me a solution.
    Like this i have to forward my request (with
    querystring) to a html page.
    That htmlpage should receive parameters and assign
    the values to a javascript variables.
    how can i achieve this.
    thanks in advance.My original reply stands.
    You cannot do that in a html page. You have to have a jsp that generates the html.
    ram.

  • Displaying value of Object type

    Hi All,
    I have created one type as Object and I am trying to display the values available in object type for debugging purpose. Please assist me to display the contents of object type.
    Thanks in Advance.
    Regards,
    Venkatesh S

    vivekan wrote:
    I have created one type as Object and I am trying to display the values available in object type for debugging purpose. Please assist me to display the contents of object type.You can do this statically or dynamically.
    The static approach would be to add a DebugDump() method to the object type class - and code this method to display a "debug dump" (via DBMS_OUTPUT for example) of the current instantiated object. Of course, should the class change (new attributes added for example), this DebugDump() method has to be updated.
    The dynamic method is more flexible - but requires a copy of the object to be created for the dynamic code to use and "dump".
    As the static method is pretty straightforward, I'm only providing a basic example of the dynamic method.
    // create a function that generates a PL/SQL anonymous code block that accepts the
    // object to dump as bind variable and the display the object's attributes
    SQL> create or replace function GenerateDumpCode( typeName varchar2 ) return varchar2 is
      2          LF_INDENT       constant varchar2(10) default chr(10)||chr(9);
      3          LF              constant varchar2(10) default chr(10);
      4          type TAttrList is table of user_type_attrs.attr_name%Type;
      5          type TAttrTypeList is table of user_type_attrs.attr_type_name%Type;
      6          attrName        TAttrList;
      7          attrType        TAttrTypeList;
      8          plCode          varchar2(32767);
      9  begin
    10          select
    11                  a.attr_name, a.attr_type_name
    12                          bulk collect into
    13                  attrName, attrType
    14          from    user_type_attrs a
    15          where   a.type_name = typeName
    16          order by
    17                  a.attr_no;
    18 
    19          plCode :=
    20  'declare
    21          obj '||typeName||';
    22 
    23          procedure W( line varchar2 ) is
    24          begin
    25                  DBMS_OUTPUT.put_line( line );
    26          end;
    27  begin
    28          obj := :var1;
    29  ';
    30 
    31          for i in 1..attrName.Count loop
    32                  plCode := plCode ||LF_INDENT|| 'W( ''Attribute '||attrName(i)||'=''||';
    33                  case attrType(i)
    34                          when 'NUMBER' then plCode := plCode || 'to_char(obj.'||attrName(i)||') );';
    35                          when 'INTEGER' then plCode := plCode || 'to_char(obj.'||attrName(i)||') );';
    36                          when 'VARCHAR2' then plCode := plCode || 'obj.'||attrName(i)||' );';
    37                          when 'DATE' then plCode := plCode || 'to_date(obj.'||attrName(i)||',''yyyy/mm/dd hh24:mi:ss'') );';
    38                  else
    39                          plCode := plCode || '''data type '||attrType(i)||': value not displayed.'');';
    40 
    41                  end case;
    42          end loop;
    43 
    44          plCode := plCode ||LF|| 'end;';
    45 
    46          return( plCode );
    47  end;
    48  /
    Function created.
    // we need a sample object type/class for, so here's a basic one
    SQL> create or replace type TFunkyFoo is object(
      2          day             date,
      3          empID           integer,
      4          empName         varchar2(20),
      5          contract        clob
      6  );
      7  /
    Type created.
    // the dynamic code block that the function will generate looks as follows:
    SQL> select GenerateDumpCode( 'TFUNKYFOO' ) as PLSQL_CODE from dual;
    PLSQL_CODE
    declare
            obj TFUNKYFOO;
            procedure W( line varchar2 ) is
            begin
                    DBMS_OUTPUT.put_line( line );
            end;
    begin
            obj := :var1;
            W( 'Attribute DAY='||to_date(obj.DAY,'yyyy/mm/dd hh24:mi:ss') );
            W( 'Attribute EMPID='||to_char(obj.EMPID) );
            W( 'Attribute EMPNAME='||obj.EMPNAME );
            W( 'Attribute CONTRACT='||'data type CLOB: value not displayed.');
    end;
    // using the function to dynamically display an object's attributes
    SQL> declare
      2          foo TFunkyFoo;
      3  begin
      4          foo := new TFunkyFoo( sysdate, 100, 'John Smith', null );
      5          execute immediate
      6                  GenerateDumpCode( 'TFUNKYFOO' )
      7          using   foo;
      8  end;
      9  /
    Attribute DAY=2012-08-30 14:48:35
    Attribute EMPID=100
    Attribute EMPNAME=John Smith
    Attribute CONTRACT=data type CLOB: value not displayed.
    PL/SQL procedure successfully completed.
    SQL>

  • SSIS 2012 - Parent/Child Package "Object" Type Variables

    How do I pass Variables of Object type from Parent to Child packages?
    I am using the SSIS 2012 project deployment model.
    Thanks

    You can do it as outlined in
    http://sqlblog.com/blogs/andy_leonard/archive/2010/01/25/ssis-snack-passing-parent-starttime-to-the-child-package.aspx
    But
    When you need an object it is typically a recordset, then just pass the results, or execute the query in a package.
    Arthur My Blog

  • SELECT VALUES FROM OBJECT TYPES

    Hi
    I want to select values in a object types in a table over the database link.
    like
    select name from [email protected]
    where name is of type varray of varchar2(100)
    and db.com is database link.
    It is giving me error ORA-22804.
    Oracle supports this or not?

    SQL> var a refcursor
    SQL> declare
      2   bb emp%ROWTYPE;
      3  begin
      4   select * into bb from emp where rownum = 1;
      5   open :a for select bb.ename ename, bb.empno empno from dual;
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> print a
    ENAME                                 EMPNO
    SMITH                                  7369Rgds.

  • Object type variable - Help !

    Hi
    I want to achieve following outcome:
    Create a object type e.g.
    CREATE TYPE employees AS OBJECT (
    employee_id NUMBER(6),
    first_name VARCHAR2(20)
    Then create a table type e.g
    CREAT TYPE emp_table AS TABLE of employees;
    So far so good.
    Now I want to declare a variable of emp_table type in my
    procedure and then populate it using a select clause.
    Something like this:
    my_employees emp_table;
    insert into my_employees select id, name from table1 where id < 50;
    Where table1 is some permanent table in my database.
    I am not able to figure out how to achieve this.
    I dont want to create a permanent table in my database for this.
    I want to keep this table type variable in memory and discard it at the end
    of the procedure.
    Please help
    Regards
    Madhup

    BULK COLLECT INTO
    http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96624/05_colls.htm#28329
    SQL> CREATE TYPE employees AS OBJECT (
      2  employee_id NUMBER(6),
      3  first_name VARCHAR2(20)
      4  );
      5  /
    Type created.
    SQL> CREATE TYPE emp_table AS TABLE of employees;
      2  /
    Type created.
    SQL> declare
      2   my_employees emp_table := emp_table();
      3  begin
      4   select employees(empno,ename) bulk collect into my_employees from emp;
      5  end;
      6  /
    PL/SQL procedure successfully completed.Rgds.

  • Multiple default values for Selection type variable

    Hi all,
    I am using Bex 3.5. I have a fundamental doubt while creating a User Entry, Selection Option, Optional type variable.  I am trying to include multiple single variables in the default section, but it accepts only one. Is it possible to add multiple default values to the variable so that they show up in the selection screen when we run the report via Bex Analyzer ?
    Thanks for the inputs !
    Regards
    Snehith.

    Hi,
    In one of my bi7 reports, i remember i have given multiple default values in a single variable. For example i wanted to have multiple material types in my selection screen.
    But i have to check out the type of that user entry variable.
    Hope the above reply was helpful.
    Kind regards,
    Ashutosh singh

  • How to pass conventional table values in object types Dynamically

    Hi All,
    Need urgent help...
    TYPE add_ty is object
    (add1     varchar2(50),
    add2     varchar2(50),
    add2     varchar2(50))
    type add_ty_obj is table of add_ty;
    create table company_dtl
    (cmpid          number(10),
    cmpname          varchar2(100),
    address          add_ty_obj);
    table company_dtl contains demo data as below:-
    cmpid cmpname address
    C101     abc     UK,
              USA,
              AUS
    c102     xyz     UK,
              CN,
              GER
    If I want to read data from table and pass data to object add_ty_obj,
    So How can I do it dynamically. I am willing to create procedure
    which can read data from above table and pass that to mentioned object in
    OUT parameter.
    Out parameter contains same object type somewhere in middleware.
    Please help or advice.
    Thanks in Advance..

    Hi
    i have tried to make procedure that take company id as input and give their address as output.I think it might be useful for you. Or if you want something different
    please write us with more detail.
    CREATE OR REPLACE PROCEDURE READ_DATA_PROC( VAR_CMPID IN NUMBER , VAR_TYP OUT ADD_TY_OBJ)
    AS
    BEGIN
    SELECT ADDRESS INTO VAR_TYP FROM COMPANY_DTL WHERE CMPID = V_CMPID ;
    END READ_DATA_PROC;
    here i'm also adding your table and type definition i've used
    CREATE TYPE ADD_TY IS OBJECT
    (ADD1 VARCHAR2(50),
    ADD2 VARCHAR2(50),
    ADD3 VARCHAR2(50));
    CREATE TYPE ADD_TY_OBJ AS TABLE OF ADD_TY;
    CREATE TABLE COMPANY_DTL
    (CMPID NUMBER(10),
    CMPNAME VARCHAR2(100),
    ADDRESS ADD_TY_OBJ)
    NESTED TABLE ADDRESS STORE AS ADDRESS_TAB;thanks,
    Neeraj
    Edited by: Neeraj.Ora on Feb 26, 2011 1:03 PM

  • Assigning values to database types

    Hi I've created some types like the ones below but I can see how to assign a value to the fred_complex_obj using pl/sql. Does anyone know?
    Thanks,
    create or replace type fred_phone_obj AS OBJECT
    (telephone_number varchar2(20) ,
    telephone_type VARCHAR2(10)
    CREATE OR REPLACE TYPE fred_phone_typ
    AS TABLE OF fred_phone_obj
    create type fred_complex_obj as object
    SOURCE VARCHAR2(15),
    CONTRACT_GROUP VARCHAR2(10),
    CONTRACT_ID VARCHAR2(50),
    MPAN VARCHAR2(13) ,
    phone fred_phone_typ
    DECLARE
    type bert is table of fred_complex_obj ;
    w_params_in bert ;
    BEGIN
    w_params_in := bert() ;
    w_params_in.EXTEND ;
    w_params_in(w_params_in.COUNT) := (fred_complex_obj (1,
    2 ,
    3 ,
    4)
    fred_phone_obj(1,2)) ;
    END ;
    ERROR at line 16:
    ORA-06550: line 16, column 56:
    PLS-00103: Encountered the symbol "FRED_PHONE_OBJ" when expecting one of the following:
    . ( ) , * % & | = - + < / > at in is mod remainder not range
    rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or
    like LIKE2_ LIKE4_ LIKEC_ between || multiset member
    SUBMULTISET_
    The symbol "." was substituted for "FRED_PHONE_OBJ" to continue.

    something like this
    SQL>create or replace type fred_phone_obj AS OBJECT
      2  (telephone_number varchar2(20) ,
      3  telephone_type VARCHAR2(10)
      4  )
      5  /
    Type created.
    SQL>CREATE OR REPLACE TYPE fred_phone_typ
      2  AS TABLE OF fred_phone_obj
      3  /
    Type created.
    SQL>create type fred_complex_obj as object
      2  (
      3  SOURCE VARCHAR2(15),
      4  CONTRACT_GROUP VARCHAR2(10),
      5  CONTRACT_ID VARCHAR2(50),
      6  MPAN VARCHAR2(13) ,
      7  phone fred_phone_typ
      8  )
      9  /
    Type created.
    SQL>DECLARE
      2      type bert is table of fred_complex_obj ;
      3      w_params_in bert ;
      4      l_phone_typ fred_phone_typ;
      5  BEGIN
      6      w_params_in := bert() ;
      7      w_params_in.EXTEND ;
      8      l_phone_typ := fred_phone_typ();
      9      l_phone_typ.EXTEND ;
    10      l_phone_typ(l_phone_typ.count) := fred_phone_obj('1','2') ;
    11      w_params_in(w_params_in.COUNT) := fred_complex_obj ('1','2' ,'3' ,'4', l_phone_typ ) ;
    12
    13      For i in 1..w_params_in.last loop
    14          dbms_output.put_line ( 'w_params_in.SOURCE ' || w_params_in(i).SOURCE ) ;
    15          dbms_output.put_line ( 'w_params_in.CONTRACT_GROUP ' || w_params_in(i).CONTRACT_GROUP ) ;
    16          dbms_output.put_line ( 'w_params_in.phone number ' || w_params_in(i).phone(i).telephone_number ) ;
    17      End Loop;
    18  END ;
    19  /
    w_params_in.SOURCE 1
    w_params_in.CONTRACT_GROUP 2
    w_params_in.phone number 1
    PL/SQL procedure successfully completed.

  • Assigning values of various types to a user defined CLR type

    I have implemented a CLR datatype.  I can assign string values to variables of the type like this (implemented in the Parse method):
    declare @v MyType
    set @v = '10'
    But when I try:
    declare @v MyType
    set @v = 10
    I get:
    Msg 206, Level 16, State 2, Line 3
    Operand type clash: int is incompatible with MyType
    How do I implement a conversion of integer types (bigint, int, smallint, decimal...) to my type, to allow a simple assignment like that to work?
    Thanks.
    Gudmundur Karlsson

    I can't but I can add some information which might help.  The type is very simple (sorry I have to skip the actual implementation of the member data and the methods):
    [Serializable]
    [Microsoft.SqlServer.Server.SqlUserDefinedType(Format.UserDefined, MaxByteSize = 1024)]
    public struct MyType : INullable, IBinarySerialize
        // Private members
        private bool m_Null;
        // ... three or four more member variables
        public override string ToString()
        ...  // My code converts the internal state to a string
        public bool IsNull
            get
         // Put your code here
         return m_Null;
        public static MyType Null
          get
       MyType h = new MyType();
       h.m_Null = true;
       return h;
        public static MyType Parse(SqlString s)
          ... // Here is where I read the string and save the value in internal format in member variables
        // More methods
        void IBinarySerialize.Read(System.IO.BinaryReader r)
            m_Null = r.ReadBoolean();
            if (!m_Null)
         void IBinarySerialize.Write(System.IO.BinaryWriter w)
             w.Write(m_Null);
             if (!m_Null)
    I want to implement a method like Parse which accepts a SQL server numeric type and converts it to my type.  To allow me to assign integers to a variable of my type, without having to convert to string first.
    Thanks
    Gudmundur Karlsson

Maybe you are looking for

  • Adobe Bridge CC crashes when opening file with Photoshop CC or Camera RAW!

    Adobe Bridge CC crashes when opening file with Photoshop CC or Camera RAW! - Tried to Reset the preference with CTRL + Click. - It's just new clean install didn't do anything with it yet. - Windows 8. Any help?

  • Urgent Advice needed for SAP Training

    My Profile : 36 Months of Experience with IT MNC in India. Have done Bachelor of Engineering in Electronics & Communication. Moving to USA with family and going for 1 year MBA ( Information Systems) in USA. Involved in SAP focused Change  and Release

  • Reading a text file

    How do I do this with in Java? I would also like to know how to read XML. Is it the same method?

  • Definition of timestamp field in the message tracking log

    Hi, anyone can help me with the exact definition of timestamp field that I retrieve in the messagetracking log? I think that is the exact time by which the exchange server receive a mail and start to elaborate it Can you confirm please Thank you very

  • Some boot error

    I am getting some boot error at the very end at boot time and it moves to fast for me to catch it. I did try with read -n1 added to rc.conf but as the error is at the very end so it just jumps past the error. I had a look in /var/log files but could