CREATE VIEW for several tables

Hello

I have a lot of tables, each of them containing a serial number field, each number is unique all the tables.

I need a notice like this:
SERIAL_NUMBER  |  TABLE_NAME
----------------------------
1              |T1
2              |T2
3              |T3
4              |T1
5              |T1
6              |T4
What is the best way (SQL) to create this view?

Thanks in advance!

Maybe something like this:

create or replace view my_view as
select serial_number, 'T1' table_name from t1 union all
select serial_number, 'T2' table_name from t2 union all
select serial_number, 'T3' table_name from t3;

Tags: Database

Similar Questions

  • create the view of several tables of days

    Hello
    I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
    Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
    I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?

    You will appreciate comments on the details and the whole concept. I have prev sql server experience.

    Thank you
    T

    user12943718 wrote:
    Hello
    I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
    Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
    I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?

    You will appreciate comments on the details and the whole concept. I have prev sql server experience.

    Thank you
    T

    Change the data model if you have 1 table for a day.

    You have just a DATA table and a column to indicate the day of the application.

    Then you don't need a view, do not need anything dynamic, do not need to break your head against a wall for a simple query... etc.

  • Container for several tables of different length

    Hey,.

    I'm doing an algorithm for labelling component connected in LabVIEW.  I came across the problem that I need some sort of data structure that I can't create.  I hope that I've missed something and someone can report this to me.

    What I'm looking for is a container that can contain lists of lists of 2 values.  Basically, I have several labels.  Each label will have a list of coordinates in.  The closest I came to this creation is a 2D cluster table.  Then, the cluster contains the coordinates X and Y.  The problem is that each list is not the same size, and for a table of 2D in labVIEW, all rows/columns must have the same length.

    In summary, I'm looking for a way to store multiple lists of coordinates.  The lists will all be of different lengths, and I don't know how many lists there will be.

    Is it possible to do this?

    If not, does anyone know an easier way than that looking for a 2D for concentrations table all?  At the back of my mind, I want to say that there may be a Vision VI of OR who can do this, but I can't find a.

    Thanks for your help,

    Dominic Walker

    A way to manage several arrays of different lengths (but all the same type of data) is to put the berries in a queue.  Each element in the queue must be a table, but they can be of different lengths.  To get to all the tables, you use the preview queue feature.  It returns an array of clusters with each table queue in a separate group (if I remember correctly).   Perhaps an array of clusters of berries would work for you.  I just checked that this allows arrays of different lengths.  You can also place a control of the chain with the label of the cluster if it is appropriate.

    Lynn

  • Unable to create cache with several tables group

    Hello

    I need to create a group of cache with several tables, which are referential to the other.

    There are 2 related tables and table 1 child...
    While trying this thing, it gives me an error:

    8222: multiple parent tables found

    It is not possible to use several tables of root in a single cache group? Is there another way to use it?

    Script, I used is:

    create a cache group asynchronous writethrough TEST. CG1
    of the TEST. ROOT1)
    KEY PRIMARY ID VARCHAR2 (8 BYTES),
    NAME VARCHAR2 (50 BYTE),
    DESCRIPTION VARCHAR2 (255 BYTE),
    POLICYTYPEID VARCHAR2 (7-BYTE)),

    TEST. ROOT2)
    PARAMTYPEID VARCHAR2 (5 BYTES) PRIMARY KEY,
    PARAMETERUSAGE VARCHAR2 (1 BYTE),
    NAME VARCHAR2 (25 BYTE),
    DESCRIPTION VARCHAR2 (255 BYTE)),

    TEST. CHILD1)
    PARAMDETAILID NUMBER (20) PRIMARY KEY,.
    ID VARCHAR2 (8 BYTE),
    PARAMETERUSAGE VARCHAR2 (1 BYTE),
    DISPLAYVALUE VARCHAR2 (255 BYTE),
    OPERATORID VARCHAR2 (5 BYTE),
    VENDORID NUMBER (20).
    FOREIGN KEY REFERENCES TEST. ROOT1 (ID),
    TEST KEY (PARAMETERUSAGE) REFERENCES STRANGERS. ROOT2 (PARAMETERUSAGE));

    You can't have multiple root within a group of cache tables. The requirements for tables in the group a cache are very strict; There must be only one top-level (root table) table and there may possibly be several children tables. Tables of the child should be linked through foreign keys to the root table or a child table above in the hierarchy.

    The solution for your case is among the tables of root and the other root table in a separate cache group and the child table in a cache group. If you do this, you must take care of a few things:

    1. you cannot define foreign keys between the tables of groups of different cache in TimesTen (keys may exist in Oracle) so the application must enforce referential integrity itself for these cases.

    2. If you load data in a cache group (using LOAD the GROUP CACHE or "load we demand") and Timesten will not automatically load the corresponding data in the other group of cache (since he doesn't know the relationship). The application must load the data into the other group of cache explicitly.

    There is no problem with transactional consistency when changes are pushed to Oracle. TimesTen maintains and reinforces the coherence transactional regardless of how the tables are arranged in groups cache correctly.

    Chris

  • Creating views for DB XML content in Oracle 9i (9.2.0.4.0)

    Hello

    Please excuse my ignorance but I searched on through reams of documentation on Oracle XML DB and is extremely difficult to get information about a specific version when it evolved as radically. I develop on Oracle 9.2.0.4.0 (I'd be happy to upgrade but unfortunately my clients are less enthusiastic!).

    My questions are how and why I would create views of the XML data to use in my application. I made a snippet of XML data (according to an XSD) that I need to load into the database and then provide view in read-only data. I managed to save my drawings and insert the XML into the underlying structures of the object relationship and I now need to create views.

    For as much as I can muster in 9i I must query XML data using extractValue, for example:
     
    SELECT extractValue(xseq.column_value, '//ReferenceNumber') REFERENCE 
         , extractValue(xseq.column_value, '//ProviderName') PROVIDER_NAME 
    FROM   EXTRACT e 
         , TABLE(XMLSequence(extract(VALUE(e), '//Registration'))) xseq; 
    I also managed to get the same results by directly accessing the column 'hidden ': XMLDATA
     
    SELECT xml."ReferenceNumber" REFERENCE, xml."Provider"."ProviderName" PROVIDER_NAME 
    FROM   EXTRACT e 
         , TABLE(e.xmldata."Registration") xml 
    Issues related to the:
    (i) they are the only options I have to access the XML data in Oracle 9i? (XMLTable() looked quite interesting, but was unfortunately introduced in 10g)
    (II) given that I only need a read-only view of the data, are there benefits (other than speed) to be stored in object-relational tables as opposed to a CLOB?
    (III) is there a problem using the second method (cleaner) in relation to the first?

    Thanks a lot for you help,

    Tom Casserly

    (I) Yes. I'm sorry.
    (II) speed is the main advantage for storage GOLD regarding lead content (instead of CLOB--> pilot document by) queries. Other things I can think of is that it comforms to an XML schema, which is an advantage (you know that obey your XML file is the format defined) and a disadvantage (validation / grinding / and internal indexing off XML data will cost you performance).
    (III) it is (I think) not supported, less efficient then TABLE (XMLSequence (extract ()))

  • Implementation of dumps for several table

    Hello
    Is it possible to configure the < dumps-plan > element or implement dumps to get data from multiple
    table. Currently the sample xml and dumps in the tutorial is configured to a single table.

    Thank you
    -Trapani

    Hi Thiru,

    As Rob mentioned, you can implement dumps to do just about anything you want: do a join between tables, run several queries for data from multiple tables or even access non-base data system, such as an existing system or a web service to retrieve the data. Consistency really cares how you implement your cache store and where you get the data, as long as you return a single object to the load method, which must be inserted in the cache the cache store is set up for (or in the case of loadAll, many objects in a map).

    However, what I didn't understand not your question is if you want to load the data of several related tables to create a single object (an aggregate in DDD terminology), or if you want to create different entity objects based on the data in each table and put them all in the cache. Normally, you should have a cache by entity type, while the latter is discouraged until you know exactly why you do and are recommended to create a separate for each entity type cache and use different cache stores for them. Otherwise, you will encounter issues if you try to index your cache or run queries on it, because these characteristics depend on the schema of compatible entry.

    However, if you load an aggregate, you can decide to store the entire aggregate object in a single cache, in which case you will probably eventually query several tables related to construct an instance of an aggregate, or you may decide to store root cluster in its own cache, and separate the low related entities in caches, once again a cache by entity type. The choice should really depend on the size of small entities within an aggregate and access model data, so it is difficult to provide general guidance. However, if you do not end up storing weak entities in separate caches, it is usually advantageous to use the key association to ensure that they are located in the same partition as their aggregate root.

    Kind regards
    ALEKS

  • Creating indexes for the table

    can someone help me how to create indexes in the table. I m creating own table... I need to select a particular field in the table. So I need to calculate the index position. I use my code like this,

    This will returnthe number of columns in the table.

    Class array

    {

    private int Table_Index()
    {
    for (int x = 0; x)<>
    {
    table_index = x;
    }
    Return table_index;
    }

    }

    MainClass can I get this length of Index

    Table T1;

    int t1 is T1. Table_Index();

    This property returns my length (4) of table column

    Using this index (t1) I HAV to see what position I'm at table now...

    someone help me...

    You can use a listfield, he supports methods to get the selected row and its contents.

  • granting of privileges to the schema for several tables at the same time... any script?

    Hello gurus,

    I have about 25 tables in the ABC scheme

    I want to give all privialges to the XYZ schema for all tables of 25 which is in the pattern ABC... So is there is SQL statement or a script, I can run to grant privileges to all tables.

    Something similar to these...

      SELECT 'create synonym ' || table_name || ' for ' || table_name
      FROM user_tables  {code}
     
    So i get all the table names ....then i can run as a script.... U r help is greatly appriciated gurus!!!
    
    
    Thank you!!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Administrator:

    set head off
    set pages 0
    set feed off
    spool myscript.sql
    Select 'grant select, insert, update, delete on abc.'||table_name||' to xyz;'
      from dba_tables
     where owner = 'ABC';
    
    Select 'create synonym xyz.'||table_name||' for abc.'||table_name||';'
      from dba_tables
     where owner = 'ABC';
    
    spool off;
    

    Obviously this does not all new table that will be created in the future on ABC schema...

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/02/07/aggiornare-una-tabella-con-listruzione-merge/]

  • Trees does not not in 4.0 for several tables

    I built the query:

    Select case when connect_by_isleaf = 1 then 0
    When level = 1 then 1
    of another-1
    end the status,
    level,
    name as title,
    NULL as an icon,
    ID as the value,
    NULL as ToolTip

    de)
    To_char (nihub_qa_group_id) SELECT ID,
    NULL as parent,
    GroupName as name,
    NULL link,
    NULL a1,
    NULL A2
    OF nihub_qa_groups
    UNION ALL
    SELECT to_char (nihub_qa_group_id): ': ' | TO_CHAR (nihub_qa_tables_id) as id,
    TO_CHAR (nihub_qa_group_id) as a parent,
    table_NAME as name,
    NULL link,
    NULL a1,
    NULL A2
    OF nihub_qa_table_tree_v
    )
    Start with the parent is set to null
    connect by prior id = parent
    siblings arrested by name

    but the tree will not display. I get the error: Warning: tree root ID '10000' could not be found. and when I debug I get errors: ORA-06550: line 34, column 34: PL/SQL: ORA-00904: "ID": invalid identifier ORA-06550: line 3, column 13: PL/SQL: SQL statement ignored ORA-06550: line 37, column 64: PLS 00364: 'I' use the loop index variable is invalid ORA-06550: line 37, column 15: PL/SQL: statement ignored.

    My paintings is quite simple:

    nihub_qa_group:

    CREATE TABLE nihub_qa_groups
    (
    nihub_qa_group_id NUMBER NOT NULL,
    GroupName VARCHAR2 (255) NOT NULL CHECK (single)
    )
    ;



    ALTER TABLE nihub_qa_groups
    Add a CONSTRAINT "Group PK" PRIMARY KEY (nihub_qa_group_id);

    nihub_qa_tables:

    CREATE TABLE nihub_qa_tables
    (
    nihub_qa_tables_id NUMBER NOT NULL,
    table_name VARCHAR2 (250 BYTES),
    last_date_loaded DATE,
    last_row_count NUMBER,
    avg_records_loaded NUMBER,
    check_avg CHAR (1 BYTE),
    check_orphan CHAR (1 BYTE),
    check_domains CHAR (1 BYTE),
    check_date CHAR (1 BYTE),
    threshold_plus NUMBER,
    threshold_minus NUMBER,
    date_column VARCHAR2 (255 BYTES)
    )
    ;



    ALTER TABLE nihub_qa_tables
    ADD CONSTRAINT "nihub_qa_tables PK" PRIMARY KEY (nihub_qa_tables_id);



    and nihub_qa_table_tree_v is a point of view:

    VIEW to CREATE or REPLACE nihub_qa_table_tree_v (nihub_qa_group_id,
    nihub_qa_tables_id,
    table_name)
    IN SELECT
    nihub_group_table.nihub_qa_group_id,
    nihub_group_table.nihub_qa_tables_id,
    nihub_qa_tables.table_name
    Of
    nihub_group_table nihub_group_table,
    nihub_qa_tables nihub_qa_tables
    WHERE
    nihub_group_table.nihub_qa_tables_id = nihub_qa_tables.nihub_qa_tables_id;


    nihub_group_table is a correlator group_id and tables_id to support the relationship m:m. when I run the query in Toad or sql command in the APEX, I get:

    1 1 UNICA - 10000. -
    2 0 NIHUB_NETINSIGHT_VEIW_PARAMS - 10000:20000 -.
    2 0 NIHUB_NETINSIGHT_VIEWS - 10000:10000 -.
    2 0 NIHUB_NETINSIGHT_VISITS - 10000:30000 -.
    2 0 NIHUB_NETINSIGHT_VISIT_PARAMS - 10000:40000 -.
    1 GROUP 1 TEST - 20000 -.
    2 0 NIHUB_NETINSIGHT_VIEWS - 20000:10000 -.


    that is what I expect. Here, any help would be appreciated.

    Thanks in advance

    PAM

    Here is a document to create a tree in APEX 4 via a wizard: http://apex.oracle.com/i/doc/tree_query_create.htm#BABJAGJJ

    Thank you

    Tony Miller
    Webster, TX

    While it is true that technology is waiting for no man; stupidity always stops to accommodate new passengers.

    If you answer this question, please mark the thread as closed and give points where won...

  • EO for several tables

    Hi all

    In the new page that I created, I have more than 8 tables I should use to display the data in the page. Also when I try to save the page, the data is saved using the API seeded. In this situation,

    (1) how to use the objects of entity for 8 different tables? Can I create associations between all these different tables?
    (2) that I need to record data using the API, I extend the OAPlsqlEntityImpl class in the EO. So, in this case, all postings must be done using getters and Setters at the level of the VO or EO?

    Please advice.

    Thank you all

    KK

    Hello

    1) Set the Foreign key using setAttribute Methods ? 
    

    When you create a VO based on multiple EO, there should be a link between these Office of assessment as primary key & Foregin key 8. And when you share a commitment that the value of your beans will be saved to the database. But the foreigner, you will need to set independently using setAttribute method because it will not be saved by his own.

    2) If i'm doing the validations at EO level, those setters and getters will be called before the Create(), Update() and Delete()
    methods in the EOImpl class. Is that true?
    

    Yes, you are right, it is called to create and update operation, but not to delete.

    Kind regards
    GYAN

  • SQL Help: Add flag for several tables

    Hello

    I have an existing SQL as follows:

    Select the storeId field,

    (select case when count (1) > 0 0 otherwise then 1 end)

    of tb_bbb

    where tb_bbb.id = tb_base.baseId) AS conInd

    of tb_base;

    I would now add the table tb_ccc for the value of conInd. I try the following SQL:

    Select the storeId field,

    (select case when count (1) > 0 0 otherwise then 1 end)

    Of

    (select tb_bbb.id where tb_bbb.id = tb_base.baseId)

    Union

    Select tb_ccc.id where tb_ccc.id = tb_base.basdId) AS conInd

    of tb_base;

    However, it does not work. Any idea on this SQL?  Thanks for your help!

    Hello

    Here is another way, which may be more effective because it uses EXISTS (which can quit smoking as soon as it finds a match) instead of COUNT (who continues to go, so he can tell you if there are 999 or 1000 matches, even if you don't care to).

    SELECT storeid

    CASE

    WHEN THERE IS)

    SELECT 1

    OF tb_bbb

    WHERE bbb_id = m.baseid

    ) 1 THEN

    WHEN THERE IS)

    SELECT 1

    OF tb_ccc

    WHERE ccc_id = m.baseid

    ) 1 THEN

    0 OTHERWISE

    END AS conlnd

    OF tb_base m

    ;

  • Synonyms for several tables

    Hello

    I have a trigger which in a specific State, change 14 synonyms of 14 different paintings.

    The official documentation is not possible to create the synonym of more then one table at the same time.

    You know some tricks to simplify this operation?

    Thank you

    Ste

    Ste74 wrote:

    DB architecture, I have three 'groups' of tables (with 7 tables) with the same structure but different in data.

    Simply create an additional column of ACTION_GROUP and 7 tables with the same structure as those that already exist. List the tables of newly created partition by column ACTION_GROUP create 3 partitions with the values 1, 2 and 3. Add the ACTION_GROUP column to each of the 21 existing tables and tables 1 to the tables of Group 1, group 2 and group 3 3 table 2. Now, you can fill each partition table newly created through the exchange of the partition corresponding get and group the data in table rid your 21 original tables. Now you have 7 tables and all you need is WHERE ACTION_GROUP = added to your queries. Actually, same approach might work even without partitioning - you simply need to use insert instead of exchange of the partition.

    SY.

  • Create alerts for several systems at the same time - hyperic Can do?

    If I create an alert for a process or an agent to say 'availability' under open source license,
    for the EA version, can this alert that is set to 1 solaris system, be used to monitor all my Solaris systems or I have to create separate alerts for each system?

    I see I can do various tests of systems, but right now I'm just their configuration on 1 System. He had to be able to do this to a multiple of systems...

    Yes, you can do it with HQ-EE.  You can apply an alert to all the resources of the same type (i.e. Solaris platforms).  You can also apply an alert to every Member of a compatible group.

  • create subroutines for several structures of the event and common stop button

    Hi guys,.

    I wonder if there is a better way to design algorithm below scenerio that similar technical rehearsal for each structure of the event.

    Please find in annex vi where I designed the code to a boolean (D). I want to design a similar code for all other bolleans. (In the present design code, photo is displayed when the mouse is flown over D). I obviously have other pictures for the other,(A,B,C,E,F) booleans. Can we have a kind of subroutines for other Boolean types and a single stop for all the application button.

    Thank you very much in advance for your support.

    Sorry (I forgot to add vi) Please find attached.

  • Is it possible to create product in Muse labels, so I can create menus for several drop-down categories?

    It was simply not possible with Muse, but I was the research forums and shopping for Widgets, and I don't see something like what I want. Like say I want to build a website for a clothing retailer. On a drop-down menu, if I click on 'Woman' I don't want to see all articles with the tag for women, but if I click on "Shoes", I just want to find all products labeled as shoes. Is - this completely beyond ability to Muse?

    Want to, here is an article talking about best practices of navigation, and I'd like to do something like that.

    http://www.smashingmagazine.com/2013/11/11/guidelines-navigation-categories-ecommerce-Stud y.

    If I had only a few products, I guess I could build each list individually and just double category page a large number of items, but I think that the solution will quickly become too complicated. If the Muse is not the right option, what do you suggest? I am not opposed to learn something new, but I have an intermediate knowledge of coding at best.

    You can use the form to simply the box with options for product groups that are not exactly the same as what you are looking for, the characteristics and changes cannot be added to Muse, but the e-commerce system, you can use in your site.

    For example, you can make all kinds of variations of products as well as products marked on the end of BC and add the module page of Muse.

    Thank you

    Sanjit

Maybe you are looking for