Can create view, but cannot create table / materialized view: Xpath is null

Hi all,
We recently moved some XML documents into the database in an XMLType column and want to query the data. I've been writing some queries and turning them into materialized views. I got to one query, and something really strange is happening. My query returns the expected results, but I am getting an error when I try to create a materialized view out of it. Even stranger, I can create a view out of it, and I can manually insert its data into an existing table, but I cannot create a materialized view out of it and I cannot create a table out of it. Here is a brief summary, please let me know if anyone has suggestions.
Issuing the following commands fails in SQLDeveloper
-- Creating a materialized view out of the query fails:
create materialized view element REFRESH COMPLETE ON DEMAND as [query];
Error at Command Line:1 Column:1 SQL Error: ORA-31063: XPath compilation failed: Xpath is null.
-- Creating a table out of the query with the following shortcut fails:
create table element as [query];
Error at Command Line:1 Column:1 SQL Error: ORA-31063: XPath compilation failed: Xpath is null.
Issuing the following commands in SQLDeveloper works fine:
-- Creating a view out of the query works:
create or replace view element as [query];
-- Creating a blank table from the query and then inserting data works:
create table element as select * from [query] where 1 = 2;
insert into element select * from [query];
Here is a simplified version of the query...
I have changed the names around, and cut the query down so maybe it will be a little easier to understand. I did confirm that this query is also having the same symptoms described above. Since I changed the names, executing the query returns no results. However creating a materialized view out of the query still fails with the 'Xpath is null' error.
create materialized view element REFRESH COMPLETE ON DEMAND as
select
m.resource_id,
xml.*
from metadata_sources m,
xmltable(
'for $i in /metadata/app//*[(self::elem1 or self::elem2) and (parent::form or parent::subform)]
let $formName := if($i/parent::subform) then $i/../../@name else $i/../@name
let $subformName := if($i/parent::subform) then $i/../@name else ""
return <data
appId="{$i/ancestor::app[1]/idField}"
formName="{$formName}"
subformName="{$subformName}"
elemName="{$i/@name}"></data>' passing m.xml_content
columns
app_id NUMBER path '@appId',
form_name VARCHAR2(50 char) path '@formName',
subform_name VARCHAR2(50 char) path '@subformName',
elem_name VARCHAR2(50 char) path '@elemName'
) xml;
Edited by: user11949534 on Feb 22, 2013 1:55 PM

As far as creating a structured index, I was under the impression that I would need to then register an XSD. No, you can use it without an XML schema.
How about a regular relational view, with an underlying xml index?
That way you also eliminate the need for an explicit refresh step as you would then be querying real-time data, as if it were relational data.
For example :
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
SQL> create table tmp_xml of xmltype ;
Table created.
SQL> insert into tmp_xml values (
  2    xmlparse(document '<root><item id="1">ABC</item><item id="2">DEF</item></root>')
  3  ) ;
1 row created.
SQL> insert into tmp_xml values (
  2    xmlparse(document '<root><item id="3">GHI</item><item id="4">JKL</item></root>')
  3  ) ;
1 row created.
SQL> create or replace view tmp_xml_v as
  2  select x.item_id, x.item_val
  3  from tmp_xml
  4     , xmltable(
  5         '/root/item' passing object_value
  6         columns item_id  number      path '@id'
  7               , item_val varchar2(3) path '.'
  8       ) x
  9  ;
View created.
SQL> create index tmp_xml_sxi on tmp_xml (object_value)
  2  indextype is xdb.xmlindex
  3  parameters (q'#
  4  XMLTABLE tmp_xml_xtb '/root/item'
  5  COLUMNS item_id  number      path '@id'
  6        , item_val varchar2(3) path '.' #'
  7  ) ;
Index created.
SQL> exec dbms_stats.gather_table_stats(user, 'TMP_XML');
PL/SQL procedure successfully completed.
SQL> set autotrace on explain
SQL> set lines 200
SQL> select * from tmp_xml_v ;
   ITEM_ID ITE
         3 GHI
         4 JKL
         1 ABC
         2 DEF
Execution Plan
Plan hash value: 4168126828
| Id  | Operation                    | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT             |                        |     4 |   164 |     3   (0)| 00:00:01 |
|   1 |  NESTED LOOPS                |                        |       |       |            |          |
|   2 |   NESTED LOOPS               |                        |     4 |   164 |     3   (0)| 00:00:01 |
|   3 |    INDEX FULL SCAN           | SYS_C009273            |     2 |    34 |     1   (0)| 00:00:01 |
|*  4 |    INDEX RANGE SCAN          | SYS30366_30367_OID_IDX |     2 |       |     0   (0)| 00:00:01 |
|   5 |   TABLE ACCESS BY INDEX ROWID| TMP_XML_XTB            |     2 |    48 |     1   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   4 - access("TMP_XML"."SYS_NC_OID$"="SYS_SXI_0"."OID")

Similar Messages

  • System can receive email, but cannot create workitem

    Hello Expert,
    I think already do all the IMG settings about ERMS, but question is system now can receive internet email, but cannot create workitem. Cannot go to work flow.
    In SWI1, there is always empty.
    In CRM_ERMS_LOGGING, there is exception in class CL_CRM_ERMS_ADD2FB_DOCUMENT.
    Please help me about this.
    Thanks a lot!

    hi  Saozinha,
    Actually I do not know which need to check.
    In our system, RFC destination is WF-BATCH. Any other settings need to be checked?
    In SO28, I made the settings like this:
    Recipient                                                                                AddrType       
    [SALES.CRM@* - this is system defined the receiver address]      Internet address
    New recipient                                                             AddrType                      Sender        AddrType
    ERMS:Test Recipient Addr (SALES.CRM*         Business Object           [ ]                  [ ]
    Any idea?
    Thanks a lot!

  • After installing Mavericks my email isn't allowing me to draft a new message. I can see my messages, but cannot create a new message or reply to any messages. When I try nothing happens, then Mail freezes all together.

    I can see my messages, but cannot create a new message or reply to any messages.
    When I try nothing happens, then Mail freezes all together and usually crashes.
    I was able to get into my Mail settings and everything looks ok as far as I can tell.
    Has anyone else seen this? My software is completely up to date now (unfortunately).
    Thanks in advance for any help or advice.

    Do a backup.
    Quit Mail.
    Go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J.  When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder. Go to Library/Containers/com.apple.mail.  Move the folder com.apple.mail to your desktop. You must move the entire folder, not just the contents.
    Restart, re-launch Mail and test. If the problem is solved, recreate any required Mail settings and import any emails you want to save from the folder on the desktop. You can then put the folder in the Trash. If the problem remains, return the folder to where you got it replacing the one that is there. 
    Information learned from Linc Davis. Thanks to leonie for some information contained in this.
    https://discussions.apple.com/message/23609117#23609117

  • I updated to Lion, and all of my events show up, but I cannot "add invitees" to any event. I can accept/reject invites, but cannot create them myself.

    Help!  updated to Lion, and all of my events show up, but I cannot "add invitees" to any event. I can accept/reject invites, but cannot create them myself.

    Purplehiddledog wrote:
    I do backup with iCloud.  I can't wait until the new iMac is available so that I can once again have my files in more than 1 location without needing to rely solely on the cloud. 
    I also rely on iTunes and my MacBook and Time Machine as well as backing up to iCloud. I know many users know have gone totally PC free, but I chose to use iCloud merely as my third backup.
    I assume that the restore would result in my ability to open Pages and Numbers and fix the problem with deleting apps, but this would also mean that if my Numbers documents still exist solely within the app and are just not on iCloud for some reason that they would be gone forever.  Is that right?
    In a word, yes. In a little more detail.... When you restore from an iCloud backup, you must erase the device and start all over again. There is no other way to access the backup in iCloud without erasing the device. Consequently, you are starting all over again. Therefore, it would also be my assumption that Pages and Numbers will work again and that the deleting apps issues would be fixed as well.
    If the documents are not in the backup, and you do not have a backup elsewhere, the documents could be gone forever.

  • Time Capsule 4 gen. with iMac OS X Lion   3 Windows PC (XP OS, Vista OS, Seven OS) cable modem with TC as Wi-Fi. Time Machine on iMac found TC for backup easily. Have Wi-Fi access on PC XP with Airport utility but cannot create TC.

    Installed today Time Capsule 4 gen. with iMac OS X Lion. I also have  3 Windows PC (XP OS, Vista OS, Seven OS). Internet Access is cable modem with TC as Wi-Fi. Time Machine on iMac found TC for backup easily. Have Wi-Fi access on PC XP with Airport utility but cannot create TC. Does the Airport utility under Windows is way to access backup capabilities with TC ?

    The TC is really just an external networked hard disk plus router.. you can access the hard disk and place files on it from any computer. You can backup any computer to the TC but it will have to use a backup software in windows.. there are literally thousands available. The built in msbackup is horrible.. but you can download lots of different software and buy then online for not a lot. Macrium Reflect has a free disk image backup, and when you pay for it includes incremental. I think disk images are well worth it, as they recover much better.. and their is a proper method of recovery using a boot cd.
    BTW the TC space is not endless. And it is designed to hold a large number of incremental backups.. so anything you do in backing up several machines will make the number of backups limited. Remember you can also use a usb hard disk plugged in as a Network accessible disk. But it has to be formatted HFS+ or Fat32.. the later being highly undesirable.

  • Registering an existing table (Materialized View)

    I am planning to create Materialized Views using the existing tables.
    I have one thing that I am not clear on syntax for this...
    ON PREBUILT TABLE WITH REDUCED PRECISION
    - Specify WITH REDUCED PRECISION to authorize the loss of precision that will result if the precision of the table or materialized view columns do not exactly match the precision returned by subquery.
    ON PREBUILT TABLE WITHOUT REDUCED PRECISION
    -Specify WITHOUT REDUCED PRECISION to require that the precision of the table or materialized view columns match exactly the precision returned by subquery, or the create operation will fail. This is the default.
    I want to know what these are for and see examples
    Thanks

    More information:
    I can run the 'DROP MATERIALIZED VIEW' command over and over without getting an error. eg:
    DROP MATERIALIZED VIEW VIC_86173_18
    Snapshot dropped
    DROP MATERIALIZED VIEW VIC_86173_18
    Snapshot dropped
    DROP MATERIALIZED VIEW VIC_86173_18
    Snapshot dropped
    DROP MATERIALIZED VIEW VIC_86173_18
    Snapshot dropped
    DROP MATERIALIZED VIEW VIC_86173_18
    Snapshot dropped

  • User can receive email but cannot send

    Hi,
    I'm migrating a domain in an organization to another new domain. Now, we are migrating the workstations to the new domain. Users are not migrated, they are completely new in the new domain.
    So, the problem is that we have a workstation in the new domain and the user from new domain logged on on this machine. The user has successfully configured is old exchange account in Outlook (Exchange server is still in the old domain) and can receive email,
    but cannot send. 
    Can someone help please to find what is wrong?

    Hi Silva,
    Thank you for your question.
    Is there NDR when you send email?
    Which way outlook connect Exchange 2013?
    Where is email which was sent? “sent item” or “Draft”?
    Which user mailbox use when you configure profile? New domain user or old domain user?
    We could create a trust between new domain and old domain:
    https://technet.microsoft.com/en-us/library/cc779840(WS.10).aspx
    We could ping old domain successfully on the new domain.
    If we have created mailbox for new domain user on old exchange, we could refer to the following link:
    https://technet.microsoft.com/en-us/library/aa998031(v=exchg.150).aspx?f=255&mspperror=-2147217396
    In addition, we suggest we migrate user and Exchange to new domain as soon as possible.
    If there are any questions regarding this issue, please be free to let me know.
    Best Regard,
    Jim

  • Email account can send email but cannot recieve

    My new contractor email account can send email but cannot receive. GIT had identified the problem "Mail record not created in LDAP" but it has been more than a week and still no fix.
    Can anyone help?
    Thanks
    James

    Hi James,
    Contractors by default are not provided email access. Your manager needs to request for a mail record from APS. If your manager had already requested for a mail record, then you need to raise a service request with helpdesk.
    Moreover you're reporting this issue in the wrong forum.
    Thanks,
    Jereen

  • I can receive mail but cannot answer or forward or do anything with the body  of the message including scroll through it.

    My mail program has stopped  working. I can receive emails but cannot do anything with the message,scroll through, answer or create a new message to be sent.

    Quit the mail app completely and restart the iPad. Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar. Restart the iPad.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Or .... Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.

  • How can I change the name of a Materialized View?

    How can I change the name of a Materialized View?

    Oracle permitted renaming the snapshot in the earlier versions of 8i. However, it does not permit renaming the materialized view in 9i or 10g.
    SQL> rename mymatview to mymatview2;
    rename mymatview to mymatview2
    ERROR at line 1:
    ORA-32318: cannot rename a materialized view
    SQL> disconnect
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP and Data Mining options
    SQL> rename mymatview to mymatview2;
    rename mymatview to mymatview2
    ERROR at line 1:
    ORA-32318: cannot rename a materialized view
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Production

  • "Setup encountered a problem while validating the state of Active Directory: Exchange organization-level objects have not been created, and setup cannot create them because the local computer is not in the same domain and site as the schema master. Run se

    Team,
    I am trying to Install Exchange on my Lab, getting below error
    message.
    The Schema Role is installed on Root Domain and trying to install
    exchange on Child domain.
    1 Root Domain - 1 Child domain. both are located on single site.
    “Setup encountered a problem while validating
    the state of Active Directory: Exchange organization-level objects have not been created, and setup cannot create them because the local computer is not in the same domain and site as the schema master. Run setup with the /prepareAD parameter and wait for
    replication to complete.”
    Followed below articles:
    http://support.risualblogs.com/blog/2012/02/21/exchange-2010-sp2-upgrade-issue-exchange-organization-level-objects-have-not-been-created-and-setup-cannot-create-them-because-the-local-computer-is-not-in-the-same-domain-and-site-as-the-sche/
    http://www.petenetlive.com/KB/Article/0000793.htm
    transferred the schema roles to different server on root domain, still no luck.
    can someone please help me.
    regards
    Srinivasa k
    Srinivasa K

    Hi Srinivasa,
    I guess, you didn't completed the initial setup schemaprep and adprep before starting the installation. You can do it as follows:
    1. Open command Prompt as administrator and browse to the root of installation cd and run Setup.exe /PrepareSchema /IAcceptExchangeServerLicenseTerms
    After finishing this,
    2. Setup.exe /PrepareAD /OrganizationName:"<organization name>" /IAcceptExchangeServerLicenseTerms
    3. To prepare all domains within the forest run Setup.exe /PrepareAllDomains /IAcceptExchangeServerLicenseTerms. If you want to prepare a specific domain run Setup.exe /PrepareDomain:<FQDN of the domain you want to prepare> /IAcceptExchangeServerLicenseTerms
    4. Once you complete all of the 3 steps, install the pre-requisities for Exchange 2013
    5. Finally, run the setup program
    Hope this will help you
    Regards from Visit ExchangeOnline |
    Visit WindowsAdmin

  • IPod Touch 2nd Gen can stream Youtube but cannot stream Apps that supports Online Streaming , it just kicks itself out of the app

    iPod Touch 2nd Gen can stream Youtube but cannot stream Apps that supports Online Video Streaming , it just kicks itself out of the app.
    It used to be able to stream apps that supports Online Video Streaming , tried Restore a couple of times and it didn't help .
    What could the issue be ?

    The ESPN Radio is basically a Paid radio station.Make sure you have enuff balance to stream a radio from your Iphone. .
    Check if you required to open any ports on your router for ESPN Radio. 

  • ITunes has stopped working.  Can play songs, but cannot access store.  What do I do?

    iTunes has stopped working.  Can play songs, but cannot access store.  What do I do?

    Hello there, Ellen317.
    The following Knowledge Base article provides some great in-depth steps for troubleshooting your issue. Start with the section titled Troubleshoot issues in Windows:
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro

  • Tried to mirror my iPad to the tv and got sound but no picture. Can run videos but cannot see I pad screenshot

    Tried to mirror my iPad to the tv and got sound but no picture. Can run videos but cannot see I pad screen. Looked on support and it said touch the mirror button but I have no mirror button. What am I missing

    Hi Ginger611, 
    Welcome to the Apple Support Community!
    It sounds like you are trying to mirror your iPad to your TV using an Apple TV but don’t see the mirroring option. Please use the attached article for information on setting up AirPlay Mirroring. 
    iOS: Use AirPlay Mirroring
    Cheers,
    Joe

  • HT4623 when iOS7 was installed all apps purchased disappeared; now when I go to app store I can open app, but cannot get app to install onto the screen; How can this be accomplished?

    When i0S7 was installed on iphone all purchased apps disappeared.  Now when I go to app store I can open app, but cannot get app to install on phone.  How can I get apps installed back onto iphone screen?

    Press your home button, then scroll the home screen all the way over to the right. I found all my purchased apps were moved to a different home screen. Might be a similar issue.. let us know what you found out!!
    Cheers.

Maybe you are looking for

  • How to use where clause with get statement in LDB programs

    Hi All, I am using logical databse in my report program.I am not getting how to use the where clause in the get statement is it possible to use?or if not possible only option is we should filter it after get statment is right?Can you please some body

  • Is it possible to open a new Worksheet without creating a new *.sql file

    Hello Community, Declaimer: It may be a trivial question. I just willing to make SQL Developer my default day to day tool. I is possible to open a new Worksheet without creating a new *.sql file. Like in an MS Word. If I just need some space to write

  • ITunes Crashes when PC is Locked

    For privacy I lock my PC (win+L) when i leave it, and all other programs apart from iTunes cope, and time after time I come back to find plays, importing, syncing, and downloads have crashed, or rather iTunes as a whole has. Anyone else have this pro

  • Best strategy for offsite backups

    I am using TM on an external hard drive (call it #1) with my iMac, however I want to store a backup offsite, in the event of a fire, etc. Can you use TM on one machine to make back ups on multiple different external hard drives (not necessarily at th

  • Utlirp.sql

    Hello, When we run utlirp.sql it makes valid objects to invalid objects and it compiles them.But in what case do we need to make the valid objects invalid.Why dont we just compile the invalid objects directly it reduces the work rite? Kindly tell me