Nested table functionality in VC7.1

Hi,
I have installed NetWeaver  7.1 successfully.now in VC 7.1 i need to test nested table webservice will work or not.is there any standard webservice available contains nested tables,so that i can test.
Thanks
Surya

Hi,
Check this link for more info.
[http://wiki.sdn.sap.com/wiki/display/VC71/Web+Services]
Regards,
Govindu

Similar Messages

  • Trinidad Nested Tables Collapse and Expand Functionality Change

    I am using JSF Trinidad 1.2 for JSF Implementation.
    I am using <tr:table> and f:facet's detailStamp component's of Trinidad to get Nested Table functionality. I have three tables i.e. table1, table2, table3. Each row of Table1 has nested Table2 and each row of Table2 has nested Table3. It seems that the collapse and Expand functionality of these component makes AJAX call to the server and fetches the relevant data.
    My requirement is to have data populated to all the three tables during initial Load and use clientSide Javascript function to collapse the Table2 and Table3 rows on initial Display. Once all the table1 rows are displayed, I should have collapse and expand at row level of Table1 that should make Table2 data visible and invisible on click using Javascript i.e. no server side call.
    I am not sure If I can disable the inbuilt AJAX calls on click to expand and collapse. If yes, how I can do that?
    Second Thing will be how I can populate my custom Javascript on those collapse and expand onclick event?
    Thanks In Advance

    Hi Suvidha,
    Thanks for the response, but in my scenario I have a viewset in component A and overview page in component B. I am using viewset as assignment block in component B where i need to change the title on Lazy and Direct mode. Method of IF_BSP_WD_HISTORY_STATE_DESCR for viewset does not work in this scenario.
    I am trying to get a method which get called on change of Lazy and Direct mode for an assignment block .

  • How do you "Instantiate" a Nested Table from within a FUNCTION?

    , I managed to compile and create the FUNCTION.
    But when I invoked it,
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at "DEV.SPGETPARENTSTABLE", line ...
    I think I need to somehow *"Instantiate"* the Nested Table and I didn't:
    CREATE OR REPLACE FUNCTION spGetParentsTable
    ObjectId number,
    ObjectClassifier varchar2
    RETURN types.TmpHiearchyMapTableType
    IS
    TmpHierarchyMap types.TmpHiearchyMapTableType;
    ThisTempId varchar2(32);
    CURSOR spGetParents_cursor IS
    SELECT
    ReferencedId Id,
    ParentId,
    ChildId,
    FROM TMP_HIERARCHYMAP
    WHERE TmpUID = ThisTempId;
    BEGIN
    SELECT sys_guid() INTO ThisTempId FROM dual;
    spRecursiveGetParents(ObjectId, ObjectClassifier, ThisTempId);
    FOR oMap in spGetParents_cursor LOOP
    TmpHierarchyMap.Extend(); **** BUT I haven't "Instantiate" the Nested Table yet ****
    TmpHierarchyMap(TmpHierarchyMap.Count) := TmpHierarchyMapObjType( oMap.Id
    , oMap.ParentId
    , oMap.ChildId
    END LOOP;
    DELETE FROM TMP_HIERARCHYMAP WHERE TmpUID = ThisTempId;
    RETURN TmpHierarchyMap;
    END spGetParentsTable;

    It's annonyingly trivial to fix. In your declaration section try
        TmpHierarchyMap types.TmpHiearchyMapTableType :=  types.TmpHiearchyMapTableType();
        ...Cheers, APC
    blog: http://radiofreetooting.blogspot.com

  • Need to return dynamic column names for a function returning nested table

    I am having a pl/sql function which is returning a nested table.
    For this i have defined an object which is having 4 attributes- 1 number type, 3 varchar2 type -p1,p2,p3.
    My function is taking input parameter v1,v2,v3 all of varchar2 type.Inside the function body,i am using these (v1,v2,v3) to filter data from an sql query and i am also
    using pivot function in this sql query.
    At the end my function is returning the object as defined in the starting .
    When i am excuting this function,thru select statement :
    select * from table(f1_test('A','B','C'));
    i am geting p1,p2,p3 as column name ,which are names used when i had defined object type.Instead i want column name to be dynamic (wotever i am passing in function as
    parameter while executing the function ,here A,B,C)
    Please help me in geting column names dynamic as passed in input parameter (i.e A,B,C for this case )
    Sample code for the problem:
    create or replace TYPE obj1 AS OBJECT
    ( id number(5,0)
    ,p1 varchar2(10),
    ,p2 varchar2(10)
    ,p3 varchar2(10)
    create or replace TYPE tt1 AS TABLE OF OBJ1;
    create or replace
    function f1_test (v1 varchar2,v2 varchar2,v3 varchar2)
    return tt1 as
    v_return tt1 ;
    v_str varchar2(30000);
    begin
    v_str:='
    select
    cast(
    multiset(
    select * from
    select
    aa.report_id
    ,cc.name
    ,e.amount
    from
    aa,cc,e
    where
    <join conditions>
    and cc.name in ('''||v1||''','''||v2||''','''||v3||''')
    pivot (sum (amount) for name in ('''||v1||''' as '||v1||','''||v2||''' as '||v2||','''||v3||''' as '||v3||'))
    as tt1)
    from
    dual';
    dbms_output.put_line(v_str);
    execute immediate v_str
    into
    v_return ;
    return v_return;
    end;
    Edited by: 845831 on 20 Mar, 2011 12:15 PM

    select id,p1 A,p2 B,p3 C from table(f1_test('A','B','C'));
    drop function f1_test;
    drop type tt1;
    drop type obj1;
    create or replace TYPE obj1 AS OBJECT
    ( id number(5,0)
    ,p1 varchar2(10)
    ,p2 varchar2(10)
    ,p3 varchar2(10)
    create or replace TYPE tt1 AS TABLE OF OBJ1;
    CREATE OR REPLACE
      FUNCTION f1_test(
          v1 VARCHAR2,
          v2 VARCHAR2,
          v3 VARCHAR2)
        RETURN tt1
      AS
        v_return tt1 ;
        v_str VARCHAR2(30000);
      BEGIN
        v_str:='select cast(multiset(select 1,''20'',''30'',''40'' from dual) as tt1) from dual';
        dbms_output.put_line(v_str);
        EXECUTE immediate v_str INTO v_return ;
        RETURN v_return;
      END;
    /

  • Object view  with nested table and member functions????????????????

    HI frds:)
    I need some help regarding writeing soem queries..
    I have to use view in retreving data and by useing member functions of object.
    1) i have to create a nested table by useing type object.
    2) i have to create a object wtih member functions inorder to create view of taht nested table,.
    3) by useing this objectt view and by useing methods i have to write soem queries ...
    If any one know or any information regarding this please reply me... as i have searched in net alot but i was unable to figure out..
    Thanks....

    // first createing object
    create type emp_det as object
    (empname varcahr2(20),start_date date,end_date date);
    // creating table of that object
    create table emp_detai_table as table of emp_det;
    // creating nested table
    create table empl (emp_no number,emp_detail emp_detail_table,dep_no number)nested table emp_detail store as s;
    //now i want to create view.. inorder to create view i need to create object. in that object i want to create methods.. these methods should work with date attributes..
    after creating object view i need to select or write some queries by useing member methods..
    This is the tast i have to perform.,. i have no materials ...if u have any link ..forward me..
    i have to do it as soon as possible..
    waiting for your reply...

  • Obtain info from nested table in function?

    Oracle9i 9.2.0.1.0/Windows 2000
    I'd like to obtain an ID from a nested table object in order to insert it into an ID field (outside the nested table I'm getting it from). I've got a function that lets me get a foreign key ID from one other table ('objtarget'); but it isn't nested:
    CREATE FUNCTION oeln.get_obj_id(
         obj_type IN oeln.objtarget.objecttarget%type
    RETURN oeln.objtarget.obj_id%type
    IS id_type oeln.objtarget.obj_id%type;
    BEGIN
    SELECT obj_id INTO id_type
    FROM oeln.objtarget
    WHERE oeln.objtarget.objecttarget = obj_type;
    RETURN(id_type);
    END;
    SELECT obj_id
    FROM oeln.objtarget
    WHERE obj_id = get_obj_id('');
    I'm getting compilation errors on functions to obtain ID's from nested tables instead. I've got the table 'opt' (includes the fields 'opt_id' & 'optics'). The 'optics' field in opt is of type o_tab(o_ty), including the field 'optinfo'. I'd like to get the opt_id out of the opt table, from input I obtain for the optinfo field: i.e.,
    SELECT opt_id
    FROM oeln.opt
    WHERE opt_id = get_opt_id('');
    In other words, I'd like to get opt_id from the opt table like I get obj_id from the objtarget table; but instead of looking it up by objecttarget I've got to look it up by optinfo, a field in a nested table object in the opt table itself. I've only gotten compilation errors on functions in order to do this. Is this an option?
    - Noel

    select * from table(v_names);
    I guess ,here you were trying to put the content of the NT into another NT, or just trying to print it.
    But, I don't think INTO Clause is mandatory here.
    Please check your modified code (w/o INTO) and the output :
    DECLARE
       TYPE string_table IS TABLE OF VARCHAR (100);
       v_names   string_table := string_table ();
       v_test    string_table := string_table ();
    BEGIN
       v_names.EXTEND (3);
       v_names (1) := 'name1';
       v_names (2) := 'name2';
       v_names (3) := 'name3';
       DBMS_OUTPUT.put_line ('Old collection - '||v_names (1));
       DBMS_OUTPUT.put_line ('Old collection - '||v_names (2));
       DBMS_OUTPUT.put_line ('Old collection - '||v_names (3));
       DBMS_OUTPUT.put_line ('Old collection - '||v_names.COUNT ());
       DBMS_OUTPUT.put_line (CHR(10));
       /* SELECT * FROM TABLE (v_names); */
       v_test := v_names;
       DBMS_OUTPUT.put_line ('New collection -- '||v_test (1));
       DBMS_OUTPUT.put_line ('New collection -- '||v_test (2));
       DBMS_OUTPUT.put_line ('New collection -- '||v_test (3));
       DBMS_OUTPUT.put_line ('New collection -- '||v_test.COUNT ());
       DBMS_OUTPUT.put_line (CHR(10));
       /* Printing using FOR LOOP */
       FOR i IN v_test.FIRST..v_test.LAST
       LOOP
         DBMS_OUTPUT.put_line ('In FOR Loop --- '||v_test (i));
       END LOOP;
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line ('Error ' ||SQLERRM|| DBMS_UTILITY.format_error_backtrace);
    END;gives o/p :
    Old collection - name1
    Old collection - name2
    Old collection - name3
    Old collection - 3
    New collection -- name1
    New collection -- name2
    New collection -- name3
    New collection -- 3
    In FOR Loop --- name1
    In FOR Loop --- name2
    In FOR Loop --- name3Refer this link -- http://docs.oracle.com/cd/E11882_01/appdev.112/e17126/tuning.htm#CIHGGBGF
    Edited by: ranit B on Dec 26, 2012 2:29 PM
    -- code modified
    Edited by: ranit B on Dec 26, 2012 2:45 PM
    -- code 'again' updated -- FOR LOOP added

  • Returning a nested table in a constructor function

    Hi there is it possible to return a nested table in a Constructor Function or do I need to create a package?
    I have this package spec it gives me an error
    create or replace type
    INTERFACE.PDE_BKRF_NTB
    as table of
    PDE_BKRF_TYP,
    -- Define a constructor for REF_TYP_CD and REF_KEY to return a list.
    constructor function
    PDE_BKRF_TYP
    (P_REF_TYP_CD varchar2
    ,P_REF_KEY number
    ,P_EXTR_DT date)
    return SELF as result
    /

    No, a NESTED TABLE type can't have a constructor I think.
    Check the documentation:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_8001.htm#i2121881
    It distinguishes between object type, varray type and nested table type. Only object types can have constructors.
    As a workaround you could create another object type that has an attribute of your nested table type:
    Note: untested code
    create or replace type
    INTERFACE.PDE_BKRF_NTB
    as table of
    PDE_BKRF_TYP;
    create or replace type INTERFACE.PDE_BKRF_NTB_2
    as object (
    a INTERFACE.PDE_BKRF_NTB,
    constructor function
    PDE_BKRF_NTB_2
    (P_REF_TYP_CD varchar2
    ,P_REF_KEY number
    ,P_EXTR_DT date)
    return SELF as result)
    create or replace type body INTERFACE.PDE_BKRF_NTB_2
    as
    constructor function
    PDE_BKRF_NTB_2
    (P_REF_TYP_CD varchar2
    ,P_REF_KEY number
    ,P_EXTR_DT date)
    return SELF as result as
    /Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Calling a Function returing(Out parameter) Nested Table Rows in Java

    Hi,
    I am trying to call a Function which returns Nested Table rows (as Out Parameter) in Java .
    When I am trying to use
    pstmt.registerOutParameter(3, OracleTypes.OTHER);
    to capture the Out parameter in Java code , I get the follwoing error :
    java.sql.SQLException: Invalid column type
    I have even tried using OracleTypes.JAVA_OBJECT ,but I get the same error.
    If I use OracleTypes.JAVA_STRUCT I get
    java.sql.SQLException: Parameter Type Conflict: sqlType=2008
    error.
    Please help .
    Am I doing the right thing ?
    Thanks in advance.
    Ninad

    Ninad,
    Search this forum's archives for STRUCT and ARRAY and peruse the "Collections" examples on this Web page:
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/jdbc20/jdbc20.html
    Good Luck,
    Avi.

  • Table function on a collection in Dynamic SQL

    Hello,
    I am trying to create a refcursor by selecting from a collection using table function.
    If I use the Select statement the query executes, but if I put the Select statement in a string
    the collection variable does not get resolved. The resaon I am putiing it in a string is because the
    WHERE clause will be passed a parameter. The code below is an anonymous block but will be changed to a
    procedure once I get it to work.
    I have tried many different ways but was unsuccessful.
    Please see if anybody cann assist or what I am trying to achive is not possible, so provide an alternative.
    The error I am getting is
    ORA-00904: "V_ALARM_REC_TABLE": invalid identifier
    ORA-06512: at line 50
    Thanks.
    Bimal
    DECLARE
    TYPE c_refcurtype IS REF CURSOR;
    x c_refcurtype;
    p_recordset c_refcurtype;
    v_rec mc2_dev2.mc2_alarm_rec_type := mc2_dev2.mc2_alarm_rec_type(null,null,null,null,null,null,null,null,
    null,null,null,null,null,null,null,null,
    null,null,null,null,null,null,null);
    v_alarm_rec_table mc2_dev2.mc2_alarm_rec_table := mc2_dev2.mc2_alarm_rec_table();
    v_select varchar2(200) := 'select a.* from ';
    v_table varchar2(200) := 'table(v_alarm_rec_table) a ';
    v_where varchar2(200) := 'where a.alarm_rule_def_uid = 9';
    v_query varchar2(32000);
    BEGIN
    MC2_ALARM.create_mc2_alarm(x, 1); --- ( X is a refcursor, which I will use to populate v_alarm_rec_table a (nested table collection)
    LOOP
    FETCH x INTO v_rec.record_cnt,
    v_rec.rn,
    v_rec.alarm_precision_order,
    v_rec.alarm_rule_def_uid,
    v_rec.alarm_type_def_uid,
    v_rec.alarm_rule_scope_uid,
    v_rec.trigger_tpl_master_uid,
    v_rec.alarm_scope_def_uid,
    v_rec.alarm_object_uid,
    v_rec.error_type,
    v_rec.all_error_codes,
    v_rec.enabled,
    v_rec.start_hour,
    v_rec.end_hour,
    v_rec.day_type,
    v_rec.alarm_severity_def_uid,
    v_rec.on_watch_duration,
    v_rec.update_on_status_change,
    v_rec.log_ind,
    v_rec.email_to,
    v_rec.email_from,
    v_rec.send_email,
    v_rec.stale_period;
    EXIT WHEN x%NOTFOUND;
    v_alarm_rec_table.extend;
    v_alarm_rec_table(v_alarm_rec_table.last) := v_rec;
    END LOOP;
    CLOSE x;
    v_query := v_select||v_table||v_where; -- ERROR OCCURS AT THIS LINE as it cannot resolve the TABLE name  v_alarm_rec_table)
    dbms_output.put_line('sql: '||v_query);
    OPEN p_recordset FOR v_query;
    LOOP
    FETCH p_recordset INTO v_rec.record_cnt,
    v_rec.rn,
    v_rec.alarm_precision_order,
    v_rec.alarm_rule_def_uid,
    v_rec.alarm_type_def_uid,
    v_rec.alarm_rule_scope_uid,
    v_rec.trigger_tpl_master_uid,
    v_rec.alarm_scope_def_uid,
    v_rec.alarm_object_uid,
    v_rec.error_type,
    v_rec.all_error_codes,
    v_rec.enabled,
    v_rec.start_hour,
    v_rec.end_hour,
    v_rec.day_type,
    v_rec.alarm_severity_def_uid,
    v_rec.on_watch_duration,
    v_rec.update_on_status_change,
    v_rec.log_ind,
    v_rec.email_to,
    v_rec.email_from,
    v_rec.send_email,
    v_rec.stale_period;
    EXIT WHEN p_recordset%NOTFOUND;
    some dbms_output statements...
    END LOOP;
    END;
    The error I am getting is
    ORA-00904: "V_ALARM_REC_TABLE": invalid identifier
    ORA-06512: at line 50

    Thanks Timur/Solomon,
    mc2_dev2 is the schema name.
    mc2_alarm_rec_table is a SQL type.
    Here are the scripts:
    CREATE OR REPLACE TYPE MC2_DEV2.mc2_alarm_rec_type IS OBJECT
    ( record_cnt NUMBER,
    rn number,
    alarm_precision_order NUMBER(6),
    alarm_rule_def_uid NUMBER(6),
    alarm_type_def_uid NUMBER(6),
    alarm_rule_scope_uid NUMBER(6),
    trigger_tpl_master_uid NUMBER(6),
    alarm_scope_def_uid NUMBER(6),
    alarm_object_uid NUMBER(6),
    error_type VARCHAR2(1),
    all_error_codes VARCHAR2(1),
    enabled VARCHAR2(1),
    start_hour NUMBER(2),
    end_hour NUMBER(2),
    day_type NUMBER(2),
    alarm_severity_def_uid NUMBER(6),
    on_watch_duration NUMBER(6),
    update_on_status_change VARCHAR2(1),
    log_ind VARCHAR2(1),
    email_to VARCHAR2(128),
    email_from VARCHAR2(128),
    send_email VARCHAR2(1),
    stale_period          NUMBER(6)
    CREATE OR REPLACE TYPE MC2_DEV2.MC2_ALARM_REC_TABLE IS TABLE OF MC2_DEV2.mc2_alarm_rec_type;
    If I popoulate the cursor with the following code:
    OPEN p_recordset FOR
    select a.* from table (v_alarm_rec_table) a where a.alarm_rule_def_uid = 9;
    there is no issue it works just fine.
    But when when I use
    OPEN p_recordset FOR v_query; ---- where v_query := v_select||v_table||v_where;
    the variable v_alarm_rec_table does not get resolved.
    Regards,
    Bimal

  • Nested Tables and Advanced Queues- Please Help.

    How do i work with NestedTable type and Advanced Queue.
    I have done the following
    I have Oracle 8.1.7 enterprise edition.
    create type myType as TABLE OF varchar(32);
    create type myObject as OBJECT (
    id int,
    myt myType);
    DECLARE
    BEGIN
    dbms_aqadm.create_queue_table(
    queue_table => 'my_queue_table',
    multiple_consumers => TRUE,
    queue_payload_type => 'myObject',
    compatible => '8.1.3'
    END;
    The Nested Table and Object are created successfully.
    but the queue is not created.
    I get the following message.
    DECLARE
    ERROR at line 1:
    ORA-22913: must specify table name for nested table column or
    attribute
    ORA-06512: at "SYS.DBMS_AQADM_SYS", line 2012
    ORA-06512: at "SYS.DBMS_AQADM", line 55
    ORA-06512: at line 3
    I know how to specify the nested table storage clause for
    create table statement, but there is no provision for
    it in the create_queue_table procedure.
    Any help will be greately appriciated.
    i have already created and tested aqs with simple data types,
    also i have created simple tables with nested table type
    elements.
    but the combo of Nested tables and AQ is not working.
    thanks in advance.

    Hi Francois. Thank you very much for your reply, but it seems that i still get errors. So let me tell what i have done.
    As you suggested me: i have done a block based on a sub-query for the nested-table:
    'select courses from department where name= :department.name'.
    In the master block(department) i have the when-new-record-instance trigger:
    Declare
    LC$Req varchar2(256);
    Begin
    LC$Req := '(select ns.courses from table
    ( select courses from department where name = ''' || :DEPARTMENT.name || ''' ) ns )';
    Go_block('block11');
    Clear_Block ;
    Set_Block_Property( 'block11', QUERY_DATA_SOURCE_NAME, LC$Req ) ;
    Execute_query ;
    End ;
    Now the errors i receive, this time in the runtime mode are:
    - FRM-41380: Cannot set the blocks query data source
    -FRM-41003: This function cannot be performed here.
    Since it seems that you know how to work with the nested table i would really appreaciate your help. I am new in the nested table and if you could give an ex with my tables it would be great.
    Thank you in advance.

  • 10g Nested Tables and APEX

    Trying to use the following within Apex:
    CREATE TYPE location_typ AS OBJECT (
    location_id NUMBER(4),
    street_address VARCHAR2(40),
    postal_code VARCHAR2(12),
    city VARCHAR2(30),
    state_province VARCHAR2(25));
    CREATE TYPE nt_location_typ AS TABLE OF location_typ;
    CREATE TYPE country_typ AS OBJECT (
    country_id CHAR(2),
    country_name VARCHAR2(40),
    locations nt_location_typ);
    CREATE TYPE nt_country_typ AS TABLE OF country_typ;
    CREATE TABLE region_tab (
    region_id NUMBER,
    region_name VARCHAR2(25),
    countries nt_country_typ)
    NESTED TABLE countries STORE AS nt_countries_tab (
    (PRIMARY KEY (NESTED_TABLE_ID, country_id))
    ORGANIZATION INDEX COMPRESS
    NESTED TABLE locations STORE AS nt_locations_tab);
    Can get Apex to function in the Tabular Report mode by modifying the query to use the correct syntax:
    select "REGION_ID",
    "REGION_NAME",
    c.COUNTRY_ID,
    c.COUNTRY_NAME,
    l.LOCATION_ID,
    l.STREET_ADDRESS, l.POSTAL_CODE,
    l.CITY,
    l.STATE_PROVINCE
    from "#OWNER#"."REGION_TAB", TABLE(COUNTRIES) C, TABLE(LOCATIONS) L
    Built a 'Maintenance' form. Put the Region base column on it. Then built a tabular form (with an updateable query) on the same page to access the first level Nest ( countries). Haven't figured out how to actually edit the values yet, but feel comfortable I will.
    But - trying to provide editing to the 2nd level nested table elements creates a problem. First, only 1 updateable query can be on a page. Hmmm - so to get around this I guess I have to build a new page that the calling updateable query will access when selecting one of the tabular form elements. Not elegant by any means. Was hoping to provide a blank form on the right side that would be populated by the Location Nested Table values when a select was made on the first level nest. Oh well.
    Just curious how anyone has handled this? I could pass stack between pages for sure, but was hoping page regions would be sufficient to handle this.
    Any white papers on this? Anything in the DEMO area to use as a template? The default Demo doesn't provide this based on querying user objects.
    Thanks,
    Dwight Taylor

    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> CREATE OR REPLACE TYPE table_type AS TABLE OF VARCHAR2 (8);
      2  /
    Type created.
    SQL> CREATE TABLE r(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_1;
    Table created.
    SQL> CREATE TABLE s(
      2    a INTEGER,
      3    b table_type)
      4    NESTED TABLE b STORE as b_2;
    Table created.
    SQL> INSERT INTO r VALUES (1, table_type ('a', 'b'));
    1 row created.
    SQL> INSERT INTO s VALUES (1, table_type ('b', 'c'));
    1 row created.
    SQL> COLUMN c FORMAT A10;
    SQL> SELECT r.a, r.b MULTISET UNION DISTINCT s.b c
      2  FROM   r, s
      3  WHERE  r.a = s.a;
             A C
             1 TABLE_TYPE('a', 'b', 'c')
    SQL>

  • Performance impact using nested tables and object

    Hi,
    Iam using oracle 11g.
    While creating a package, iam using lot of nested tables created based on objects which will be passed between multiple functions in the package..
    Will it have any performance impact since all the data is stored in the memory.
    How can i measure the performance impact when the data grows ?
    Regards,
    Oracle User
    Edited by: user9080289 on Jun 30, 2011 6:07 AM
    Edited by: user9080289 on Jun 30, 2011 6:42 AM

    user9080289 wrote:
    While creating a package, iam using lot of nested tables created based on objects which will be passed between multiple functions in the package.. Not the best of ideas in general, in PL/SQL. This is not client code that can lay sole claim to most of the memory. It is server code and one of many server processes that need to share the available resources. So capitalism is fine on a client, but you need socialism on the server? {noformat} ;-) {noformat}
    Will it have any performance impact since all the data is stored in the memory.Interestingly yes. Usually crunching data in memory is better. In this case it may not be so. The memory used is the most expensive memory Oracle can use - the PGA. Private process memory. This means each process copy running that code, will need lots of memory.
    If you're not passing the data structures by reference, it means even bigger demands on memory as the data structure needs to be copied into the call stack and duplicated.
    The worse case scenario is that such code consumes so much free server memory, and make such huge demands on having that in pysical memory, it trashes memory management as the swap daemons are unable to keep up with the demand of swapping virtual memory pages into and out of memory. Most CPU time is spend by the swap daemons.
    I have seen servers crash due to this. I have seen a single PL/SQL process causing this.
    How can i measure the performance impact when the data grows ?Well, you need to look at the impact of your code on PGA memory. It is not SQL performance or I/O performance that is a factor - just how much private process memory your code needs in order to execute.

  • Using SQL with Nested Table

    Hi ,
    Please assist as how can we do this thing
    i have a nested table of object type
    create or replace type a1 as object
    a number,
    b varchar2(30),
    region varchar2(30)
    create type a1_array s table of a1;
    declare
    v_a1 a1;
    v_a1_array a1_array:=a1_array();
      begin
    v_a1= a1(1, '1' , 'AUS');
    v_a1_array.EXTEND;
    v_a1_array(1):=v_a1;
    v_a1= a1(2, '2' , 'AUS');
    v_a1_array.EXTEND;
    v_a1_array(2):=v_a1;
    v_a1= a1(3, '3' , 'NAM');
    v_a1_array.EXTEND;
    v_a1_array(3):=v_a1;
      end;
    Now, i have v_a1_array having 3 rows 2 with AUS region and one with NAM region.
    Using SQL can i extract only 'AUS'  rows and fetch in  ARRAY OF TYPE v_a1_array (using Where clause  and Table () functions )
    Any help will be highly appreciated. Please assist. I have oracle 11g
    Thanks

    Hi,
    GPU has already shown you how to do. I will just modify my original one:
    SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 22 22:14:42 2013
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2     v_a1           a1;
      3     v_a1_array     a1_array := a1_array ();
      4     v_a1_array2    a1_array;
      5  BEGIN
      6     v_a1 := a1 (1, '1', 'AUS');
      7     v_a1_array.EXTEND;
      8     v_a1_array (1) := v_a1;
      9     v_a1 := a1 (2, '2', 'AUS');
    10     v_a1_array.EXTEND;
    11     v_a1_array (2) := v_a1;
    12     v_a1 := a1 (3, '3', 'NAM');
    13     v_a1_array.EXTEND;
    14     v_a1_array (3) := v_a1;
    15
    16     SELECT a1(a, b, region)
    17       BULK COLLECT INTO v_a1_array2
    18       FROM TABLE (v_a1_array)
    19      WHERE region = 'AUS';
    20
    21     FOR c1 IN (SELECT *
    22                  FROM TABLE (v_a1_array2))
    23     LOOP
    24        DBMS_OUTPUT.put_line ('A='||c1.a||', B='||c1.b||', REGION='||c1.region);
    25     END LOOP;
    26  END;
    27  /
    A=1, B=1, REGION=AUS
    A=2, B=2, REGION=AUS
    PL/SQL procedure successfully completed.
    If you consider your question answered, please mark this thread as answered.
    Regards.
    Alberto

  • IN operator in nested tables

    Hi,
    Does anyone can redo an IN operator in nested tables example?
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28371/adobjcol.htm#sthref396
    My example returns no row...
    CREATE TYPE Pilote_elt_nt_type AS OBJECT
    (brevet VARCHAR(4), nomPil VARCHAR(15),
    MAP MEMBER FUNCTION get_brevet RETURN VARCHAR)
    CREATE TYPE BODY Pilote_elt_nt_type AS
    MAP MEMBER FUNCTION get_brevet RETURN VARCHAR IS
    BEGIN
    RETURN brevet;
    END get_brevet ;
    END;
    CREATE TYPE Pilotes_nt_type AS TABLE OF Pilote_elt_nt_type
    CREATE TABLE Compagnie
    (numComp VARCHAR2(2) PRIMARY KEY,
    nomComp VARCHAR2(20),
    commandants_nt Pilotes_nt_type,
    instructeurs_nt Pilotes_nt_type,
    pilotes_nt Pilotes_nt_type)
    NESTED TABLE commandants_nt STORE AS commandants_tabnt
    NESTED TABLE instructeurs_nt STORE AS instructeurs_tabnt
    NESTED TABLE pilotes_nt STORE AS pilotes_tabnt;
    INSERT INTO Compagnie
    VALUES ('C1','Air France',
    Pilotes_nt_type (
              Pilote_elt_nt_type ('PL-1','C. Sigaudes'),
    Pilote_elt_nt_type ('PL-3','A. Bidal'),
    Pilote_elt_nt_type ('PL-2','S. Payrissat')
    Pilotes_nt_type (
              Pilote_elt_nt_type ('PL-2','S. Payrissat')
    Pilotes_nt_type (          
    Pilote_elt_nt_type ('PL-3','A. Bidal'),
    Pilote_elt_nt_type ('PL-1','C. Sigaudes'),
              Pilote_elt_nt_type ('PL-4','F. Périssel')) );
    SELECT p.nomPil
    FROM Compagnie, TABLE(commandants_nt) p;
    SELECT p.nomPil
    FROM Compagnie, TABLE(instructeurs_nt) p;
    SELECT p.nomPil
    FROM Compagnie, TABLE(pilotes_nt ) p;
    --no row !
    SELECT p.nomPil
    FROM Compagnie, TABLE(commandants_nt) p
    WHERE commandants_nt IN (pilotes_nt,instructeurs_nt);

    Actually, my general advices are not my original advices, but (mostly) C.J.Date's advices.
    I'm IT practitioner (not IT scientists), but I highly appreciate work (theoretical and practical) of IT scientists like
    Edsger W.Dijkstra, C.Antony.R Hoare, John W.Backus, Peter Naur, Ole-Johan Dahl, Kristen Nygaard, Donald E.Knuth,
    Niklaus E.Wirth, Alan C.Kay, Edgar F.Codd, Christopher J.Date, Bertrand Meyer ... and many more.
    I like OOPL's, especially Eiffel. But mostly I like relational model and relational DBMS's.
    My motto is: “Thou shall not do in the Middle Tier, what thou could have done in the Data Tier”
    (Toon Koppelaars in "A first JDeveloper project: Choices made, lessons learned", Oracle World 2002).
    First, I don't like to use REF's in Oracle (relational) DBMS.
    C.J.Date in "An introduction to Database Systems" (eighth edition, 2004, chapter 26) says:
    - "The Second Great Blunder consists of mixing pointers [REF's] and relations"
    - "The Second Great Blunder undermines the conceptual integrity of the relational model in numerous ways"
    Second, using nested tables in relational database is "legal". In the same book (page 373) Date says:
    "... it is possible for a relation to include an attribute whose values are relations in turn...
    Historically, in fact, such relvars [relation variables] were not even legal -
    they were said to be unnormalized, meaning they were not even regarded as being in 1NF".
    But, note that on the same page Date says:
    "From the point of view of database design, however, such relvars are usually contraindicated,
    because they tend to be asymmetric ... and such asymmetry can lead to various practical problems".
    So, we can use nested tables (relational-valued attributes), but very very sparingly, and I agree with Billy (Verreynne):
    I also think this design of yours (using nested tables instead of normal relational tables) it a very much flawed approach. Third, I use object types as domains. In the same book (page 885) Date says:
    "... object/relational systems ... are, or should be, basically just relational systems that support the relational domain concept (i.e., types) properly
    - in other words, true relational systems, meaning in particular systems that allow users to define their own types".
    Here is my attempt to use Oracle "object-relational" features "in the proper way" (in Date's sense) - to use object type as domain:
    “OR(DBMS) or R(DBMS), That is the Question”
    http://www.quest-pipelines.com/pipelines/plsql/tips.htm#OCTOBER
    Date says that "The First Great Blunder" is to equate object classes and relational variables,
    simply speaking - to have object tables (tables in which each row represents an object).
    I must say that I'm not 100% sure about "The First Great Blunder" in Oracle (see Re: to REF or not to REF? or Re: difference between value and deref clause in oop).
    Date says that one consequence of "The First Great Blunder" is to have subtables and supertables.
    Subtables and supertables exists in SQL:1999 standard. But, in Oracle we can't say (SQL:1999 syntax):
    CREATE TABLE programmer_obj_tab OF programmer_type UNDER emp_obj_tab;
    Oracle hasn't (explicit) subtables and supertables.
    I recommend to you Billy's threads - you can find many excellent advices and opinions.
    Regards,
    Zlatko

  • How to use nested table values in IN expression?

    Hi!
    Can someone please give me a hint to the correct syntax for this:
    declare
    TYPE numtable is table of number;
    tt numtable;
    begin
      select myId bulk collect into tt from some_table;
      update some_other_table set name = 'kakadu' where xId in (select * from tt); -- this line is wrong as it is
    end;What I am doing is fixing a stored procedure that was like this before:
    update table_a set name = 'kakadu' where column_X in (select one.A from table_1 one join table_a on x y z WHERE a b c);
    update table_b set name = 'nimfa'  where column_Y in (select one.B from table_1 one join table_a on x y z WHERE a b c);The problem is, the first UPDATE changes the result of the SELECT, so I want to "remember" it.
    A and B are columns in table_1, A is the primary key. So the fixed code would be like:
    -- store the list of selected IDs from table_1
      select A bulk collect into tt from table_1 one join table_a on x y z WHERE a b c ; -- same conditions as in old code
    -- do the updates
      update table_a set name = 'kakadu' where column_X in (select * from tt);
      update table_b set name = 'nimfa' where column_Y in (select one.B from table_1 one where one.A in tt);(it can be a varray instead of nested table, as far as I am concerned)
    Thanks,
    David

    Yes, it needs to be a SQL type
    Re: How to pass an array to a function from a SELECT statement
    Or you can use a built in SQL type (version dependent)
    Re: Collection in where not working

Maybe you are looking for

  • Spry submenus overlap menu in Internet Explorer

    Hi, I'm working on a spry menu, and it looks exactly how i want it in Firefox, but in Explorer my submenus shift to the left and overlap my menu a lot. Also on my horizontal menu, the whole menu shows up shifted to the left and to the top in Explorer

  • JCO API which accepts system

    Hi all, I want to use JCO API to connect to R/3 and call my BAPI (i.e, I am not using the JCO destination which we normally create in Web dynpro content administartor screen). This is specially for MODEL DATA (i.e., to get the application data). I fo

  • Duplex scan option missing on HP Officejet Pro 8500

    Moved to another board Although I am an HP employee, I am speaking for myself and not for HP. Twitter: @Ciara_B_HP

  • Package not found javax.sql.*

    Hi I'm trying to import the following and compile. It prompts me package not found for javax.sql.* ? Any idea what is going wrong ? Thanks. import java.io.*; import java.sql.*; import java.util.*; import javax.sql.*; import javax.naming.*;

  • DLL Call works fine with 1 cluster input but bombs with 2

    I have some problems getting my DLL to work using 2 cluster inputs.  I create a simple DLL (MS C++ Express 2010) with 1 cluster and 1 struct Input and everything works.  If I add a second cluster/struct, Labview bombs and disappears, Even if it's the