Views for every subtype on object table

Hi!
The environment is (Oracle 10.2.0.3):drop type tp;
create or replace type tp as object (
  n number
) not final;
drop type tp1;
create or replace type tp1 under tp (
  n1 number
) not final;
drop type tp2;
create or replace type tp2 under tp (
  n2 number
create or replace type tp11 under tp1 (
  n11 number
create table tt of tp;
insert into tt values (tp(1));
insert into tt values (tp1(1,1));
insert into tt values (tp1(1,2));
insert into tt values (tp11(1,1,1));
insert into tt values (tp11(1,1,2));
insert into tt values (tp11(1,1,3));
commit;I'd like to create a views on table tt that will filter objects of only one of tp 's subtypes. For example:
create or replace view tp1_v as
select * from tt t where value(t) is of (only tp1);However the SELECT statement in this view get the result:SQL> select * from tt t where value(t) is of (only tp1);
    N
    1
    1
2 rows selectedThe column N1 is missing. So I try:select treat(value(t) as tp1) as "treat" from tt t where value(t) is of (only tp1);
treat
SCH.TP1(1,1)
SCH.TP1(1,2)
2 rows selectedbut I wants the output be:    N    N1
    1     1
    1     2
2 rows selectedThat SELECT will give me such output?

Check this
select n,treat(value(t) as tp1).n1 n1 from tt t where value(t) is of (only tp1);
N                      N1                    
1                      1                     
1                      2 

Similar Messages

  • Radio button for every row in a table

    Can anyone tell me how to get abutton for every row of a table.This button is used for selecting taht particular row.
    Thanks in advance

    Create a table region in Jdev. Then right click on it New--> Choose Single Selection.
    Thanks
    --Anil                                                                                                                                                                                                               

  • How  to fire a query for every record in a table, pass values in a loop

    Hi,
    For each record in a table, I want to loop through each record and then fire a query by passing acct, product and date from this table to the where clause of the query. I would have to create a pl/sql block..The output of the query I want to spool from sql developer.
    I need the exact syntax please for doing this.. since i am new to Oracle. Just the template will be enough. I will fill in the query.
    Any help is appreciated as always..
    Regards,
    hena

    904385 wrote:
    Hi,
    For each record in a table, I want to loop through each record and then fire a query by passing acct, product and date from this table to the where clause of the query. I would have to create a pl/sql block..The output of the query I want to spool from sql developer.
    I need the exact syntax please for doing this.. since i am new to Oracle. Just the template will be enough. I will fill in the query.
    Any help is appreciated as always..
    Regards,
    henaHave you ever considered using a JOIN ? It does the same thing as looping through a table and applying that to the where clause of a select on a query, only much, much, much faster and without the need to write any code. SQL is a declarative language, so you specify what you want and not how to do it. It can be bit of a journey to change your thought process if you come from a procedural or object world, but once you get there it's a beautiful view.

  • Checking for every record in a table using PL/SQL

    Hello Gurus,
    I would need your help in finding the best approach to tackle the below analysis using PL/SQL.
    I have a table which contains two columns
    UserID and Month
    I want to find out the users who made orders every month for the first half of 2012.That is the User ordered on Jan 2012, Feb2012 ... and June 2012.
    The Table is huge and has more than a million records. How do I approach this in PL/SQL.
    Joe

    Hi Justin,
    Thanks for the quick response. This is helpful.However my Intention is to do it using PL/SQL for learning purposes. I am new to PLSQL.
    I wanted to do something like looping through each records in the table for every user ID and If I find orders for six consecutive months for a particular user, I will insert the user id to a temp table.
    Any hints on how can I use this? I heard about cursor. Can I use it. If so how should I approach.
    --Joe                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Material Master views for every material type

    HI Expertis,
    I am facing to the big problem. My requirement is to identify the Material Master Views relevent to the each and every Material Type.
    As an example, for the material type "FGTR" what should be the required views to create material master?
    From the MM01 Txn i found 36 Material types. Also found the standard views in "OMS2" Txn. But in OMS2 txn it gives me almost all the views in material master.
    Atlease i hope to categorize the material types which are going to use same material views. So i can ask abaper to develop it.
    these are the required Material types : MODE, FGTR, WETT, KMAT, LEER, LGUT, FERT, FOOD, INTR, CONT, IBAU, HERS, NLAG, NOF1, UNBW, HIBE, VERP, FRIP, PIPE, FHMI, ROH, LEIH, HALB, DIEN, ERSA, HAWA
    I would be gratefully thank u, if u can guided me on this matter.
    Thanx & Regards,
    Rashika.

    Hi,
    You can ask your abaper to write a small program by using table t134(T134-PSTAT) and T132T   .From this tables ,for each material type, you get all views.
    User department Maintenance status
    Work scheduling A
    Accounting B
    Classification C
    MRP D
    Purchasing E
    Production resources/tools F
    Costing G
    Basic data K
    Storage L
    Forecasting P
    Quality management Q
    Warehouse management S
    Sales V
    Plant stocks X
    Storage location stocks Z
    hopw this will help you.
    With Regards,
    Jaheer

  • Create a Maintenance view for table T500P

    Hi Experts,
    We have a requirement where customer want an additional field in table T500P and for the same a custom maintenanve view has to be created.Moreover, If there is any update insert or change in the ZView/Ztable the same should be reflected in standard table T500P.
    Steps already taken :-
    We have created a ztable (copy of T500P ) and add the required custom field to it.
    We have also copied the view i.e V_T500P to our custom view and also use base table as T500P .
    We also create a foreign key for PERSA in Ztable and use T500P as check table for that with cardinality 1:1.
    To update the MOLGA & BUKRS field data in ztable we have set both the field as a primary key & create a foreign key with check table T500L & T001 & cardianality as 1:CN for key fields.
    In custom maintenance view we have set the realtionship of ztable t500l & t001 with the base table T500P.
    Now, if we are trying to maintain the view only T500P table is getting updated and Ztable is updated with only PERSA value.
    Please provide some directions for the resolution of this issue.
    Thanks,
    Pooja Goel.

    Scheduler007 --
    The view you selected by clicking File > Options > Project View is the default view for every new project you create from a blank project template.  This is a global option, so setting it from the checked out Enterprise Global file serves no purpose. 
    When you select a view as your default view, you will see that view applied to the blank project that is opened when you launch Microsoft Project 2010, and you will see it applied if you create new blank projects.  If you create enterprise templates for
    people to use in your organization, you should simply apply the view to the template that you want as the default so that users will see this view immediately when they create a new project from the template.  In addition, if you apply a view to an open
    project, close and check in the project, and then reopen the project, you will see the last view applied in that project (as Guillaume correctly points out).
    Beyond this, there is no method possible for the Project Server administrator to specify a default view for the Microsoft Project application used by the project managers in your organization.  This is an option each PM must set.  Hope this helps.
    Dale A. Howard [MVP]

  • MPCUI metadata driven CustomUI Table is refreshing for every second

    I have a table in my home page when I customized the home page with metadata driven MPCUI.
    My table is getting populated with SQLDataService qrery. when I try to scroll down the table, it is not allowing me to scroll down as for every 1 second the table is getting refreshed.
    Can some tell me how to get rid of this refreshing.
    I am pasting my code here
    <SqlStatements>
    <Sql name="HC_EXA_REPORT"><![CDATA[
    // The actual SQL code is here and do not want to paste the SQL...
    ]]>
    </Sql>
    </SqlStatements>
    <ActivityDefinition>
    <mp:Page id="hcReportsPg" label="Exadata HealthChecks Reports"
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:mp="http://www.oracle.com/mpcui"
    >
    <mp:services>
    <mp:SQLDataService id="hcReport" queryID="HC_EXA_REPORT" properties="{props('EMIP_BIND_TARGET_GUID',appModel.target.guid)}" />
    </mp:services>
    <mx:VBox width="100%" height="100%">
    <!-- 1st row -->
    <mx:HBox width="100%" height="100%">
    <mp:Region title="Exadata HealthChecks Reports" width="100%" height="100%">
    <mp:Table id="repSummaryTable2" dataProvider="{hcReport}">
    <mp:columns>
    <mx:AdvancedDataGridColumn dataField="Metric"/>
    <mx:AdvancedDataGridColumn dataField="Check name"/>
    <mx:AdvancedDataGridColumn dataField="name"/>
    <mx:AdvancedDataGridColumn dataField="Instance name"/>
    <mx:AdvancedDataGridColumn dataField="Parameter"/>
    <mx:AdvancedDataGridColumn dataField="Status"/>
    <mx:AdvancedDataGridColumn dataField="Outfilepath"/>
    <mx:AdvancedDataGridColumn dataField="Fail Message"/>
    <mx:AdvancedDataGridColumn dataField="Risk Message"/>
    <mx:AdvancedDataGridColumn dataField="Benefit/Impact Message"/>
    <mx:AdvancedDataGridColumn dataField="Recommendation Message"/>
    <mx:AdvancedDataGridColumn dataField="Alert"/>
    <mx:AdvancedDataGridColumn dataField="Collection Timestamp"/>
    <mx:AdvancedDataGridColumn dataField="Exachk Results From"/>
    <mx:AdvancedDataGridColumn dataField="Exachk Results Timestamp"/>
    </mp:columns>
    </mp:Table>
    </mp:Region>
    </mx:HBox>
    </mx:VBox>
    </mp:Page>
    </ActivityDefinition>

    Hi, sorry, I haven't played with MPCUI yet but it we're excited about the capabilities it appears to provide. We'd like to "combine" a lot of our reports and one-offs into OEM so things are better-organized.
    That said... I dug around a bit and thought this might help. Could you add timePeriod & interval to your own c:Table id element (is that the correct term)?
    In the case of the table component, you can specify the metric directly also:
    <c:Table id="processesTable" width="100%" height="100%"
    metricName="CPUProcessesPerf"
    metricColumns="['ProcUser', 'ProcCPU', 'ProcCmd']"
    timePeriod="REALTIME"
    interval="30"
    >
    <c:columns>
    <mx:AdvancedDataGridColumn width="50" dataField="key" />
    <mx:AdvancedDataGridColumn width="100" dataField="ProcUser" />
    <mx:AdvancedDataGridColumn width="80" dataField="ProcCPU" />
    <mx:AdvancedDataGridColumn width="400" dataField="ProcCmd" />
    </c:columns>
    </c:Table>
    Source: http://docs.oracle.com/cd/E24628_01/doc.121/e25161/mgt_ui.htm#CHDEGFBG
    HTHs...
    Edited by: Richard Evans on Dec 29, 2011 1:31 AM - forgot the URL

  • View for a network node or link table

    Can a view be used for a nework node or link table? The process sdo_net.validate_network hangs when I try to validate a network based on views for the node and link tables.

    I am using a logical model. The sql statement (checking link/node relationship) that hangs is:
    select count(a.link_id) from vlinks a
    where not exists
    select * from vnodes b
    where b.node_id = a.start_node_id or b.node_id = a.end_node_id
    I gather there is a concurrency issue with my links view because it joins a table with itself. I have a link table that has the start and end nodes defined on two records. Here is my view script:
    create or replace view vlinks
    (link_id, link_name, start_node_id, end_node_id, link_type, active, link_level, cost, parent_link_id)
    as
    select a.id, 'Link '||a.id, a.nodeid, b.nodeid, 'simple', 'Y',1,0,''
    from vnodes a, vnodes b
    where a.seq=1 and b.seq>1 and a.id = b.id
    I can create tables from my views and validate them successfully through sdo_net.validate_nodes_schema, sdo_net.validate_links_schema, and sdo_net.validate_network.
    I can analyze the network model through the Java API using the reachable nodes, shortest path, and spanning tree methods without any problems.
    I guess I'll validate my view links by counting the total number of links and subtracting the number of links joined successfully at the start and end nodes - if 0 then all links are valid. E.g.:
    select count(link_id) from
    select link_id from vlinks
    minus
    select a.link_id from vlinks a, vnodes b, vnodes c
    where a.start_node_id = b.node_id
    and a.end_node_id = c.node_id

  • Create a defaut view for the MS Project Server 2010 client

    Dear Forum,
    how can I create a defaut view for the MS Project Server 2010 client?
    I saved a template and set a default view under File -> Options ->Project View. I also did the same in the checked-out enterprise global. If I then close the client and re-open it my default view changes back again to the previous one (not the view
    I set as a default view).
    What explains this behaviour and what can I do? Any hints?
    Thank you very much for your help!

    Scheduler007 --
    The view you selected by clicking File > Options > Project View is the default view for every new project you create from a blank project template.  This is a global option, so setting it from the checked out Enterprise Global file serves no purpose. 
    When you select a view as your default view, you will see that view applied to the blank project that is opened when you launch Microsoft Project 2010, and you will see it applied if you create new blank projects.  If you create enterprise templates for
    people to use in your organization, you should simply apply the view to the template that you want as the default so that users will see this view immediately when they create a new project from the template.  In addition, if you apply a view to an open
    project, close and check in the project, and then reopen the project, you will see the last view applied in that project (as Guillaume correctly points out).
    Beyond this, there is no method possible for the Project Server administrator to specify a default view for the Microsoft Project application used by the project managers in your organization.  This is an option each PM must set.  Hope this helps.
    Dale A. Howard [MVP]

  • Album list view for playlists

    When I select Music (under Library) and select the Grid view, then select Artists, then double click on an artist I am presented with a list view grouped by album with album artwork on the left. I would like to get the same view for a selected playlist, but I can only get that view for specific albums or artists within the playlist. What I want is to see that album list view for every artist, album and song in the playlist. Is this possible? If not, is there some way to submit a feature request? Thanks.

    Erm - use the List view?
    tt2

  • Display last two rows for every group

    Hi,
    I want to display only last 2 rows for every group.
    My table look like
    ACN DATE COST APPL
    A6ERA 14-JUN 150 B777
    A6ERA 14-JUN 180 B787
    A6ERA 15-JUN 120 B677
    A6ERA 14-JUN 155 B777
    A6ERB 13-JUN 166 A777
    A6ERB 14-JUN 157 B777
    A6ERB 11-JUN 159 B787
    A6ERC 14-JUN 099 B777
    A6ERC 11-JUN 102 B788
    In the above table, I want to display only the last two rows group by ACN
    Like the below table
    ACN DATE COST APPL
    A6ERA 15-JUN 120 B677
    A6ERA 14-JUN 155 B777
    A6ERB 14-JUN 157 B777
    A6ERB 11-JUN 159 B787
    A6ERC 14-JUN 099 B777
    A6ERC 11-JUN 102 B788
    Please reply

    Nihar
    To get the first two rows from each group, you could do this:
    Use the ROW_NUMBER() analytic function (see http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions137.htm#i86310)
    Now, your question isn't clear what you mean by "last" two rows. Last in what order? Whatever it is, you can use the ORDER BY part of the ROW_NUMBER() function to specify the ordering, and reverse it using DESC - for example:
    select acn, adate, cost, appl from (
        select acn, adate, cost, appl,
                  row_number() over (partition by acn order by adate desc) as rn
        from  acntab
    where rn <= 2
    order by acn, rnHTH
    Regards Nigel

  • Does LSMW works for different subtypes (Each subtype has different screens)

    Hi All ,
        I have to update a Custom Infotype, there are 3 subtypes for the Infotype and the screen changes for every subtype. Does LSMW work for this ? If not what would be the appropriate method ?
    Thanks & Regards,
    Ravi

    Yes, I have checked for BAPI's, but there is no BAPI which can be used as this infotype is a Custom Infotype.

  • What privileges needed for producing explain plan for other user's object ?

    Hi there,
    What privileges needed for producing explain plan for other user's object (tables) ?
    Cheers
    Soheil

    Experiment: (public plan table exists)
    create user bob identified by bob;
    grant create session to bob;
    connect bob/bob
    start sample_plan
    If will error off on the table being read in the plan
    connect dba_or_privileged_user
    grant select on the referenced_table(s) to bob;
    connect bob/bob
    start sample_plan
    It will now work providing a public plan table exists or you give bob create table and create a bob.plan_table
    I ran the experiment on Oracle version 9.2.0.6 running on AIX 5.3. Select privilege on all referenced tables in the explained SQL must exist
    HTH -- Mark D Powell --

  • How to get the List of Database Objects (Table/View) for a given APEX Page.

    Hi,
    I have an application and that consist of pages like page1,2,3,.....
    *1.* I want a report which can give me the list of all the Pages1,2,3,....
    I am using the following query to acheive this.... THIS IS FINE..
    select a.workspace, a.owner, a.application_name, b.page_id, b.page_name
      from apex_applications a,
           apex_application_pages b
    where a.workspace = b.workspace
       and a.application_id = b.application_id*2. Now, I want for each individual page*, the list all the database objects (tables/views), which that page is using.
    I am using ALL_DEPENDENCIES , but I am not getting the result.
    So, want to know if there any view/table, where I can get the Application Pages & there database object list...
    Thanks,
    Deepak

    Hari,
    Thanks for the response.
    The view APEX_APPLICATION_PAGE_DB_ITEMS will only give me the table name related to any Page Items defined to that page..It will not give me all the database objects..
    suppose we have a Page, having a report based on multiple tables and there is no Page items defined on that page, we will not have any value in this ....DB_ITEMS table. same thing if we have define some PL|SQL(using some table/view) in a Process, that will not be populated in .....DB_ITEMS table. I want some thing like all the database objects (table/views/function/procedure/.....) for a particular Page ID.
    Thanks,
    Deepak

  • What is the Table/View name for getting the Database Object Dependencies

    I am running the Database Object Dependencies report to get the reference of Database Object and their respective Application Component.
    Applications xxxx -> Application Reports -> Shared Components -> Database Object Dependencies -> Compute Dependencies
    I want to develop a report for the same purpose, Just want to know what is the APEX Tables / Views they are using to run this report, so that I can use the same Tables to create my own report.
    Thanks,
    Deepak

    Hi Andy,
    when I am using the following query...I am not getting any result...
    select name, type, owner
    from all_dependencies
    where referenced_owner = 'APEX_030200'
    and referenced_name = 'WWV_FLOW_PATCHES'
    AND OWNER= 'XXXXXXX' --- (addeed this to the where clause)
    I modified the query.....I am getting the result.....
    select name, type, owner
    from all_dependencies
    AND OWNER= 'XXXXXXX'
    - But I am not getting which database object(table/view) is using which Application Page/Component like we have in Database Object Dependencies.
    - Also what is this REFERENCE OWNER & REFERENCE_NAME ----
    referenced_owner = 'APEX_030200'
    and referenced_name = 'WWV_FLOW_PATCHES'
    I am little bit confused, Can you pl expalin me in details......
    Thanks,
    Deepak

Maybe you are looking for

  • Problem with calculate button in form

    hi all We have a problem when we try to calculate in a data form using the button of GUI. We receive a form syntax verification message "with impossible to verify the calculation:", scenario,year,entity. We don't have this error when we use the calcu

  • I Don't Want A .pdf Preview

    I have downloaded some of Stephen Hawking's lectures for a bit of light reading. These come in pdf files, which I can add to my iPod Touch. However, when I view them in iBooks, a preview of the first page comes up as the front cover. This looks ghast

  • MY FAVORITE IPHONE 3GS WALLPAPER DELETED - PLEASE HELP !!!!

    Hello All, I'm desperately looking for an old iphone 3gs wet pink stemmed rose with water drops wallpaper which got deleted from my phone and now I see that the wallpaper is no longer in the wallpaper gallery of my phone either. I have come to unders

  • Adobe error 1406

    I need to download Adobe Reader to use Quickbooks Online properly. Every time I try and download the 1406 error pops up. I've tried deleting all other adobe programs and redowloading but the same error keeps popping up. I've even tried to figure out

  • How come when I close firefox, and reopen it, my persona keeps reverting to one that I stopped using (and uninstalled) weeks ago?

    Used a Pokemon Black / White persona for about a week, and then got some new ones. I disabled the Pokemon persona and switched to new ones, but when I restart firefox, it reverts back to the Pokemon persona. I even uninstalled the Pokemon persona in