Help in what concerns the generation of XML using SQL/XML
I wrote the following SQL to generate a XML report. Tb_ken_lg_mstr of the table is the primary table of the workforce. Tb_ken_loans_base and tb_ken_cards_base tables are tables containing the cards and loans to sales by sales in tb_ken_lg_mstr people.The problems that I face, is that:
1. even when there are sales people have not made a sale, that is, they have no documents tb_ken_cards_base and tb_ken_loans_base, yet their records are appearing the XML. I want to avoid this and only dirty people who have the list sales. A workaround is to use NOT EXISTS in the outer query more with tb_ken_lg_mstr. Is there a better way?
2 can anyone confirm that the approach used to combine the tables tb_ken_cards_base and tb_ken_loans_base is correct or not. Basically, I want to publish a report of sales person (tb_ken_lg_mstr) and all its sales (tb_ken_cards_base and tb_ken_loans_base).
3. the XML output is coming in a single line rather than in a hierarchical format.
I use 10.2 g
WITH TB_KEN_LG_MSTR AS(
SELECT 97 SALES_CODE , 'Christine' NAMES, 'LOANS' SPECIALIZATION, '03-SEP-07' DATE_REPORTED, TO_DATE('30-JUN-2010') SYSTEM_DATE FROM DUAL UNION ALL
SELECT 112, 'Winn ', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 093, 'Lydh ', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 107, 'Nai ', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 065, 'Jat', 'LOANS', '03-SEP-07', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 980, 'Mreen ', 'LOANS', '27-AUG-07', TO_DATE('30-JUN-2010') FROM DUAL ),
TB_KEN_CARDS_BASE AS(
SELECT 97 SALES_CODE, 46766 REFERENCE_NUMBER, 'BC' PRODUCT_TYPE, 'DECLINE' CURRENT_STATUS, 'I' APPLICANT_IS, TO_DATE('30-JUN-2010') SYSTEM_DATE FROM DUAL UNION ALL
SELECT 97, 46374, 'BC', 'DECLINE', 'I', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 112, 46106, 'BC', 'DECLINE', 'I', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 112, 44263, 'BC', 'APPROVAL', 'I' , TO_DATE('30-JUN-2010')FROM DUAL UNION ALL
SELECT 112, 46269, 'BC', 'APPROVAL', 'I', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 093, 4618, 'BC', 'DECLINE', 'I', TO_DATE('30-JUN-2010') FROM DUAL) ,
TB_KEN_LOANS_BASE AS(
SELECT 093 SALES_CODE, 16 BRANCH_NUMBER, '18512' ACCOUNT_NUMBER, '8' ACCOUNT_TYPE, 'DECLINED' FINAL_DECISION, '2000000' LOAN_AMOUNT, '-1' TOP_UP_AMOUNT, TO_DATE('30-JUN-2010') SYSTEM_DATE FROM DUAL UNION ALL
SELECT 093, 3, '14719', '3', 'DECLINED', '100000', '172.65' , TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 107, 9, '11444', '7', 'AUTHORISED', '200000', '-1', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 107, 75, '1570', '8', 'AUTHORISED', '2000000', '1626670.3', TO_DATE('30-JUN-2010') FROM DUAL UNION ALL
SELECT 066, 40, '10229', '7', 'AUTHORISED', '288000', '228478.35', TO_DATE('30-JUN-2010') FROM DUAL)
select xmlelement("SALES_DATA",
xmlagg(
xmlelement("SALES_CODE",
xmlattributes(c.sales_code),
xmlforest(c.names,
c.specialization,
c.date_reported),
(select xmlagg(
xmlelement("CARD_DETAILS",
xmlattributes(a.reference_number),
xmlforest(a.product_type,
a.current_status,
a.applicant_is)
)
)
from tb_ken_cards_base a
where system_date=TO_DATE('30-JUN-2010')
and a.sales_code = c.sales_code),
(select xmlagg(
xmlelement("LOAN_DETAILS",
xmlattributes(b.branch_number, b.account_number),
xmlforest(b.account_type,
b.final_decision,
b.loan_amount,
b.top_up_amount)
)
)
from tb_ken_loans_base b
where system_date=TO_DATE('30-JUN-2010')
and b.sales_code = c.sales_code)
)
)
)
from tb_ken_lg_mstr c
where system_date=TO_DATE('30-JUN-2010');
Using NOT EXIST would be to do the scan of table twice. What I don't understand is why Oracle is picking up Sales_Codes missing in tb_ken_loans_base or tb_ken_cards_base, even if I do an inner join?
You do not have an inner join, you only access TB_KEN_LG_MSTR in the main query.
What you do in the SELECT part are scalar subqueries just on each of your tables of the child, who is unable to filter the main table in the first place.
NOT EXISTS is indeed a solution, or consider doing all of the joins in the FROM clause, as I suggested above, like this:
...
FROM TB_KEN_LG_MSTR c
LEFT OUTER JOIN tb_ken_cards_base a ON a.sales_code = c.sales_code
LEFT OUTER JOIN tb_ken_loans_base b ON b.sales_code = c.sales_code
WHERE a.sales_code IS NOT NULL
OR b.sales_code IS NOT NULL
...
But then the subgroups becomes more difficult with this approach.
Regarding the third question, how I format in Oracle? If not possible in Oracle then what other ways are?
10.2, you can use this trick to format the output:
SELECT xmlelement( ... ).extract('/*').getClobVal() FROM ...
Tags: Database
Similar Questions
-
What is the generation of the iPod later in 2015?
Hello
I just want to know what is the generation of the iPod later in 2015?, is that the iPod 5th or 6th generation?
Thanks and best regard,
Yuranan
For the iPod touch, sixth.
(137171)
-
Why omit Photoshop elements 14 for the selection of Color Variations in the color "adjust" knocked down? That was helpful. What do you suggest me to use in a place?
If you have a copy of PES 11 or earlier version, you could install it and use it for this.
You can apply here:
-
An error occurred while the suspension the 2012 Windows R2 VMS on ESX 5.1 update 1 and ESXi5.0 Udpate3. Can someone help me what is the reason for that and how to fix this?
This issue has been resolved with the article below
-
My Clickfree automatic backup drive I had for many years stopped working with my iMac, what is the best replacement to use with Time Machine.
I can't even reformat the drive to try to start over, then think its time I invested in a high today but don't know where start looking so any advise would be a great help.
Thank you guys
A lot of users on these forums recommend OWC (www.macsales.com) Mercury Elite Pro series JEP due to their durability, affordability and quality of construction. I have about 6 of them connected to my iMac and have never had a speaker to fail. When a hard drive fails, substitute is a 5-minute process to re - use the box. To help you get started, you can find the line to: https://eshop.macsales.com/shop/firewire/1394/USB/EliteAL/eSATA_FW800_FW400_USB
You can find them in various ways and with a variety of configurations of connection so you can find the one that best fits your needs.
Good luck!
-
I put a password for my computer with Windows Vista Home Premium and now I forgot the password and can not even enter the computer now. Is anyway to recover this password or what is the next step to use the computer again?
Hello WillieBouma1,
You can try this to http://www.wikihow.com/Reset-a-Windows-Vista-Password that will help you with your password (typed in) problem easily. Here is one link: http://www.youtube.com/results?search_query=trinity+rescue+kit&search_type=&aq=f for video detail to achieve this, if you have any problems. I used it a dozen times and it really works! Hope this helps you. Let us know anyway. Make it a great day!
"And in the end the love you take, is equal to The Love You Make" (The Beatles last song from their latest album, Abbey Road.)
-
What is the difference between NET USE and MOUNT? Why do they work differently?
What is the difference between NET USE and MOUNT? Why do they work differently?
Hello
Thanks for posting your query on the Microsoft Community.
According to the description, I understand that you have a query.
I suggest you re-post your query on The TechNet Forums because we have experts working on this type of questions and for you help the better.
Check out the link:
https://social.technet.Microsoft.com/forums/Windows/en-us/home?category=w7itpro
You may consult:
https://TechNet.Microsoft.com/en-us/library/bb490717.aspx?f=255&MSPPError=-2147217396
Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.
-
What is the best program to use for invitations and cards?
I'm looking to build my own invitations and other stuff like business cards... What is the best program to use for this? At work, I use InDesign for booklets of customer and brochures - but looking for a program that can do a bit more to my invitations.
Thank you!
Cold you use whichever you choose. Each has its advantages.
These links can help you to choose:
http://www.printwand.com/blog/when-to-use-Adobe-Illustrator-vs-Photoshop-VS-InDesign
http://www.ehow.com/about_5378077_photoshop-vs-Illustrator.html
-
What is the best way to use files recovery
I work in FM 11 and broke FM a few times. What is the best way to use the recovery files and save them as normal files? So should I filter a window of the Explorer to "recovery" so FM don't ask me if I want to use the older recovery files? Thanks for your help.
> What is a wash of the MIF?
- Save all the files of FM component .mif as MIF format.
Save the .book as. book.MIF in the MIF format. - Output FM.
Restart FM. - Open .mifs. Save as FM, replacing the old (FM probably saved files).
- Open the. book.MIF, re - register under .book.
Note: do not open the. first book.MIF and then try to open the component files, or open the files binary pre - MIF.
FM11 and 12 can have a free add-on as much as the fact in a single operation.
Washing MIF creates new .book files and FM have syntactically correct data structures (and that may have lack of bad content). They are less likely to crash, but can still have problems.
- Save all the files of FM component .mif as MIF format.
-
What is the best program to use to create an interactive pdf?
What is the best program to use to create an interactive pdf?
You can't use InDesign, it's just an example of something that you could use. It would probably be better to use something that you already have experience with.
Once you convert the document to PDF, you can open it in Acrobat and have it automatically detect the form fields by selecting: forms > Start Wizard forms
It will attempt to identify where you intend to add form fields, but there is usually a good bit of customization to do later. The alternative is to manually add the form fields yourself by selecting: forms > add or edit fields
You can use the forms tools to add text fields, check boxes, buttons, etc. There is a lot of information in the doc help Acrobat on the creation and modification of form fields.
-
What is the best way to use the Y50-70 battery please?
I bought the laptop y50-70
but I want to know what is the best method to use the battery.
and the best way to recharge.
NOTE *.
IAM always use the cable and I gave the battery except a few times.
Thank you very much..
Best way to use the battery, if your laptop should ALWAYS be connected in-
Go to eat energy Lenovo - should be a RED icon in the system tray - and choose the mode for a better health of the battery (or battery Protection or health of battery optimized mode).
I don't know what the energy Manager version you have, but the option must seem similar. What it does is, it will keep your battery charged ONLY up to 60 percent and will increase its service life.
-
What is the best program to use to create an application?
I want to know what is the best tool to use to make an app for the app store. ? I was using Xcode, but it is a little difficult to use, can someone pls give me some advice. And you must be 18 years old to submit an application?
How skilled are you programming? It is IDE Xcode, you don't like or the languages it uses?
You can use the Terminal, but if you think that Xcode is hard you won't like, either. There are some alternative programming environments like Novell or Xojo, but those who are not free, and you will also need to learn the languages they use. Something like the open framework source PhoneGap is another option, if you use the Internet technologies would do what you want.
Whatever the used development environment, you will need to have the age of majority (18 years in the United States) in order to conclude the contracts necessary to present something to the App Store. Xcode 7 + will allow you to build and sideload your own mobile applications without needing to use the App Store, but now you are back to where you started.
-
What resistance the Thermocouple VI convert use for thermistor CYC?
What resistance the Thermocouple VI convert use for thermistor CYC?
No, I do not claim that. I was just trying to interpret what you said.
You indicated that you were using the Thermocouple convert VI. VI has a 'Sensor CSF' entry, and it can a value "Sensor IC" or "thermistor". So, I assumed you were talking about using this VI with "Sensor of CYC" = "thermistor". In this case the VI calls the convert thermistor reading VI to convert the voltage to temperature. It uses the default values for the resistance, and I guess that's what you were asking about. If you open the Panel before convert thermistor reading, you can see what resistance values it uses.
-
What is the best browser to use for a home user?
What is the best browser to use for a home user,
original title: browser
It's really a matter of personal preference. He has Firefox, Chrome, Safari and many more. They have differences, but as long as you have a decent security program, it is really important that you use. Try a few and see what you think. They are easy to install and easy to remove. Most will import your Favorites during the installation.
-
What is the best version to use when upgrading Microsoft XP on an emachines T3830 Dell?
Original title: upgrade of Microsoft XP on an emachines T3830 Dell
What is the best version to use when upgrading Microsoft XP on an emachines T3830 Dell? You said to go to Vista or Windows 7, I don't know which one to choose.
What is the best version to use when upgrading Microsoft XP on an emachines T3830 Dell? You said to go to Vista or Windows 7, I don't know which one to choose.
Hello
eMachines is owned by Acer, Dell No.
Here is the information IF you ever want to upgrade a computer to a later version.
But I can advise you that your eMachine is capable of running Windows 2000 and Windows XP.
http://www.eMachines.com/EC/en/us/content/drivers.html
Put your model number in the link above > then search under operating system, provided drivers
@@@@@@@@@@@@@@@@@@@@@@
Depends on hardware configuration required on later operating systems, and also find out if the manufacturer of the laptop computer is supported and provides drivers for operating systems later as to whether it is possible or feasible to upgrade or not.
There is no update free from XP to Vista, 7, 8.1, or 10.
Forget Vista as support extended for Vista SP2 will end April 2017.
Follow these steps before you buy Windows 7; Windows 7 SP1 to support extended to January 14, 2020.
Microsoft sells more than 7; Try Amazon.com.
Go to your computer / computer laptop manufacturer Web site and see if Windows 7 drivers are available for your make and model computer / laptop.
If this is not available, Windows 7 will not properly work for you.
Run the "Windows 7 Upgrade Advisor.
http://www.Microsoft.com/en-US/Download/details.aspx?ID=20
Check if your specifications are compatible for Windows 7:
"Windows 7 system requirements"
http://Windows.Microsoft.com/en-us/Windows7/products/system-requirements
"Windows 7 Compatibility Center" for software and hardware:
http://www.Microsoft.com/Windows/compatibility/Windows-7/en-us/default.aspx
Windows 7 upgrade paths:
http://TechNet.Microsoft.com/en-us/library/dd772579 (v = ws.10) .aspx
«Installation and reinstallation of Windows 7»
http://Windows.Microsoft.com/en-us/Windows7/installing-and-reinstalling-Windows-7
@@@@@@@@@@@@@@@@@@@@@@@@
Follow these steps before buying and upgrading (new installation) of Windows 8.1; extended support ends on January 10, 2023.
Check if the manufacturer of your computer/laptop has Windows 8.1 drivers available for your model.
If this is not available, Windows 8.1 not install and work properly for you.
There is a lot of information in this first link from Microsoft:
Download and run the Windows Upgrade Assistant 8.1 of to see if your machine is compatible Windows 8.1 and read the update for Windows 8.1: FAQ here
"Update to Windows 8.1: FAQ".
http://Windows.Microsoft.com/en-us/Windows-8/upgrade-to-Windows-8
"8.1 for Windows system requirements.
http://Windows.Microsoft.com/en-us/Windows-8/system-requirements
@@@@@@@@@@@@@@@@@@@@@@@
How to buy Windows 10; extended support ends 14 October 2025:
http://www.microsoftstore.com/store/msusa/en_US/cat/Windows/CategoryID.70036700
But first make sure that you have the correct configuration and your computer manufacturer provides the right drivers for 10.
https://www.Microsoft.com/en-us/Windows/Windows-10-specifications#sysreqs
" System requirements Windows 10"
https://www.Thurrott.com/Windows/Windows-10/3884/Windows-10-system-requirements
Microsoft deploys Windows 10 available as free upgrade to Windows 7 features, Windows and Windows Phone 8.1 8.1 qualified. It will be available from July 29, 2015
"FAQ Windows 10.
http://www.Microsoft.com/en-us/Windows/Windows-10-FAQ
See you soon.
Maybe you are looking for
-
FN key/flashcards/toucpad works not-Win7/Vista
Hello I installed Win7 and Vista to try to make my touchpad works. At this point, I have installed and reinstalled all the touchpad / drivers VAP on the two operating systems. I don't seem to get any results. Ago 0.5 seconds to a time where my touchp
-
Win vista svc pk 2 Update error 80070643, kb2691905
Tried to install the latest updates for Windows Vista Home Premium with svc pk 2, which included updating of security essential kb2691905 and it failed. MSG for error 80070643. Followed the instructions of Fixit, but cannot return to retry the update
-
Stop the "Recently changed" archive in your history folder
Do all the files that you use or access appear automatically in the folder "recently changed"? Can you stop the files to be indexed in this file? I also have files that I've trashed and yet they still appear in the recently changed folder. What can
-
Previous button doesn't work is not in dialog.ask
Hello If dialog.ask with 2-3 buttons is displayed on clickin device key return her without closing the dialog box, but dialog.alert is closed How to close the dialog box?
-
Format of physical drive using PERC 6 / i BIOS utility
I use a Dell R710 server that has raid PERC 6 controller / utility i of the BIOS. I want to use few old hard disks on this server. As they are old, I want to first format. Question: How can I format these physical hard drives using the BIOS RAID Util