xmltype help


I have two sql statements that I need to combine but I am not sure how to do that.  One is an  xmltype statement.  I need to add the scn.test_id as the key field to the xml on the bottom.

test_set_e left  
test_sceen scn
scn.test_id = left.test_id
and diff.test_elem_compr_fld_nm = fn.field_name


with myXML as (
xmlcol from test_element_compr_field_diff
where isvalid(TEST_ELEM_DIFF_RELATED_FLD_NM) = 1)
extractvalue(xmlcol,'/system/deviceName') "DeviceName",
extractvalue(xmlcol,'/system/meterNumber/VAL1') "Meter No 1",
extractvalue(xmlcol,'/system/meterNumber/VAL2') "Meter No 2",
extractvalue(xmlcol,'/system/revenueUploadIndicatorCode') "Rev Upload",
extractvalue(xmlcol,'/system/sourceSystemName') "Source System",
extractvalue(xmlcol,'/system/sourceSystemServerName/VAL1') "Server Name 1",
extractvalue(xmlcol,'/system/sourceSystemServerName/VAL2') "Server Name 2",
extractvalue(xmlcol,'/system/softwareVersion/VAL1') "Software Ver 1",
extractvalue(xmlcol,'/system/softwareVersion/VAL2') "Software Ver 2",
extractvalue(xmlcol,'/system/transactionName') "Transaction"
from myXML
where extractvalue(xmlcol,'/system/deviceName') IS NOT NULL

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

can you post sample data and expected results?

are you asking to have the xml results modified with an extra child node? or an extra column or what?
j2911Author Commented:
I am looking a way to add the extra column "scn.test_id" field added to the xml query.
j2911Author Commented:
I'm not sure how to create a regular query with the xml query and pull in more data.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

what is the correlation  between them?

your xml comes from this table:  test_element_compr_field_diff

your test_id comes from these tables:  test_set_e & test_sceen

your first query references diff, but I don't see a clear connection.

please post sample data and expected results

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
j2911Author Commented:
Sorry for the delay.  I'm having problems gathering data today - we're having problems with the database.

The xml is coming off of a blob field in the field diff.test_elem_diff_related_fld_nm that you can see in the second part of the data.  

The following may be better to understand.

test_set_element left,
compare_result pair,
compr_field_diff diff,
test_sceen scn
pair.test_elem_compr_left_side_id = left.test_id
and scn.test_id = left.test_id
and diff.test_elem_compr_rsult_ID = pair.test_elem_compr_rsult_ID
and pair.run_id = cr.run_id
j2911Author Commented:
I'm going to close this up because I cannot gather the data for now.  We are in development and the database that I was using is undergoing major changes and I cannot provide you with what is needed.  Thank you for trying.
I appreciate the points but if I my posts weren't helpful and you're unable to pursue it further at this time then I recommend deleting the question.

My "trying" is sort of irrelevant.

If, I was helpful though, even if you can't implement things quite yet, then we can leave it as is.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.