Required complicated updateXML

Hello

First of All, I'll apologize in advance one) the stupidity of bits of the obligation that I am trying to solve (you'll know 'em when you see em!) and b) if I accidentally simplify my example.

The requirements that I work with are not yet completely hammered, but I think I have to go down the route of what is, essentially, an update of several nodes in an xmltype column (stored as a CLOB; we're on 10.2.0.4) based on the question whether the node has one matching row in another table. Oh, and it comes to slot in an existing, dynamic piece of SQL in a PL/SQL procedure massively too complicated. Oh, the joy in my life... (kill me now?)

In any case, here is a very simplified version of the query that the result is that I need to change (xdata is the xmldata column I am interested in the update):

Select..., sd.xdata...

FROM table1 t1,

sample_data sd,

....

where sd.id2 = t1.id

and...;

When we store the data in the table sample_data, I intend to remove the data in the rep_node nodes (which there is usually only one node, but it turns out that there may also be several knots, and they may contain different values) in a separate table extracted_data with one ordered column pk in the sample_data table (id1). I can't outer join these values with the matching_table to get the new_value, which is what I have to sort out as part of the query (I can not update the column xdata with this information in the table, that may change the data in the matching_table, so everything must be done in the query).

This is the query, I came up with that:

with sample_data as (select 1 id1, 10 id2, xmltype ("< a > < b > < c > 1 </c > < d > < e > 2 < /e > < rep_node > 3 < / rep_node > < f > < g > < rep_node > 4 < / rep_node > < / g > < h > < rep_node > 5 < / rep_node > < / h > < / > < f / d")) (> < / b > < / a > ') xdata Union double all the

Select id1, id2 10 2, xmltype ("<>< i > < d > < k > 1 < /k > < l > 2 </l >/< day > < m > < rep_node > 3 < / rep_node > < n > 4/< n > < / m > < / i > < / has > '") double xdata) ,

extracted_data as (select sd.id1, x.*)

of sample_data sd,.

XMLTable ('/ / rep_node' in passing sd.xdata)

columns for the ordinalite RN,

rep_node_val path number '.') (x),

match_data as (select 3 old_val, 30 new_val of all the double union)

Select 5 old_val, 50 double new_val)

Select sd.*,

Ed.RN,

Ed.rep_node_val,

MD.*

of sample_data sd,.

extracted_data ed,

match_data md

where ed.rep_node_val = md.old_val (+)

and sd.id1 = ed.id1;

As you can see on the example above, the rep_node does not always appear in the same place, and I do not know XPath expressions it can appear in, which makes this super fun to work with * rolls eyes *.

The problem is, now, I have several lines with each line in the table sample_data with several rep_nodes. How the hell I that sink down in a line, as well as update the xdata column to show the corresponding new_value in the nodes of rep_node?

for example. in the example above

original: < a > < b > < c > 1 </c > < d > < e > 2 < /e >< rep_node > 3 < / rep_node >< f > < g >< rep_node > 4 < / rep_node ></g > < h >< rep_node > 5 < / rep_node >< HR > < / f > < / d > < / b > < / has >

Wanted: < a > < b > < c > 1 </c > < d > < e > 2 < /e >< rep_node > 30 < / rep_node >< f > < g >< rep_node > 4 < / rep_node ></g > < h >< rep_node > 50 < / rep_node >< HR > < / f > < / d > < / b > < / has >

original: <>< i > < d > < k > 1 < /k > < l > 2 </l >/< day > < m>< rep_node > 3 < / rep_node >< n > 4/< n > < / m > < / i > < / has >

Wanted: <>< i > < d > < k > 1 < /k > < l > 2 </l >/< day > < m>< rep_node > 30 < / rep_node >< n > 4/< n > < / m > < / i > < / has >

Of course, the dynamic sql is the extra complication here; We use the immediate execution, so I 32767octets to play with in the query (10g * {:-(), so I need to use the amount the less extra characters to get this new logic inserted in the original code * sigh *.

Is it still possible? Is my intended address issues unique complications? Someone at - it smart ideas on how do the pivoting of the lines into a single line, and then update the xdata column at the same time somehow?

Thanks in advance! * fingers crossed *.

Hello

It's a scenario that I have already met several times.

A typical requirement was last updated from an input XML document, the compilation of data from the table with the new PK values of their respective orders. So, I had to deal with a mapping table.

Fortunately enough I was on 11.2 so much more useful features XML by hand on 10g to do the job, such as the update of XQuery or XMLPatch.

10.2.0.4, I think the following should work (only tested on 11.2), it generates a style sheet XSLT describing the change to be performed on the XML of entry and apply on the fly for each line:

SQL > with sample_data like)

2 Select 1 id1, id2 10, xdata xmltype ("12345") of all the double union

3 select 2 id1, id2 10, xdata xmltype ("1234") of the double

4  ),

5 extracted_data as)

6. Select sd.id1

7, appendchildxml)

8 xmltype ('http://www.w3.org/1999/XSL/Transform ">")

9

10

11

12

13

14    ')

15           , '/*'

16, xmlagg)

17 xmlelement ("xsl: template")

18, xmlattributes)

19'http://www.w3.org/1999/XSL/Transform"as" xmlns: xsl ""

20, ' rep_node / text () [. ='| to_char (x.rep_node_val) |'] ' as a 'match '.

21                 )

22, md.new_val

23               )

24             )

(25) stylesheet

sample_data sd 26

27, xmltable ('/ / rep_node' in passing sd.xdata)

RN 28 columns for ordinalite

29 number of rep_node_val road '.'

(30) x

31 join match_data on md.old_val = x.rep_node_val md

Group 32 by sd.id1

33)

34 select sd.id1

35, xmltransform (sd.xdata, ed.stylesheet) as new_xdata

36 of extracted_data ed

Join 37 sample_data sd on sd.id1 = ed.id1

38;

ID1 NEW_XDATA

---------- --------------------------------------------------------------------------------

1

1

2

30

4

50

2

1

2

30

4

This solution is very talkative, so he can't go well with your request size constraint.

If you can accept the creation of a function, I advise to use this instead:

create or replace function update_xml)

p_xmldata in xmltype

p_xpath in varchar2

)

return of xmltype

is

result of xmltype: = p_xmldata;

domdoc dbms_xmldom. DOMDocument;

DomNode dbms_xmldom. DOMNode;

NL dbms_xmldom. DOMNodeList;

o_val match_data.old_val%type;

n_val match_data.new_val%type;

Start

domdoc: = dbms_xmldom.newDOMDocument (result);

NL: = dbms_xslprocessor.selectNodes (dbms_xmldom.makeNode (domdoc), p_xpath);

for i from 0... dbms_xmldom.GetLength (NL) - 1 loop

DOMNode: = dbms_xmldom.item(nl, i);

o_val: = to_number (dbms_xmldom.getNodeValue (domnode));

Start

Select new_val

in n_val

of match_data

where old_val = o_val;

dbms_xmldom.setNodeValue (domnode, n_val);

exception

When no_data_found then

null;

end;

end loop;

dbms_xmldom.freeDocument (domdoc);

return the result;

end;

/

then:

SQL > with sample_data like)

2 Select 1 id1, id2 10, xdata xmltype ("12345") of all the double union

3 select 2 id1, id2 10, xdata xmltype ("1234") of the double

4)

5. Select id1

update_xml 6 (xdata, '//rep_node/text ()') as new_xdata

sample_data 7;

ID1 NEW_XDATA

---------- --------------------------------------------------------------------------------

1

1

2

30

4

50

2

1

2

30

4

Tags: Database

Similar Questions

  • Topic ID as shown in MS Word

    I am current using Robohelp for word v8.2 and recently, when editing in Word, I find that the topic identifier is displayed immediately to the right of any JUMPS I have inserted.  For example look at the text below, this is what I see when editing:

    ConvertITP can be particularly useful if you require complicated conversion work Conversion_Job is in fact on a regular basis.

    Note the "BOLD" Conversion_Job element. It is the topic that will jump.  I do not wish to see and would rather come back seeing that, when editing:

    ConvertITP can be particularly useful if you require complicated conversion work is in fact on a regular basis.

    It is easier to edit and read the document when it is displayed in this mode.  I can always edit the properties of the hot element if I want to see the associated topic.

    Any help is really appreciated.

    I suspect that you have your Word settings set to show hidden text.

    See www.grainge.org for creating tips and RoboHelp

    Follow me @petergrainge

  • When I try to open the pages or numbers on my iMac I get "new version required.

    When I try to open the pages or numbers on my iMac so that I get "new version required" open documents saved I must login to iCloud and open from there. Why? These same documents are readily available on my iPad. I bought both programs and all updates are current. Not very happy with this complicated route I take to work on a document

    Any suggestions

    < re-titled by host >

    You attempted to open a document v5 of Pages via the file picker Pages ' 09. Exit Pages ' 09 and then double-click on the same document to open it in Pages v5. You will not have this problem on iOS, because iOS Pages or Pages for iCloud open the two versions of the documents.

  • security breach critical firefox? does not require master password

    I put with a master password in firefox. When I start the computer and firefox, it opens the browser to the way I saved him when I stopped. This includes the sites that require passwords. They all open with no password request. Then randomly at a time later asked me the master password. Shouldn't it ask the password first, before opening protected sites?

    It's a little complicated.

    If you allow sites to set persistent cookies to keep you logged between sessions, Firefox never needs to use your password saved; you are already on each visit to both Firefox keeps the cookie (weeks, months or years depending on what the site specified).

    Alternatively, if you limit the sites to the definition of session cookies, after you close Firefox, these cookies are normally deleted. But there is an exception for the windows and tabs you left pending.

    When you restore a previous session, Firefox reverts this session cookies, including those you kept connected sites. Secure sites (HTTPS) are treated differently depending on when you restore your session:

    • When Firefox is set to start automatically with windows and tabs: secure session cookies are maintained and restored. Your registered username is unnecessary and not used.
    • When Firefox is set to start at the top with a home page, and you have the ability to restore your previous session manually: secure session cookies are ignored. You will need to identify yourself again.

    So, if (1) allow you sites to set persistent cookies, or (2) have set to restore your previous session of Firefox, and you do not close the session, it would be normal that no logon is required when revisiting the secured sites.

    To make sure that this does not happen, you have a few different options:

    (1) use only session cookies AND change some hidden settings to ensure that they are not saved when your session is restored; or

    (2) delete all cookies at the stop.

    I can list for those steps if you are interested.

  • Error 1074395241: The model descriptor does not contain the data required for the corresponding rotation invariant.

    Hi all

    I use the model Match 4 IMAQ to detect the angle of rotation of an image of model. However, it displays the error: "error 1074395241: the model descriptor does not contain the data required for the corresponding rotation invariant." What exactly is the problem? How to solve this problem? The details are explained below.

    My project is a bit complicated. Part of the block diagram containing the IMAQ Match model 4 is illustrated below:

    The source image is a series of images of images read from an AVI video (I used a loop for to process the images frame by frame). The image of the model is an area of the first selected image. So, this means, the user selected the ineterst object in the first frame of the video, and each of the following images to find the object corresponding interest & determine its rotation angle. When I run the above diagram, there no error. However, it shows the angle of rotation zero no matter what it is 'really '. Therefore, I changed the schema by adding parameters, listed below:

    But in this case, when I run it, it shows the error I mentioned in the subject line.

    If you need more information about my project to identify the problem, please let me know.

    Thanks in advance.

    S ' Please example from model that comes with labview First
    Go to labview Help > find examples and you can search for example.
    -You create model with angle range and what kind of special criteria you want to use.
    -To do this you must use IMAQ learn pattern before using IMAQ model Match 4
    Reference:http://zone.ni.com/reference/en-XX/help/370281U-01/imaqvision/imaq_match_pattern_4/

  • Internet connection required: Server error: 0x800CCC90, error number: 0x800CCC92

    Original title:

    Windows Mail in Vista

    Can anyone help please.  I tried to open my email this morning - as usual - and it asks me to enter my username and password.  I did it several times but it won't let me and I get as part of the error message: -.

    Internet connection required: Server error: 0x800CCC90, error number: 0x800CCC92

    I have been in contact with the technicians at Microsoft, but apparently they are more supported Windows Mail.  I can access my mail through my e-mail provider, but it's really annoying!

    Internet connection required:

    This has not preceded by a long and complicated URL that begins with https://accounts... ? The idea is that you must click on the link to log in and verify that it is access you your account by filling out a CAPTCHA. Is that what you did? That's happened?

  • JUMP requirements?

    XP natively supports it LEAP without Cisco aironet cards, or cards required Cisco?

    -John

    Well, you will indeed need a certificate on your AAA servers. I know that Cisco ACS servers can generate a self-signed certificate if you don't want to buy one from Verisign, or implement your own certification authority; I presume that MS IAS can do the same thing but have not tried.

    Other certificates, it's not that complicated: make sure that your AAA server will manage PEAP; Make sure that your APs or WLCs are set up to 802. 1 X; Make sure that your clients are configured correctly for enterprise WPA(/2) and PEAP. Disable the automatic use of the Windows login if necessary.

  • Minimum hardware requirements for ESXi 5

    Hello

    I am a newbie of virtualization and ESXi so please help me on these issues:

    I intend to host 1 Windows 2008 Server and 1 Pfsense on the same host with ESXi. The two servers to serve a small number of users (less than 10). The Win2k8 runs just small .NET application and the just Pfsense will act as a router/gateway for web portal (without VPN, nothing complicated here).

    I checked the minimum requirements for VMWare ESXi here (KB VMware: minimum system requirements for installing ESX/ESXi) but still uncertain before buying new equipment to run ESXi because the specifications said ESXi only works on 64-bit x 86 CPU.

    I'm looking at this PC:

    CPU: Processor Intel® Celeron® 1037U (2 MB Cache, 1.80 GHz)

    RAM: 8G RAM Support memory DDR3 2 G / 4G / 8G / 16G, DDR3 1333 / 1600 MHz

    Storage: 64G SSD


    ESXi will install OK on this system?


    Thank you

    Hello

    Intel http://ark.intel.com/products/71995/Intel-Celeron-Processor-1037U-2M-Cache-1_80-GHz CPU specs this should work in general, but can cause performance problems as this Celeron has only 2 hearts.

    Another thing to consider is the RAM, ESXi 5.5 OS takes about 4 GB of RAM on the 8 GB leaving you 4 GB for VMs Windows 2008 with less than 4 GB wil be quite slow and sooner or later begin to swap to disk.

    Also the motherboard used is something check with HCL as at the storage controller and connect it on Board should be compatible.

    The road easier to go is to get the material at the level of the server that is listed in the HCL, you can find systems awarded new/used being fully compatible. It would be much more reliable than the construction of a whitebox on office equipment system.

    cykVM

  • disable the password requirement

    Hi experts

    I'm trying to disable the password stupidly complicated on my host esx 5.5 requirement. It's that I need a password of 16 characters, some lowercase, uppercase, numbers and special characters to meet the requirement of ridiculus.

    I tried several and none of this seems to work:

    I tried to change the pam.d/passwd for the requist field contains-1 for each of ' Nxs definissez_ them on disabled and tried to add the apply = none.

    ex:

    # Vi /etc/pam.d/passwd ESX

    required password /lib/security/$ISA/pam_passwdqc.so Retry = 3 min = 8, 8, 8, 7, 6 apply = none

    or

    required password /lib/security/$ISA/pam_passwdqc.so Retry = 3 min=-1,-1,-1,-1,-1


    or


    required password /lib/security/$ISA/pam_passwdqc.so Retry = 3 min = disabled, disabled, disabled, disabled, disabled




    But so far no luck. Creating a user of simple test with a test password still does not work because of the password.

    I even tried restarting the host and still nothing.

    Anyone know what I'm missing?

    The 1,1,1,1,1 will set the requirement at 1 letter, so its not disable per say, but its just reducing it.

  • What are the free ESXi / 5.1 vsphere Hypervisor hardware required / restrictions?

    Situation: I'm going to update a few web servers where I am currently under the free version of ESXi/vSphere 4.0.  When 5.0 was released, I decided to not look at new versions of VMware because of the restriction of vRAM and either run an earlier version or something.  I came across a post that says 5.1 license was different and stopped by the page 5.1 and read this http://www.vmware.com/products/datacenter-virtualization/vsphere-hypervisor/requirements.html who actually reads differently.

    Questions: am I correct in my understanding of the restrictions for 5.1 are:

    1. 32 GB max RAM PHYSICS?  (It's a big change from 32GB vRAM).

    2. no limit on the number of CPUs or cores?  (This is a big change of physical processor 1 up to 6 cores max.)

    Thank you!

    PS: If the only real limitation is now 32 GB RAM virtual, VMware made a good shot.  I'm not the skin to VMware, so I think that physical 32 GB is perfect.  There is still only so much you can do in the 32 GB, but there is not the complexities of licensing.  The restriction of vRAM was impassable.  Server purchase is unnecessarily complicated by restrictions of socket and core.  This means that I could buy a standard speed core 8 or 10 cheaper XEON or use an older multiprocessor machine instead of an expensive high-frequency 6 core with hyperthreading.

    1. 32 GB max RAM PHYSICS?  (It's a big change from 32GB vRAM).

    Yes that's right FREE esxi supports maximum 32 GB physical RAM can only

    2. no limit on the number of CPUs or cores?  (This is a big change of physical processor 1 up to 6 cores max.)

    No Yes No limit on physical CPU or cores

  • Link to a pdf file that requires a connection

    I am trying to find a way to create a link to a pdf file that requires login/password, but it masks so that the user is not aware that they connected using the credentials.

    Basically, I'm trying to provide links to the Monroney labels, which are only available through a network of dealers login. If I give the link specifically to this pdf, you should not allow access to the dealer network but only this pdf. At least in theory, it's where my head is.

    Any suggestions?

    Thank you!

    Sounds very complicated.  I don't see how you can have two meanings.  In other words, how do you access a network password protected without giving access to the network?  You can not.

    I think you would need to put the PDF on your own server and place this file in a password - protected folder, assuming you want to log-in to get it.

    Nancy O.

  • Creation of additional entry fields as required

    Good day;

    Asked me to design a form using Livecycle that will replace an existing form of MS Word. The form will be used to grant access to a total of 42 information systems.

    At first glance, this seems not be a problem until I told him to design the presentation. Most of the time, the shape is more or less simple. Where I came across problems of design was the best way to ensure that the user inserts what systems they asked for. A user could ask anywhere between 1-42 of information systems.

    The initial design had all 42 systems contains a required feature. This, (I thought) was medium to long.

    Example: These fields are inside a table.

    System Name                     | Asked for the view | Domain requested

    AAAAA - AAAAAAAA | Select 1 or 5. Select 1 or 3

    What I would do, is this part of the form to create a "as needed." How I see this working is to have a drop-down list for the first system and can then ask the user requests another entry (using a button etc.), a blank line would come down to the top and a drop that they would be able to choose the name of the system and then be able to select the display of the request and the requested domain. I hope that I've explained this well enough

    Anyone know if this is possible?

    Thanks

    Chomp

    Here's a sample for you to what I think you want. Note that if you select the system in a DDList then there are many things to check... I missed a few of them in the code, so it can get a little complicated.

    Paul

  • Mail (version 9.3) frequently freezes, requires a reboot.

    Mail under El Capitan (10.11.6) freezes frequently. Rebuild my Inbox, sent messages, Junk, etc was not rectified the problem. Seems arbitrary? Anyone else having this problem? All possible solutions to this?

    Make a backup, preferably 2 on 2 separate drives.

    Exit the Mail.

    Go to Finder and select your user folder. With this Finder window as the windshield, select Finder/display/display options for presenting or order - J.  When the display options opens, check "show the library folder. This should make your visible user library folder in your user folder. Go to Library/Containers/com.apple.mail.  Move the folder com.apple.mail on your desktop. You must move the entire folder, not just the content.

    Reboot, re-launch Mail and test. If the problem is resolved, recreate the required e-mail settings and import emails you want to save to the folder on the desktop. You can then put the file in the trash. If the problem persists, return the folder where you have guessed replacing one that is there.

    If he does not repeat the above using Containers/com.apple.MailServiceAgent.

    Information derived from Linc Davis. Thanks to leonie for certain information contained in this.

    Mail crashing

    Accidents / unexpected

  • Assistance required after you download Sierra - locked in a spiral of failure of the Installation

    Hello - I am a student of the University who made the mistake of thinking I had to upgrade my OS system after seeing some updates new flashy in the Sierra. Long story short, that my computer is locked into a cycle where I restarts and the installation process will begin installation but end abruptly and ask me to reboot again.

    I have exams and papers due and seriously want access to my data again. I don't have a back up of my files. As such, I am looking for a method that will allow me access to my files that I need to be able to read notes, print etc.

    Details: I have an old MBPro by the end of 2011. He was on as the primary OS x Lion. I had updated some time later. More recently, I got El Capitan and it worked very well. I downloaded Sierra in the background as I did work at home and after installing it, it asked me to reboot. This was the point that I was able to come back from. Reboot after installation scenario is as follows:

    -A progress bar comes up saying 34 minutes until completion

    -The progress bar goes to 33 minutes until completion

    -Beginning of fans of my computer acting upward and the bar stops and crashes of progression

    -The installation process says he doesn't have and asks me to restart my computer

    Specifically, I get the message 'Mac OS could not be installed on your computer. File system check or repair a failure. Quit the installer to restart your computer and try again. »

    When I quit the installer of the OS, I am taken to the startup disk option and asked to choose a system to reboot my computer with. I see 'Macintosh HD macOS 10.11.4' but when I click on it and try to restart I get the following error message, "you cannot change the disk on the disk selected. Startup disk could not gather enough information on the selected disk. »

    Things I've tried:

    Internet recovery mode: I went here to do a restore of the Mac OS x comes with my computer (Lion). This attempt fails and the computer tells me I can't downgrade because a more recent OSX is already on my computer...

    Recovery mode: I tried to come back just El Capitan from here. When I try to do the process will take literally one second before I get a notification saying: "an error occurred during the preparation of the installation. Try to rerun this application".

    Disk utility: I tried to do first aid and repair on this menu on the big disk image (since some of them pop up... I'm sure that the big one is my computer and the small setup of Sierra is?). I see that I 115Gigs franco 319Gigs departure. When I click on check and repair, the process takes some time and seems as he goes to halfway through before I get errors in the two. Repair error wonder backup my data.

    -some specific stuff; the journal for the repair of first aid says something like: the Macintosh HD volume could not be completely checked. File system check exit code is 8. Update support partition for the volume as required. File system check or repair a failure. Operation failed... »

    Safe mode: I can't start in safe mode. My computer will load the apple logo, progress on 3/4ths of the way start-up and then crash on its own and not restart.

    Things I have tried:

    Constituting a new boot USB of OS Sierra - I read that in so doing I can substitute the installation process that is going on right now on my computer and start a new... I hope one that works. I was not able to do this again, because I need someone to another macbook to make it and none of my friends won't let me touch their computers after the fiasco that happened on mine... Can I get some feedback on this?

    Backup: I don't have an external hard drive... I'm willing to buy one if necessary, but I don't know how to make a backup in a world where I don't have access to the major functional sections of my computer. Also, if my computer is * session here now, I'm worried that a backup will be essentially a * a backup... is this the work of the computer?

    Other thoughts:

    -my computer was working fine before I tried the upgrade... no complaints on my end, it was a real trooper

    -Maybe the download was corrupted?

    -I learned today that the operating system installation process requires internet connection - maybe that my internet connection is bad?

    -on that note, I want to say I tried a lot of different things. Been in different parts of the campus (different parts of my dorm building, IT support across campus, etc.). My University has also 3 options of WIFI, but each requires a separate verification process. Throughout this process, I have been connected to one of these methods. Switching may help? But, if I can't do the verification step (i.e. open a browser and type in the details of my student specific to actually use the web), I do not think that this will help you a lot. In addition, I am sure that I am already using one of the less frequently used options.

    I want to avoid a permanent possible deletion because there are important things on my computer.

    Any advice? Enjoy it!

    Same problem here on my Mac Mini end of 2012. I couldn't find any fix so far. The machine worked perfectly fine before with El Capitan and had about 50 GB of available disk space. I have use any version beta of Sierra, but officially released one that came yesterday. Really disappointing to see the new system operating software with fundamental questions and no good way to solve it.

    Any help really appreciated.

  • How can I uninstall Sierra &amp; return to El Capitan without an external hard drive or equivalent required by the instructions online?

    How can I uninstall Sierra & return to El Capitan without an external hard drive or equivalent required by the instructions online? I find too many misadventures and not happy.

    Hello

    Check out this useful tutorial: https://www.igeeksblog.com/how-to-downgrade-macos-sierra-to-mac-os-x-el-capitan/

Maybe you are looking for