Nested table - how to reference internal column without a name??

Hi guys, I've a question regarding nested tables - Ive searched around and cant find an answer.
Heres my sample code :
CREATE OR REPLACE TYPE scotttype AS table of number;
create table scott1 (col_a varchar2(10), col_b scotttype) nested table col_b store as col_b
insert into scott1 values ('onetwo',scotttype(1,2))
insert into scott1 values ('threefour',scotttype(3,4))
select t1.col_a, column_value col_b
from scott1 t1, TABLE(t1.col_b) t2
insert into table(select s.col_b FROM scott1 s WHERE s.col_a = 'onetwo')
values (5);Ok, so that seems fine.
If I want to do an update or delete though, how can I reference col_b as the nested table doesnt have a column name ?
Ie :
update table(select col_b from scott1 where col_a = 'onetwo') col_b
set col_b.XXXXX = 6
where col_b.XXXXX = 5won't work - so what do I put in place of the XXXXX ???
I'm sure its simple, but I can't find it!
Thanks all

SQL> select t1.col_a, column_value col_b
  2  from scott1 t1, TABLE(t1.col_b) t2;
COL_A           COL_B
onetwo              1
onetwo              2
threefour           3
threefour           4
onetwo              5
SQL> commit;
Commit complete.
SQL> update table(select col_b c1 from scott1 where col_a = 'onetwo') t1
  2  set column_value = 6
  3  where column_value= 5;
1 row updated.
SQL> commit;
Commit complete.
SQL>  select t1.col_a, column_value col_b
  2   from scott1 t1, TABLE(t1.col_b) t2;
COL_A           COL_B
onetwo              1
onetwo              2
threefour           3
threefour           4
onetwo              6
SQL>

Similar Messages

  • How to reference a class without using the new keyword

    I need to access some information from a class using the getter, but I don't want to use the new keyword because it will erase the information in the class. How can I reference the class without using the new keyword.
    ContactInfo c = new ContactInfo(); // problem is here because it erases the info in the class
    c.getFirstName();

    quedogf94 wrote:
    I need to access some information from a class using the getter, but I don't want to use the new keyword because it will erase the information in the class. How can I reference the class without using the new keyword.
    ContactInfo c = new ContactInfo(); // problem is here because it erases the info in the class
    c.getFirstName();No.
    Using new does not erase anything. There's nothing to erase. It's brand new. It creates a new instance, and whatever that constructor puts in there, is there. If you then change the contents of that instance, and you want to see them, you have to have maintained a reference to it somewhere, and access that instance's state through that reference.
    As already stated, you seem to be confused between class and instance, at the very least.
    Run this. Study the output carefully. Make sure you understand why you see what you do. Then, if you're still confused, try to rephrase your question in a way that makes some sense based on what you've observed.
    (And not that accessing a class (static) member through a reference, like foo1.getNumFoos() is syntactically legal, but is bad form, since it looks like you're accessing an instance (non-static) member. I do it here just for demonstration purposes.)
    public class Foo {
      private static int numFoos; // class variable
      private int x; // instance varaible
      public Foo(int x) {
        this.x = x;
        numFoos++;
      // class method
      public static int getNumFoos() {
        return numFoos;
      // instance method 
      public int getX() {
        return x;
      public static void main (String[] args) {
        System.out.println ("Foo.numFoos is " + Foo.getNumFoos ());
        System.out.println ();
        Foo foo1 = new Foo(42);
        System.out.println ("Foo.numFoos is " + Foo.getNumFoos ());
        System.out.println ("foo1.numFoos is " + foo1.getNumFoos ());
        System.out.println ("foo1.x is " + foo1.getX ());
        System.out.println ();
        Foo foo2 = new Foo(666);
        System.out.println ("Foo.numFoos is " + Foo.getNumFoos ());
        System.out.println ("foo1.numFoos is " + foo1.getNumFoos ());
        System.out.println ("foo1.x is " + foo1.getX ());
        System.out.println ("foo2.numFoos is " + foo2.getNumFoos ());
        System.out.println ("foo2.x is " + foo2.getX ());
        System.out.println ();
    }

  • Nested Table: How to display formatted text in the form ?

    Hi,
    Scenario:
    I have a nested table, say TAB1, containing another table TAB2 which holds the formatted text.
    Sample data
    Entries in TAB1:
    Column1       Column2(TAB2)
    Text1         Data_from_tab2
    Text2         Data_from_tab2
    Text3         Data_from_tab2
    Requirement:
    The requirement is to display the data in TAB1 as it is maintained.
    Trials:
    I am aware of the fact that we can transfer the content of the nested table (in this scenario, TAB2) in another table(of type TLINE) defined as a global variable in the interface of the form. Then in the context area, we can define a 'TEXT' node and bind it to the table and choose the 'Dynamic text' for the 'text type' attribute and maintain the other atrributes.
    But this approach cannot solve the issue as it is a nested table.
    Kindly suggest how can I resolve this issue.
    Regards
    s@k

    Hi,
    if its like colum1, column2 (tab2).
    you can represent column2 as a nested table in the form. and put these tables structure intoa subform of type flowed.
    then you can have the required format.
    the same can also be acheived using nested subforms instead of tables.
    example of such scenario is PO & line items.
    po number1 , items 1
                          item 2
                          item 3
    po number2 , items 1
                          item 2
                          item 3
    hope this helps you.
    Cheers,
    Sai

  • Nested Table having more than 1 column comparison using ORACLE MULTISET

    Dear ALL,
    I am using ORACLE 10gR2 Database.
    I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
    But When I am executing the below given code I am getting the error.
    PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
    My Code
    declare
    type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
    device_info_id number,scope_id number,excep_id number,
    config_date date);
    type wh_previous_data_table is table of wh_unique_record;
    wh_previous_data wh_previous_data_table;
    wh_current_data wh_previous_data_table;
    wh_union_data wh_previous_data_table;
    wh_intersect_data wh_previous_data_table;
    -- This cursor I am using to populate the data into the nested tables
    cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
    cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
    begin
    open c_previous_data;
    fetch c_previous_data bulk collect into wh_previous_data;
    close c_previous_data;
    open c_current_data;
    fetch c_current_data bulk collect into wh_current_data;
    close c_current_data;
    dbms_output.put_line('Previous count '||wh_previous_data.count);
    dbms_output.put_line('Current count '||wh_current_data.count);
    --FYI: MULTISET UNION IS WORKING.*
    wh_union_data := wh_current_data multiset union wh_previous_data;
    dbms_output.put_line('New count '||wh_union_data.count);
    wh_intersect_data:=wh_current_data MULTISET EXCEPT  wh_previous_data;
    dbms_output.put_line('The records that are repeating are  '||wh_intersect_data.count);
    end;
    Previous count 74062
    Current count 74508
    New count 148570
    PL/SQL procedure successfully completed.
    FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
    IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
    Appreciate your help on this.
    Thanks,
    Madhu K.

    Madhu,
    I am totally amazed. I didn't think any of the MULTISET operations would work with NTs of records. Lucky you!
    As for the EXCEPT, well, clearly it is a restriction or bug in PL/SQL.
    You may want to report it to Oracle Support.
    Regards,SF
    At 11:45 AM 10/1/2009, you wrote:
    Dear Steven,
    I am using ORACLE 10gR2 Database.
    I am currently trying to compare two sets of data that I get from two queries in PL/SQL. I want to use Oracle MULTISET UNION, MULTISET INTERSECT, MULTISET EXCEP for those operations.
    But When I am executing the below given code I am getting the error.
    PLS-00306: wrong number or types of arguments in call to 'MULTISET_EXCEPT_ALL'
    My Code
    declare
    type wh_unique_record is record (cpy_key number(22),cnc_id varchar2(22),cust_type_id number,
    device_info_id number,scope_id number,excep_id number,
    config_date date);
    type wh_previous_data_table is table of wh_unique_record;
    wh_previous_data wh_previous_data_table;
    wh_current_data wh_previous_data_table;
    wh_union_data wh_previous_data_table;
    wh_intersect_data wh_previous_data_table;
    -- This cursor I am using to populate the data into the nested tables
    cursor c_previous_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('06-jul-2009','dd-mon-yyyy'));
    cursor c_current_data is select cpy_key,cnc_id,cust_type_id,device_info_id,scope_id,excep_id,config_date
    from r_cfg_wh_excep
    where cpy_key=17278
    and trunc(config_date)=trunc(to_date('16-jul-2009','dd-mon-yyyy'));
    begin
    open c_previous_data;
    fetch c_previous_data bulk collect into wh_previous_data;
    close c_previous_data;
    open c_current_data;
    fetch c_current_data bulk collect into wh_current_data;
    close c_current_data;
    dbms_output.put_line('Previous count '||wh_previous_data.count);
    dbms_output.put_line('Current count '||wh_current_data.count);
    --FYI: MULTISET UNION IS WORKING.
    wh_union_data := wh_current_data multiset union wh_previous_data;
    dbms_output.put_line('New count '||wh_union_data.count);
    wh_intersect_data:=wh_current_data MULTISET EXCEPT wh_previous_data;
    dbms_output.put_line('The records that are repeating are '||wh_intersect_data.count);
    end;
    Previous count 74062
    Current count 74508
    New count 148570
    PL/SQL procedure successfully completed.
    FYI: If I comment the MULTISET EXCEPT conditin then I am getting the output for MULTISET UNION.
    IS THERE ANY WAY ORACLE IS PROVIDING A FUNCTIONALITY WHERE WE CAN HAVE A NESTED TABLE WITH MULTIPLE COLUMNS AND THAT CAN BE USED IN PL/SQL AND USE BULK OPERATION TO POPULATE THE NESTED TABLE WITH MULTIPLE COLUMNS AND USE THE SAME IN MULTISET EXCEPT, MULTISET EXCEPT ETC.
    Appreciate your help on this.
    Thanks,
    Madhu K.

  • How to reference a column value in a particular block.

    I am having problem in referencing a column in a particular Block in WEBi report.
    Scenario: I have only one query in the query panel and i am creating a sample report having different blocks.
                   Now there are four blocks in my report,
                   1st Block: It it a table with two columns [country name], [Turn over]. Now this is converted into pie chart.
                   2nd Block: It is the same table as above but it is linked with the block 1 so that whenever i clicked on a particular company name
                                   in the pie-chart then this block will be showing only the company name and its turn over for that particular company.
                   3rd Block: It is also the same table as above having same columns but it is showing top five company names and their turn over value.
                                   I used ranking function through a variable for impelmenting this.
                   4th Block: It is a table having columns [Company Code], [Company Name], [Turn over], [Company Address].
    Problem:  Now i want to show hide 4th block when the [company name] value in 2nd block lies in the list of top 5 companies in 3rd block or else 4th block
                   will show the table having complete info of the particular company which has been clicked in the pie-chart and 2nd block will be showing the
                    comapny name and its turn over value.
    Please help me with this problem as soon as possible, i am learning WEBi tool and now i am stuck with this use case.

    Hello Surabh,
    Thank you for providing an example, from the example try the steps from 3rd block to reach your requirement
    1st block: Let's say i clicked on country name- ITALY in the pie chart.
    2nd block: Now the second block will be showing ITALY in column [country name] and its turnover in [Turn Over] column
    3rd block: This block is showing the names of top 5 countries in column [country name]  on the basis of their turnover and their corresponding turnover in column [Turn Over].
    Here on 3rd block you have to place  logic for ranking
    1. Create a report level variable of type Dimension with name "Ranking"
    Ex:
    =NoFilter((Rank([Turn Over];[Country name];Top)))
    2. Add a block filter as:[Ranking]Less than or equal to 5 , to show top 5 countries
    3. Create a new Dimension Variable with name(As you like) "Show" with the below definition
    =If([Ranking]>5;1;0)
    4. Add the Variable Dimensions created [Ranking], [Show] objects to2nd block
    * Right click on [Show] column and choose "Hide" ->"Hide dimension", this will hide [Show] column from the table.
    * Select 2nd block right click, select 'Format Table'->Select the check box "Hide when following formula is true" and define a condition as
    =([Show]=1)
    5. On 4th block add Variable dimension objects created [Ranking], [Show]
    * Right click on [Show] column and choose "Hide" ->"Hide dimension", this will hide [Show] column from the table.
    * Select 2nd block right click, select 'Format Table'->Select the check box "Hide when following formula is true" and define a condition as
    =([Show]=0)
    With this when rank of a country greater than 5 then block 3 will be displayed, otherwise block 4 will be displayed.
    Hope this answers your requirement
    ~Manoj

  • How to reference cluster by their string name

    I have a program that contains 6 clusters of the same structure. I'd like to have a for loop to initialize the clusters to default values in stead of wiring 6 times to 6 different clusters. I've been thinking to programmably reference them by their string name, and then use an enum type to loop through their names. Is there a way to reference the cluster by name programmably?

    You can get a list of front panel objects from teh FP property and then find the controls with the names you want.
    SInce the refs to the objects will be generic array you will have to cast the refs so look over this nugget on using control references (stop after you find what you want, the nugget gets dirty at teh end).
    Have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to reference new columns in a form

    If I have created a form application component and the
    underlying table changes, i.e., a new column is added, how do I
    reference that new column in my form without having to delete
    the application component and recreating it?

    Chetan,
    Thanks for the confirmation - the answer was as I feared.
    ORACLE - can you confirm whether this will be addressed in the
    next release of portal as it a major pain having to recreate
    from scratch a Form (that is likely to have many customizations
    to make it useful) just to add a new column that was previously
    ommitted or to reflect a schema change - which is especially
    likely to occur during the development cycle of an application.

  • How to disable internal battery without a display?

    The display on my T440s is dead.  I would like to remove the hard drive before sending the laptop in.  The user guide says to disable the internal battery before moving the hard drive - but this requires access to the BIOS configuration, which cannot be done on an external monitor.
    Is it essential to disable the internal battery before removing the SSD?  If so, how can I do this?
    Thanks

    SQL> select t1.col_a, column_value col_b
      2  from scott1 t1, TABLE(t1.col_b) t2;
    COL_A           COL_B
    onetwo              1
    onetwo              2
    threefour           3
    threefour           4
    onetwo              5
    SQL> commit;
    Commit complete.
    SQL> update table(select col_b c1 from scott1 where col_a = 'onetwo') t1
      2  set column_value = 6
      3  where column_value= 5;
    1 row updated.
    SQL> commit;
    Commit complete.
    SQL>  select t1.col_a, column_value col_b
      2   from scott1 t1, TABLE(t1.col_b) t2;
    COL_A           COL_B
    onetwo              1
    onetwo              2
    threefour           3
    threefour           4
    onetwo              6
    SQL>

  • How to reference SQL column value for  page item text field

    greetings,
    I created a simple report based on sql query. the query is select employeeid,salary from emp_tbl. under the report column i see employeeid and salary. I created a page item text field with the source type pl/sql function body. inside this source is simple block.
    begin
    if salary < 10000 then
    return (1);
    else
    return (2);
    end if;
    end;
    from the error i take it that it doesn't understand salary. I have tried bind variable (:salary) , hash marks (#salary#), ampersand (&salary.) but nothing works. Is this even possible?
    thank you,
    mon

    Hi Mon,
    I think you will find that anything you do in Forms, you can achieve in Apex, but you may have to think a little differently. Finding direct equivalents in both environments may not be easy or even possible in some circumstances, but with a little knowledge and thought an equivalent overall business flow can be achieved that is just as efficient.
    For example, in Forms where you have a multi row block based on a table, if you need to add any derived fields then you will add these at the block level. I can see that this is what you are trying to achieve in Apex.
    In Apex this will be more easily achieved by specifying the derived fields as part of the query for the region, and if the derivation of the fields is complex you can use user defined functions. If you require page type items to be displayed such as text boxes, LOV's, radiogroups, datepickers etc then these can be embedded in the query with the use of the Apex API, see the APEX_ITEM supplied package.
    I know this is still very high level, but I hope it helps you on your way in your journey with Apex.
    Regards
    Andre

  • Table - How to get even column widths automatically

    Hi all:
    For example, a nested one-row, seven-cell table for a nav
    bar.
    Do I have to do a CSS rule?
    Ever grateful !

    Just use CSS to 'prop' the cells open with a width.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Ken Binney" <[email protected]> wrote
    in message
    news:f2t38g$s7j$[email protected]..
    > As posted above - equal cell width solution
    >
    >
    > "Murray *ACE*" <[email protected]>
    wrote in message
    > news:f2t2v8$rt5$[email protected]..
    >> For what?
    >>
    >> --
    >> Murray --- ICQ 71997575
    >> Adobe Community Expert
    >> (If you *MUST* email me, don't LAUGH when you do
    so!)
    >> ==================
    >>
    http://www.dreamweavermx-templates.com
    - Template Triage!
    >>
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >>
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >>
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    >> ==================
    >>
    >>
    >> "Ken Binney"
    <[email protected]> wrote in message
    >> news:f2t1hr$qa9$[email protected]..
    >>> Hi all:
    >>>
    >>> For example, a nested one-row, seven-cell table
    for a nav bar.
    >>> Do I have to do a CSS rule?
    >>>
    >>> Ever grateful !
    >>>
    >>
    >>
    >
    >

  • Finder-How to set resize column without handle

    I want to change my finder divider column from having handles to resize the the column....  Where you have to drag the handle or double click it to resize the column.
    I want it to have just the Line that divides the columns... Where you can double click anywhere on the line to resize the column.
    From this...
    To this...

    to set column widths try this:
    TableColumnModel tcm = table.getColumnModel();
    TableColumn col = tcm.getColumn(column_number);
    col.setPreferredWidth(column_width);
    should work...
    Takis

  • Nested Table--How to keep the children together

    You have a purchase order, say, with multiple lines, and multiple shipments per line. For any particular line, you want to either to (1) not split up the children--keep them togother on the same page, or (2) if you do split them up,, repeat the parent (i.e., PO Line) on the next page for identification purposes.
    Any way to do this with XML Publisher?
    Lawrence Profant

    I am using BI Publisher 5.5 on MS Word 2000 I have a table when the data in the table exceeds 1 page the table goes on to then next. However at the bottom of the first page the place where a line should be to close the table appears to be missing. Does anyone have any ideas why this is? By the way on the table row properties I have the following option ticked Repeat as header row at the top of each page.
    Thank you
    Mark

  • How to reference an application without opening it?

    The attached vi is used to determine the currently installed version of Microsoft Word. I have used this in the past with built applications. This is placed in the calling vi’s initialization. However, just now, it opens the Word program. (Before it didn’t.) I don’t want to start Word initially because the report is not generated yet and also the user has the option of printing the report in Excel. The following are my questions:
    Why am I now having this problem? I cannot think of anything different other than it’s on a different computer.
    What can be done to prevent starting the Word program at the calling vi’s initialization?
    What subject matter is this involved with?
    Is there a document or tutorial on this issue?
    I’m using LV 7.1 (with Application Builder), Win2000 and Microsoft Office 2003
    Attachments:
    Word_Version.vi ‏23 KB

    I did run your VI and the word windows doesn't show up but i noticed that WINWORD.exe process is running even when VI stops.
    I modified the VI (see attached), that should work for you. Using LV 7.1, WinXP and Word 2003.
    Enjoy!
    A Rafiq
    Attachments:
    Word_Version.vi ‏26 KB

  • How to reference page attributes (e.g. name) in application level process

    How can I access the NAME of a page while in an application process? Is this possible, without setting some sort of app-level current page name variable? (Which would defeat the purpose of the app level process :)
    Thanks,
    Carol

    When an application process runs at a firing point other than On Demand the current page name can be obtained using this SQL:
    select page_name from apex_application_pages where application_id = v('APP_ID') and page_id = v('APP_PAGE_ID');
    When an application process is invoked "On Demand" by way of AJAX, the page ID in the request is usually 0, so there is no page context available. However you could pass an item name/value into these requests and use that item value in the query against apex_application_pages.
    Scott

  • How to change the column header/channel name in an LVM file?

    Hi all,
    I made a VI (see attached JPG) that reads 2 voltages, but after calculations and other processes, ends up writing 6 columns of data to an LVM file (7 if you count the time).
    I have read in other posts that you can change the name of each signal so that the header of each column in the LVM files doesn't just say "untitled". However, as you see in my code, some signals are numeric (double) and one is a logic (1 or 0), so there is no way to edit the waveform properties of those signals (since they are not waveforms).
    Any ideas?
    Thanks!
    Attachments:
    untitled3.JPG ‏40 KB

    I would suggest looking at this existing post:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=175554
    I'll further mention that in the loop, for each channel you want to set the name of, the attribute name for the name of the channel is "NI_ChannelName".  The example in the thread above takes advantage of the fact that "NI_ChannelName" happens to be the first one defined.  I think it would be more robust to not bother reading the existing attributes, and instead just write the "NI_ChannelName" attribute with whatever new value you want.

Maybe you are looking for