Repeating nodes using FOR loop but when concating XML string then concating only last iteration of FOr loop ??
I stuck with a problem that I am using FOR loop for generating repeating nodes.
Now when I concat the generated node in the main node then I got only last iteration of that FOR loop.
can anybody suggest me a way to handle this error....
FOR i IN 1..pl_phone_tab.Count
LOOP
SELECT xmlelement("Phone"
,xmlelement("PHONETYPE",xmlattributes('01' AS "dmnADRP_PHONETYPE"),pl_phone_tab(i).p_phtype_tab)
,xmlelement("PHONENUM",pl_phone_tab(i).p_phnum_tab)
,xmlelement("PRIMARY_CONTACT",pl_phone_tab(i).p_prcon_tab)
INTO p_phone_xml
FROM dual; END LOOP;
SELECT xmlelement("PhoneInfo"
,xmlconcat(p_phone_xml))
INTO p_phone_info_xml
FROM dual;
here I am getting only one node but there has to be two nodes for PHONE node
Not that I'm encouraging you but here are two standalone examples explaining how to do what you want :
1) Loop through the input collection and append each node to its target container :
SQL> declare
2
3 type t_emp_tab is table of scott.emp%rowtype;
4
5 emp_tab t_emp_tab;
6 emp_info_xml xmltype;
7 emp_xml xmltype;
8
9 begin
10
11 -- filling emp_tab with data
12 select e.*
13 bulk collect into emp_tab
14 from scott.emp e
15 where e.deptno = 10;
16
17 emp_info_xml := xmltype('<EmpInfo/>');
18
19 -- looping through emp collection and appending to EmpInfo element
20 for i in 1 .. emp_tab.count loop
21 select appendchildxml(
22 emp_info_xml
23 , '/*'
24 , xmlelement("Emp"
25 , xmlattributes(emp_tab(i).empno as "id")
26 , xmlforest(
27 emp_tab(i).ename as "Name"
28 , emp_tab(i).job as "Job"
29 )
30 )
31 )
32 into emp_info_xml
33 from dual;
34 end loop;
35
36 dbms_output.put_line(emp_info_xml.getclobval(1,2));
37
38 end;
39 /
<EmpInfo>
<Emp id="7782">
<Name>CLARK</Name>
<Job>MANAGER</Job>
</Emp>
<Emp id="7839">
<Name>KING</Name>
<Job>PRESIDENT</Job>
</Emp>
<Emp id="7934">
<Name>MILLER</Name>
<Job>CLERK</Job>
</Emp>
</EmpInfo>
PL/SQL procedure successfully completed
2) Build a secondary collection of XML nodes and use XMLAgg to aggregate them in one go :
SQL> declare
2
3 type t_emp_tab is table of scott.emp%rowtype;
4
5 emp_tab t_emp_tab;
6 emp_info_xml xmltype;
7 emp_xml_tab xmlsequencetype := xmlsequencetype();
8
9 begin
10
11 -- filling emp_tab with data
12 select e.*
13 bulk collect into emp_tab
14 from scott.emp e
15 where e.deptno = 10;
16
17 -- looping through emp collection and appending to the collection of Emp nodes
18 for i in 1 .. emp_tab.count loop
19
20 emp_xml_tab.extend;
21
22 select xmlelement("Emp"
23 , xmlattributes(emp_tab(i).empno as "id")
24 , xmlforest(
25 emp_tab(i).ename as "Name"
26 , emp_tab(i).job as "Job"
27 )
28 )
29 into emp_xml_tab(i)
30 from dual;
31
32 end loop;
33
34 select xmlelement("EmpInfo", xmlagg(t.column_value))
35 into emp_info_xml
36 from table(emp_xml_tab) t ;
37
38 dbms_output.put_line(emp_info_xml.getclobval(1,2));
39
40 end;
41 /
<EmpInfo>
<Emp id="7782">
<Name>CLARK</Name>
<Job>MANAGER</Job>
</Emp>
<Emp id="7839">
<Name>KING</Name>
<Job>PRESIDENT</Job>
</Emp>
<Emp id="7934">
<Name>MILLER</Name>
<Job>CLERK</Job>
</Emp>
</EmpInfo>
PL/SQL procedure successfully completed
Both solutions give the same output.
Test them both and see which one fits better into your scenario.
Similar Messages
-
Do I have to buy Acrobat before I can get Adobe Reader? I have an ID and password for Adobe, but when I try to download Adobe Reader it asks me for a password I don't have.
vivianp45768349 wrote:
I don't have a system. It's my personal computer.
You do. Your system is either Windows or Mac (or maybe a couple of other less popular choices) and a version of one or the other.
When you set up your machine, you were asked for an administrator user name and password. You need both of these to install software. -
I am looking to upgrade to the entire CC suite from the Lightroom/Photoshop package. The packages page says the complete suite is available to existing customers for 29.99 monthly. But when I try to upgrade I only get one option for 599.99 yearly. Can I get clarification on the $29.99 offer and who it is available for. Thank you
Hi there
The 29.99 introductory offer is for existing CS customers ie customers with a CS3-CS6 product (suite or individual product).
Hope this clarifies matters.
Thanks
Bev -
Firefox 7 is forcing me to fill out a form field that isn't required. I've used FF on this site for years but when I upgraded to FF7 it no longer works. IE it works fine.
It's our internal applicant tracking systems (resume database). It works fine in IE and all previous verisons of FF but in FF 7 a bubble icon pops up stating that "Please fill out this field".
The field is not required but states "Require all of these words" if you to run a search based on those parameters. -
Just set up iTunes for windows but when I try to sync my iPhone to it this is what it says, I have another iTunes library on my power book. It than asks if I want to erase this iPhone and sync with this iTunes library. I used the same password on this windows pc system same log on etc..I don't have anything loaded on it. All I want is for the info that's on the power book in iTunes and my iPhone to snyc/update etc on the windows pc. How do I do this? My power book is dead to the world.
Read here.
https://discussions.apple.com/message/18565125#18565125 -
i cant use facetime. but my sister can. we share the same account for itunes.but when i go to facetime on my ipod touch and click on create a new account a blank screen pops up and the only thing it says is cancel and account. what do i do?
Please follow these directions to delete the Mail "sandbox" folder.
Back up all data.
Triple-click the line below to select it:
~/Library/Containers/com.apple.mail
Right-click or control-click the highlighted line and select
Services ▹ Reveal
from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
Quit and relaunch Mail, and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Post your results.
Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
*If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). In the Finder, select
Go ▹ Go to Folder...
from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return. -
I have an apple ID that I want to use it for icloud, but when I Set it, i got below message
I could requires an apple id that Is an email address ( [email protected] address )
Please help me
<Email Edited by Host>Your gmail address is still your apple id. Just when you activate your mail and notes, it asks you to create icloud e-mail, which is completely separate and allows you to have one more e-mail address. Just some extra benefit, you don't have to pay for, but useful to save your notes and send e-mail or two if Google server goes down.
-
Guys i have a problem, I used to download apps from one of my friends apple id, now i created my new account, but when i was about to update my apps its asks for my friends id and password. now how could i update my old apps from my new apple id?
The_Tonmoy wrote:
I have no communication with my that friend :/ So it means i need to delete those apps? There's no other solution to update those apps?
No. purchases are forever tied to the apple ID used to buy them. Delete them and buy your own copies. -
I just bought a Mac Book Pro and the Appstore show one upgrade of iPhoto (9.2.1). I started a section with my Apple ID (the account that I have I use to iTunes) but when I try to update it says that there are upgrades available for other accounts and that I have to upgrade using the account that I used to buy iPhoto. What do I have to do to upgrade iPhoto?
Dear Katty,
Thank you very much for your answer! I have 2 Apple ID, and I have tried both of them and the problem continues. I founf several peolpe with the same problem in apple communities foruns and that really seems that there is some problem. I addded the links for 2 of those discussions.
https://discussions.apple.com/thread/3374419?start=0&tstart=0
https://discussions.apple.com/message/16628399#16628399
Do you have an idea of how can I solve this problem?
Thank you very much again.
Best regards,
Alfonso -
i tried for update but when i saw the screen its showing an arrow with a USB cable towards itunes icon, and now i'm not able to do anything, i also tried to connect ipad through my laptop but no use
That message means that you have to restore the iPad now. There was a problem with the update. So connect the iPad to your computer and restore your iPad.
You can read bout it here.
http://support.apple.com/kb/ht1414
If that does not work you will need recovery mode. You can read about it here.
http://support.apple.com/kb/ht4097
Or you can follow these Recovery Mode Instructions
Disconnect the USB cable from the iPad, but leave the other end of the cable connected to your computer's USB port.
Turn off iPad: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for iPad to turn off.
If you cannot turn off iPad using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the iPad turns off, release the Sleep/Wake and Home buttons.
While pressing and holding the Home button, reconnect the USB cable to iPad. When you reconnect the USB cable, iPad should power on.
Continue holding the Home button until you see the "Connect to iTunes" screen. When this screen appears you can release the Home button.
If necessary, open iTunes. You should see the recovery mode alert that iTunes has detected an iPad in recovery mode.
Use iTunes to restore iPad. -
Is there any way to create a time machine backup to an external hard drive with content already on it? I have a hard drive that i have used for pictures but when i try to run a backup it says i need to start from a blank drive. Can i get around it?
It would be much better if you had separate drives for the pictures and Time Machine backups.....but, if you want to use the same drive for both purposes, temporarily move the folder with the pictures to another location for safe storage.
Run the Time Machine backup on the hard drive and verify that everything is working correctly. Time Machine will format the disk for you in Mac OS Extended (Journaled) as part of the backup process.
Then move the folder with the pictures back to the hard drive with the Time Machine backups.
When you have tested to make sure that everything is working again, then and only then should you delete the folder with pictures from the temporary storage area.
Again....it would be much better to keep Time Machine backups on a drive just for that purpose, and other data on another drive for that purpose. This is clearly one of those times when the fact that you can do something does not mean to imply that you should do it. -
I had my iphone s4 on seasonal standby. I am now using it again, but when i try to play music on itunes, there is no sound. Also no sound for youtube.
music and video has their own volume slider it's displayed in the player itself lowing the normal phone volume does not affect the media volume
-
i wan't update using itunes, i want to make update using my phone, but when check for an update using software update in setting message appear " can't check for update....."?
Reboot the device and see if the error happens again. Updating through iTunes is usually optimal, but the file size differs via Software Update on the device and iTunes (50MB vs ~800MB)
-
Automatically switches me to different apple store! I am using UAE store , but now it says I am using Singapore! But when I go to apple store and change it to UAE again , it charges 1 dhs and it work for the day. It behaves differently the next time ?
Where did you buy the iPad and register your iTunes account? What country is the credit card you used when you set up your iTunes account? Where are you now?
Cheers, Tom -
i bought a iphone froma friend just to use for a ipod but when i put it up to itunes it ask me for a sim card i dont have one and i was wonderiing how do i pass this problem
Insert a SIM card. If the phone is carrier locked, it must be from the correct carrier. You MUST have a SIM card present to activate the device. The SIM does NOT have to be "live". That is to say, the account it is/was tied to, does not have to be active.
Maybe you are looking for
-
Skillbuilders modal page plugin query
Hi Guys, I have downloaded the Skillbuilders modal page plugin and it works very well for 99% of the scenarios that we have encountered. We have one page which needs a slight modification from the standard functionality with regards the modal plug in
-
I want to create a good quality SD DVD from 1080i/60 footage (20 minutes duration) from a Sony ZiU camera (mini DV tape) using FCP and Compressor. I can't do it. My hair has fallen out, but I don't want to throw in the towel. I have imported the sam
-
Um, slight problem with 6.0.2...
... as in, it has rendered my iPhoto useless. I cannot edit any photos - I just get white screen, and full screen mode causes the program to hang indefinitely. The probelm occurs with all of my 4,000-odd photos. Old ones, not so old ones, and even ph
-
Can not getReadMethod a jdk 1.5 bug?
import junit.framework.TestCase; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; import org.apache.taglibs.standard.lang.jstl.BeanInfoManager; import org.apache.taglibs.standard.lang.jstl.
-
Hi, I had installed both oracle 8i and 11g, I'm trying to import my dmp file in oracle 8i, but that query will shift to 11g environment. How can i import my dmp file in 8i. eg: host imp sys/sys@ora file='D:\Ven_Excercise\hlw_demo\koow.dmp' ignore=y f