Virtual Tables

Hello,
For example, I have two tables:
table1
t1_id
t1_data
table2
t2_id
t1_id (reference to filed table1.t1_id)
t2_data
I want to create two virtual tables: vtable1 and vtable2.
Real data must be stored only in tables table1 and table2. vtable1 and vtable2 must be only aliases (links, pointers etc), with new table name and new field names.
When I insert, select, update or delete data from vtable1 or vtable2, data modification must be made with original tables and vice versa.
Has oracle some nice methods to create such virtual tables?

Simple..
schema1.table1
schema1.table2
create..
schema2.view1
schema2.view2
where view1 is something like select col1 as aliascol1, col2 as aliascol2 from schema1.table1..
To do this you should grant at least the select to schema2 user on schema1 objects.
Read the docs how to do that..
Acr

Similar Messages

  • Error while creating virtual table in Hana

    Hi Folks,
    Good Day!
    I am trying to create the virtual table in Hana system from Hadoop data base but am getting some privilege issue.
    Please help me to resolve the issue.
    Error Screen shot:
    Thanks,
    Hari

    Hi Hari,
    Check if you have the following privileges assigned to your user ID in Object privileges for the created Remote DNS
    Regards,
    Nehal

  • Are Selects from ( two or more ) Virtual Tables Possible?

    Hello.
    This is what I mean by a virtual table - and this works in OBIEE -
    select
        saw_0, saw_2, saw_3
    from
         SELECT
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0,
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Creation_Date saw_2,
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Closed_Date saw_3
         FROM
            "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"
         WHERE
           "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009'
    ) t1However, this does not work -
    [ Note that each of the nested queries works ok on its own. ]
    select
        saw_0, saw_2, saw_3, saw_4
    from
         (SELECT
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0,
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Creation_Date saw_2,
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Closed_Date saw_3
         FROM
            "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"
         WHERE
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009' ) t1,
         (SELECT
            TOPN("- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number, 3) saw_4, 
         FROM
           "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"
         WHERE
           "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009' ) t2
    ) t3My question is this - is there a syntactic variation on this that does work? Or is it impossible?
    Thank you!
    Charlie

    Hello, User.
    I think what I'm trying to achieve is unclear. Consider first this query -
    SELECT
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number saw_0,
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Creation_Date saw_2,
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Order_Closed_Date saw_3
         FROM
            "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"
         WHERE
            "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009'Let's call that the "business result".
    What I'm trying to do is get a result set that has 3 rows for every row in the "business result" set. I'm trying to get this by coercing OBIEE to join the business result to an arbitrary 3-row set whose only purpose is to create that cartesian product result.
    So I create a second SQL expression -
    SELECT
            TOPN("- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number, 3) saw_4, 
         FROM
           "[Noetix-NoetixGlobalRepository] NoetixViews for Oracle Service"
         WHERE
           "- Nx_CSDG0_Repair_Orders (Depot Repair Views)".Repair_Number BETWEEN '100000' AND '100009'- which returns 3 rows of anything.
    I want to turn this -
    1   ABC   20.95
    2   DEF   19.95
    3   XYZ   24.95Into this -
    A  1   ABC   20.95
    B  1   ABC   20.95
    C  1   ABC   20.95
    A  2   DEF   19.95
    B  2   DEF   19.95
    C  2   DEF   19.95
    A  3   XYZ   24.95
    B  3   XYZ   24.95
    C  3   XYZ   24.95My attempt to force a join fails - and I'm asking if there is a syntax tweak (or another approach entirely) that will do the trick.
    Thank you.
    Charlie

  • Virtual Tables in a universe?

    We have a large structured database that we would like to make available through a universe.  We were considering using a universe that references tables that we make up so that when the report occurs, BO would request the data based on "virtual" tables and we would do the conversion to create efficient queries so that only the tables required to fullfill the data request would be used.  We believe this will be a lot more efficient over the alternative of creating real views that join a lot of tables together to answer the data request.
    I would like to know how we can create the universe using the designer sdk.  I assume that I will need to create new a class that implements the Table interface.  This seems like a lot of work.  Are there any short cuts I could take to create tables in a universe that are not directly linked to real tables in a database?
    Most of the implementation looks straight forward, but some methods that create a "Class" or "Delete" require a knowledge of the API.  I'm not quite sure how to implement these methods.

    Hi Trey,
    If your question is more related to the SDK, then I suggest yo post this to one of the SDK forums. You would get a better response there as within this forum threads are related to universe builders who use the Designer tool to construct universes.
    Regards
    Jacques

  • Error in Creating virtual tables

    Hi
    I get back a SQL error (SQL Statement not properly ended) in the case of Oracle for the following query. Is it not possible to create virtual tables in Oracle. I work on Oracle 9i
    CREATE GLOBAL TEMPORARY TABLE derTbl2143679361 (DerCol0, DerCol1, DerCol2, MemberCol0, OrdCol1) ON COMMIT PRESERVE ROWS AS
    SELECT TBC.SUPPLIER.COUNTYID, 'AMOUNT', SUM(AMOUNT)
    , TBC.SUPPLIER.COUNTRY
    , TBC.SUPPLIER.COUNTYID
    FROM (TBC.SUPPLIER join TBC.SALES on (TBC.SALES.SUPPLIERID = TBC.SUPPLIER.SUPPLIERID))
    GROUP BY TBC.SUPPLIER.COUNTYID,TBC.SUPPLIER.COUNTRY
    /*The above query works fine*/
    SELECT NETEMP5.Member0, 'AMOUNT', derTbl214367936.DerCol2
    , NETEMP5.Ord1
    FROM (SELECT DISTINCT COALESCE(derTbl2143679361.DerCol0, -2147483647), COALESCE(derTbl2143679361.MemberCol0, '$U$6$N$9$'), COALESCE(derTbl2143679361.OrdCol1, -2147483647) FROM derTbl2143679361) NETEMP5(KeyCol0,Member0,Ord1)
    left outer join derTbl2143679361 on ((COALESCE(NETEMP5.KeyCol0, -2147483647) = COALESCE(derTbl2143679361.DerCol0, -2147483647)))
    GROUP BY NETEMP5.Member0,derTbl2143679361.DerCol2, NETEMP5.Ord1
    ORDER BY 4
    /*This query throws the error*/
    Can I not assign Aliases to the virtual table in this form - NETEMP5(KeyCol0,Member0,Ord1)??
    Thanks

    Hi,
    This is the error that I get back
    ORA-00933- SQL command not properly ended
    It seems that the problem is with the way I use the Alias. The following query works fine
    SELECT NETEMP5.Member0, 'AMOUNT', derTbl214367936.DerCol2
    , NETEMP5.Ord1
    FROM (SELECT DISTINCT COALESCE(derTbl2143679361.DerCol0, -2147483647) KeyCol0, COALESCE(derTbl2143679361.MemberCol0, '$U$6$N$9$') Member0, COALESCE(derTbl2143679361.OrdCol1, -2147483647) Ord1 FROM derTbl2143679361) NETEMP5
    left outer join derTbl2143679361 on ((COALESCE(NETEMP5.KeyCol0, -2147483647) = COALESCE(derTbl2143679361.DerCol0, -2147483647)))
    GROUP BY NETEMP5.Member0,derTbl2143679361.DerCol2, NETEMP5.Ord1
    ORDER BY 4
    Here i use the alias following the column name itself. But is it not possible to have the aliases with the virtual table name (i.e NETEMP5(KeyCol0,Member0,Ord1) ) this works fine on MSSQL & db2
    Thanks

  • Populating a Crystal Report from a virtual table

    Hi,
    Iu2019m using Crystal Report XI R2. I have a Crystal Report which is created using a view in Oracle using the native oracle DB connection. Iu2019m intending to write an application which should populate this report with data using a virtual table in memory. Populating the virtual table could be done by me but what I need to know is how to populate the report using this virtual table. Note the virtual table name will be the same as the one that was used to design the report. Is such a thing possible in the Crystal Java SDK. I found the flowing link http://www.eggheadcafe.com/forumarchives/NETgeneral/Jul2005/post23273440.asp and it talks about a PUSH feature. Can this be used? If so can you tell me how, maybe a small sample code would help.
    Thanks you in advance,
    Regards,
    Chanaka

    I would suggest searching for how to use resultsets with crystal reports.

  • SWT Virtual Tables display problem.

    Hi all,
    I have a display problem with virtual tables.
    In an Eclipse RCP application, I have a view that shows two tables, T1 (showing users) and T2 (showing the roles).
    I also use a content provider and a label provider for each table.
    When I debug, I can see that both tables are filled correctly.
    But when the application comes up, T1 is empty and T2 is filled. I am missing the users in the table T1.
    The interesting thing is, that the table do not very differ much from each other, T1 has one column more and of course IUser object as data per tableitem, whereas T2 has IRole objects as tableitems.
    Even when I debug on event listening in T2, I can get the T1 data of each tableitem, but it doesn't show?!
    My question is, where can I look at to solve this problem?
    Just theoretically, without posting source code.
    Thanks and regards,
    Tom

    Hi,
    I found out that the table T1 seems to miss the user object in each of the tableitems data fields.
    Now I am confused.
    According to the model, when does it get filled with it?
    Because the Labelprovider
         public String getColumnText(Object element, int columnIndex) {
              String result = null;
              if(element instanceof IUser) {
                   IUser user = (IUser) element;
                   if(columnIndex == 0) {
                        result = user.getName();
                   } else if(columnIndex == 1) {
                        result = user.getUserId();
                   } else if(columnIndex == 2) {
                        //This is a checkbox Member
                   } else if(columnIndex == 3) {
                        //This is a checkbox Manager
              return result;
         }gets all the correct data.
    Is it removed afterwards?
    Thanks and regards,
    Tom

  • Create virtual table.

    Hi all,
    I have a table with SUBTYPE, DATAID, ORIGNALDATAID, DATE column.
    select dataid, orignaldataid from table where subtype=1 and Date=01-Aug-2010.
    I have the above query statment. I need the dataid for further processing, but before the processing is done. I need to check if the orignaldataid=0, if yes, dataid remains else dataid=orginaldataid. Before the list is pass to another sql. But i intend to use nested sql for futher processing, hence i need to database to crunch the data instead of using java to change the data.
    I was thinking of creaating another virtaual table in DB where it will automatically do this for me instead of having dataid and orginaldatid column, it will jus have dataid column. Then i can just query this virtual table.
    Select dataid from virtualTable where subtype=1 and Date=01-Aug-2010. Is it possible?

    Hi,
    If you want to have two tables
    (1) your original table with all the data, and
    (2) fubar, which perhaps has fewer rows, and some derived columns
    and you want changes in the original table to automatically change fubar (when apppropriate), then make fubar a Materialized View . Despite the name, a materialized view is a real table. Is it auotmatically refreshed, or changed to show changes in the original table. Typically, this is done at fixed intervals, that is, you tell the system to refresh the materialized view every morning a 2:00 am, or every 30 minutes. You can also refresh it on demand, so that you know the dta is up to date.
    If you are using Oracle 10, then you can't use the virtual column feature, but you can create regular columns and write triggers to populate them, based on other values in the same row. I don';t know if this would serve your needs better than a materialized view or not.

  • Slow Query on Virtual Tables

    Hello!
    I am using a proprietary IDE environment to compile some applications. I cannot change the following SQL query it performs. During "Compile", the IDE is checking the DB Function calls in the app by executing the following
    SQL Statement:
    select c.owner, c.synonym_name, INSTR(a.object_type, 'PROC'), '1' from sys.dba_objects a, sys.dba_synonyms c where c.table_owner = a.owner and c.table_name = a.object_name and a.object_type IN ('FUNCTION','PROCEDURE') and a.status = 'VALID' and c.owner like'USERNAME'escape'\'
    *of course, I put in USERNAME where an actual UserName/Owner name was.
    This is the query that happens for every DB Procedure step in the application. The app isn't holding the list in memory and using it over again (that would help performance, but is probably impossible to have the IDE updated in a reasonable timeframe).
    There are 50,000 objects and 10,000 synonyms on this database server. This query takes 20 seconds to complete. When I remove the last WHERE condition - c.owner like'USERNAME'escape'\' - the query takes 3 seconds.
    Is there a way I can speed up this query? If I use a login with some restriced permissions, will it limit what I see in the SYN$ table?
    Is there a better way to state this query? I can make a recommendation to the IDE company (but I probably won't get a patch for months).
    Thanks for your help,
    Eric

    Could you try the following?
    select /*+ full ( a ) full ( c ) */
    c.owner, c.synonym_name, INSTR(a.object_type, 'PROC'), '1'
    from sys.dba_objects a
    ,sys.dba_synonyms c
    where c.table_owner = a.owner
    and c.table_name = a.object_name
    and a.object_type IN ('FUNCTION','PROCEDURE')
    and a.status = 'VALID'
    and c.owner like 'X_OWNER' escape'\'

  • Berkeley DB, SQLite and virtual tables

    Is it possible to compile support for the RTree module and the fts3 module with this version?
    Thanks
    Sebastian

    Ok Sorry for disturbing the peace.
    I compiled the distribution with -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS
    And it appears to work just fine.
    I think this should be compiled into the binary distribution since both are very important features
    Thanks again
    Sebastian

  • Insertion in Table with Virtual Column

    Hi,
    I am using 11.1.0.7.0 on Solaris 10.
    I created following table:
    test@mytest> create table mytest (c1 number, c2 number generated always as (1) virtual);
    Table created.
    test@mytest> create unique index idx on mytest(c2);
    Index created.
    test@mytest> insert into mytest values(1);
    insert into mytest values(1)
    ERROR at line 1:
    ORA-00947: not enough values
    test@mytest> Why it is not letting me insert into the table, because we cannot insert value in a virtual column?
    regards
    Edited by: Panicked DBA on Aug 28, 2010 3:59 AM

    This works a little bit better but not really as expected:
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    SQL> drop table mytest purge;
    Table dropped.
    SQL>
    SQL> create table mytest (c1 number, c2 number generated always as (1) virtual);
    Table created.
    SQL> create unique index idx on mytest(c2);
    Index created.
    SQL> insert into mytest(c1) values(1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> set null IS_NULL
    SQL> select c1, c2 from mytest ;
            C1         C2
             1It looks like there is a bug if you specify C2 NUMBER data type:
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    SQL> drop table mytestok purge;
    Table dropped.
    SQL> drop table mytestko purge;
    Table dropped.
    SQL>
    SQL> create table mytestok (c1 number, c2 generated always as (1) virtual);
    Table created.
    SQL> insert into mytestok(c1) values(1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select c1, c2 from mytestok ;
            C1         C2
             1          1
    SQL> select * from mytestok where c2 = 1;
            C1         C2
             1          1
    SQL>
    SQL> create table mytestko (c1 number, c2 number generated always as (1) virtual);
    Table created.
    SQL> insert into mytestko(c1) values(1);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> set null IS_NULL
    SQL> select c1, c2 from mytestko ;
            C1         C2
             1
    SQL> select * from mytestko where c2 = 1;
    no rows selected
    SQL> exit

  • Report from PL/SQL Table

    Thanks for answer to my first question. Now I have another problem.
    Is there any way to print a report based on virtual table, which is created during some Pl/SQL procedure and can't be easily decribed by Select statement

    SELECT FROM PL/SQL TABLE IN ORACLE REPORTS 6I
    The requirement is to populate a table and then select from that table in a report. The typical solution is to
    populate a database table, but for situations where that is undesirable there is a way to select from a PL/SQL
    table.
    For example - for each employee we want to populate a PL/SQL table and then select from that table.
    I used the following records in the emp table:
    INSERT INTO Emp VALUES(123,'Bob','Sales',555,'28-JAN-79',35000,12,30);
    INSERT INTO Emp VALUES(321,'Sue','Finance',555,'12-MAY-83',42000,12,10);
    INSERT INTO Emp VALUES(234,'Mary','Account',555,'14-AUG-82',33000,12,20);
    INSERT INTO Emp VALUES(623,'Joe','Sales',555,'28-JAN-79',35000,12,30);
    INSERT INTO Emp VALUES(621,'Jim','Finance',555,'12-MAY-83',42000,12,10);
    INSERT INTO Emp VALUES(634,'Jane','Account',555,'14-AUG-82',33000,12,20);
    INSERT INTO Emp VALUES(723,'Fred','Sales',555,'28-JAN-79',35000,12,30);
    INSERT INTO Emp VALUES(721,'Meg','Finance',555,'12-MAY-83',42000,12,10);
    INSERT INTO Emp VALUES(734,'Jill','Account',555,'14-AUG-82',33000,12,20);
    =============================================================================================
    Step 1: Create a package spec in the report:
    PACKAGE pkg_table IS
    TYPE t_rec IS RECORD (
    field1 NUMBER(6),
    field2 VARCHAR2(30));
    TYPE t_tab IS TABLE OF t_rec INDEX BY BINARY_INTEGER;
    gv_tab t_tab;
    FUNCTION populate (
    p_empno NUMBER) RETURN NUMBER;
    END;
    Step 2: Create the package body:
    PACKAGE BODY pkg_table IS
    FUNCTION populate (
    p_empno NUMBER) RETURN NUMBER IS
    BEGIN
         gv_tab.DELETE;
         -- populate table as required - for demo purposes put in anything
         FOR lv_ind IN 1..MOD(p_empno,20) LOOP
              gv_tab(lv_ind).field1 := lv_ind;
              gv_tab(lv_ind).field2 := 'row '||TO_CHAR(lv_ind)||' for emp '||TO_CHAR(p_empno);
         END LOOP;
         RETURN gv_tab.COUNT;
    END populate;
    END;
    Step 3: Create the master query:
    SELECT empno,
    ename
    FROM emp
    Step 4: Add a formula column CF_populate to the master query that does:
    function CF_populateFormula return Number is
    -- for each emp fetched this formula will repopulate the PL/SQL table
    -- and return the number of records in the table
    begin
    return pkg_table.populate(:empno);
    end;
    Step 5: Create the detail query:
    -- we need to join this to the master and then ensure that for each
    -- empno there are as many records fetched as there will be
    -- records in the PL/SQL table
    SELECT e1.empno,rownum
    FROM emp e1, emp e2, emp e3
    WHERE rownum <= :CF_populate
    Step 6: Add formula columns to the detail query for each of the fields in the
    PL/SQL table we want to display:
    CF_Field1:
    function CF_field1Formula return Number is
    begin
    return pkg_table.gv_tab(:rownum).field1;
    end;
    CF_Field2:
    function CF_field2Formula return Varchar2 is
    begin
    return pkg_table.gv_tab(:rownum).field2;
    end;
    Step 7: Create the repeating frame and layout items to display the formula columns.
    =============================================================================================
    The same technique can be used to populate a master query. In a report level formula column
    CF_Populate populate the PL/SQL table as required. In the master query we just need the rownum:
    SELECT rownum
    FROM emp, emp, emp
    WHERE rownum <= :CF_Populate
    Add the formula columns to display Field1 and Field2.
    =============================================================================================
    Hugh Nelson
    26/04/2005

  • XML Schema Collection (SQL Server 2012): How to create an XML Schema Collection that can be used to Validate a field name (column title) of an existing dbo Table of a Database in SSMS2012?

    Hi all,
    I used the following code to create a new Database (ScottChangDB) and a new Table (marvel) in my SQL Server 2012 Management Studio (SSMS2012) successfully:
    -- ScottChangDB.sql saved in C://Documents/SQL Server XQuery_MacLochlainns Weblog_code
    -- 14 April 2015 09:15 AM
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'ScottChangDB')
    DROP DATABASE ScottChangDB
    GO
    CREATE DATABASE ScottChangDB
    GO
    USE ScottChangDB
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL, [ID] INT NULL)
    INSERT INTO marvel
    (avenger_name,ID)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8);
    SELECT avenger_name FROM marvel ORDER BY ID For XML PATH('')
    DECLARE @x XML
    SELECT @x=(SELECT avenger_name FROM marvel ORDER BY ID FOR XML PATH('Marvel'))--,ROOT('root'))
    SELECT
    person.value('Marvel[4]', 'varchar(100)') AS NAME
    FROM @x.nodes('.') AS Tbl(person)
    ORDER BY NAME DESC
    --Or if you want the completed element
    SELECT @x.query('/Marvel[4]/avenger_name')
    DROP TABLE [marvel]
    Now I am trying to create my first XML Schema Collection to do the Validation on the Field Name (Column Title) of the "marvel" Table. I have studied Chapter 4 XML SCHEMA COLLECTIONS of the book "Pro SQL Server 2008 XML" written by
    Michael Coles (published by Apress) and some beginning pages of XQuery Language Reference, SQL Server 2012 Books ONline (published by Microsoft). I mimicked  Coles' Listing 04-05 and I wanted to execute the following first-drafted sql in
    my SSMS2012:
    -- Reference [Scott Chang modified Listing04-05.sql of Pro SQL Server 2008 XML by Michael Coles (Apress)]
    -- [shcColes04-05.sql saved in C:\\Documents\XML_SQL_Server2008_code_Coles_Apress]
    -- [executed: 2 April 2015 15:04 PM]
    -- shcXMLschemaTableValidate1.sql in ScottChangDB of SQL Server 2012 Management Studio (SSMS2012)
    -- saved in C:\Documents\XQuery-SQLServer2012
    tried to run: 15 April 2015 ??? AM
    USE ScottChangDB;
    GO
    CREATE XML SCHEMA COLLECTION dbo. ComplexTestSchemaCollection_all
    AS
    N'<?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="marvel">
    <xsd:complexType>
    <xsd:all>
    <xsd:element name="avenger_name" />
    <xsd:element name="ID" />
    </xsd:all>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>';
    GO
    DECLARE @x XML (dbo. ComplexTestSchemaCollection_all);
    SET @x = N'<?xml version="1.0"?>
    <marvel>
    <avenger_name>Thor</name>
    <ID>4</ID>
    </marvel>';
    SELECT @x;
    GO
    DROP XML SCHEMA COLLECTION dbo.ComplexTestSchemaCollection_all;
    GO
    I feel that drafted sql is very shaky and it needs the SQL Server XML experts to modify to make it work for me. Please kindly help, exam the coding of my shcXMLTableValidate1.sql and modify it to work.
    Thanks in advance,
    Scott Chang

    Hi Scott,
    2) Yes, FOR XML PATH clause converts relational data to XML format with a specific structure for the "marvel" Table. Regarding validate all the avenger_names, please see below
    sample.
    DECLARE @x XML
    SELECT @x=(SELECT ID ,avenger_name FROM marvel FOR XML PATH('Marvel'))
    SELECT @x
    SELECT
    n.value('avenger_name[1]','VARCHAR(99)') avenger_name,
    n.value('ID[1]','INT') ID
    FROM @x.nodes('//Marvel') Tab(n)
    WHERE n.value('ID[1]','INT') = 1 -- specify the ID here
    --FOR XML PATH('Marvel')  --uncommented this line if you want the result as element type
    3)i.check the xml schema content
    --find xml schema collection
    SELECT ss.name,xsc.name collection_name FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    select * from sys.schemas
    --check the schema content,use the name,collection_name from the above query
    SELECT xml_schema_namespace(N'name',N'collection_name')
    3)ii. View can be viewed as virtual table. Use a view to list the XML schema content.
    CREATE VIEW XSDContentView
    AS
    SELECT ss.name,xsc.name collection_name,cat.content
    FROM sys.xml_schema_collections xsc JOIN sys.schemas ss ON xsc.schema_id= ss.schema_id
    CROSS APPLY(
    SELECT xml_schema_namespace(ss.name,xsc.name) AS content
    ) AS cat
    WHERE xsc.name<>'sys'
    GO
    SELECT * FROM XSDContentView
    By the way, it would be appreciated if you can spread your questions into posts. For any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • View on DB Table

    I want to create a view on DB Table eg CSKS. Can anyone show me how to do this or Show me where I can find information to create view on DB Table.
    Thanks.

    hi anil,
    In database theory, a view is a virtual or logical table composed of the result set of a query. Unlike ordinary tables (base tables) in a relational database, a view is not part of the physical schema: it is a dynamic, virtual table computed or collated from data in the database. Changing the data in a table alters the data shown in the view.
    The result of a view is stored in a permanent table whereas the result of a query is displayed in a temporary table.
    Views can provide advantages over tables;
    They can subset the data contained in a table
    They can join and simplify multiple tables into a single virtual table
    Views can act as aggregated tables, where aggregated data (sum, average etc.) are calculated and presented as part of the data
    Views can hide the complexity of data, for example a view could appear as Sales2000 or Sales2001, transparently partitioning the actual underlying table
    Views take very little space to store; only the definition is stored, not a copy of all the data they present
    Depending on the SQL engine used, views can provide extra security.
    Views can limit the exposure to which a table or tables are exposed to the outer world
    Just like functions (in programming) provide abstraction, views can be used to create abstraction. Also, just like functions, views can be nested, thus one view can aggregate data from other views. Without the use of views it would be much harder to normalise databases above second normal form. Views can make it easier to create lossless join decomposition.
    Rows available through a view are not sorted. A view is a relational table, and the relational model states that a table is a set of rows. Since sets are not sorted - per definition - the rows in a view are not ordered either. Therefore, an ORDER BY clause in the view definition is meaningless and the SQL standard (SQL:2003) does not allow this for the subselect in a CREATE VIEW statement.
    Read-only vs. updatable views
    Views can be read-only or updatable. If the database system is able to determine the reverse mapping from the view schema to the schema of the underlying base tables, then the view is updatable. INSERT, UPDATE, and DELETE operations can be performed on updatable views. Read-only views do not support such operations because the DBMS is not able to map the changes to the underlying base tables.
    Some systems support the definition of INSTEAD OF triggers on views. This technique allows the definition of logic that shall be executed instead of an insert, update, or delete operation on the views. Thus, data modifications on read-only views can be implemented. However, an INSTEAD OF trigger does not change the read-only or updatable property of the view itself.
    Advanced view features
    Various database management systems have extended the views from read-only subsets of data. The Oracle database introduced the concept of materialized views, which are pre-executed, non-virtual views commonly used in data warehousing. They are a static snapshot of the data and may include data from remote sources. The accuracy of a materialized view depends on the frequency or trigger mechanisms behind its updates. DB2 provides so-called materialized query tables (MQTs) for the same purpose. Microsoft SQL Server, introduced in the 2000 version, indexed views which only store a separate index from the table, but not the entire data.
    Equivalency:
    A view is equivalent to its source query. When queries are run against views, the query is modified. For example, if there exists a view named Accounts_view and the content is:
    accounts view:
    SELECT name,
           money_received,
           money_sent,
           (money_received - money_sent) AS balance,
           address,
      FROM table_customers c
      JOIN accounts_table a
        ON a.customerid = c.customer_id
    The application would simply run a simple query such as:
    Sample query
    SELECT name,
           balance
      FROM accounts_view
    The RDBMS then takes the simple query, replaces the equivalent view, then sends the following to the optimiser:
    Preprocessed query:
    SELECT name,
           balance
      FROM (SELECT name,
                   money_received,
                   money_sent,
                   (money_received - money_sent) AS balance,
                   address,
              FROM table_customers c JOIN accounts_table a
                   ON a.customerid = c.customer_id        )
    From this point on the optimizer takes the query, removes unnecessary complexity (i.e. it is not necessary to read the address, since the parent invocation does not make use of it) and then sends the query to the SQL engine for processing.
    thanks
    karthik
    reawrd me if usefull

  • How can I create a universe with the BO repository tables?

    Hi. I need make a universe with the BO repository tables, in order to get user information .
    But, when I try to insert tables in designer, using a new conecction to BO repository. I can't see tables.
    Someone can help me?

    The CMS repository is organized into both physical and virtual tables. Only the CMS can access the virtual tables, therefore you cannot create a universe on the CMS repository. You can access the CMS repository information through the Enterprise SDK.
    https://www.sdn.sap.com/irj/boc/businessobjects-sdklibrary

Maybe you are looking for

  • Creation of Multiple Activities for same Employee,same day and same time

    Hi Experts, In CRM 2007 I am creating an Activity(e.g Customer Visit) for a particular day for a particular employee. I am selecting the Option "Whole Day". When again I am creating another Activity same day and for same employee the ideally system s

  • Tuxedo 8.1 on Fedora Core 1?

    Hi all, I guess this is more a Linux question than Tuxedo one. It is not important as I have dual boot and no current problems with XP Pro and our target platform is AIX anyway, but I'd like to set up Tuxedo under RedHat Fedora core 1. I attempted th

  • Installed R9 290x Gaming, fans spin, that's it

     There is no display, all USB devices are not lighting not sure what to try next.

  • Couldnot able to use the database adapter in JDEV 10.1.2

    Iam facing problem while creating the database adapter I have dragged the partnerlink to the diagram view and then click the database adapter icon ,the wizard will open , Choose "APPS" for Schema. Select "HZ_ORGANIZATION_BO_PUB.CREATE_ORGANIZATION_BO

  • Standard report Variant creation

    Hi , i am trying to create the dynamic variant for standard report   RKWTP_CPTD, which contains the period and fiscal year fields on selection screen, now i need to create variant as period has to  be current month -1 month i.e it has to show previou