j2911
asked on
myXML code help
Hi Experts,
How do I set this up to work with other tables?
Also can you point me to some kind of training module that might help me understand this code?
Original that works:
with myXML as (
select TEST_ELEM_COMPR_FLD_DIFF_I D, TEST_ELEM_COMPR_RSULT_ID,
xmltype(TEST_ELEM_DIFF_REL ATED_FLD_N M)
xmlcol from test_element_compr_field_d iff
where isvalid(TEST_ELEM_DIFF_REL ATED_FLD_N M) = 1)
select TEST_ELEM_COMPR_FLD_DIFF_I D, TEST_ELEM_COMPR_RSULT_ID,
extractvalue(xmlcol,'//con tent-descr iption/VAL 2') "content-description"
from myXML
where extractvalue(xmlcol,'//con tent-descr iption/VAL 2')='FURNI TURE'
Tried this and it doesn't work:
with myXML as (
select diff.TEST_ELEM_COMPR_FLD_D IFF_ID, diff.TEST_ELEM_COMPR_RSULT _ID, tecr.TEST_ELEM_COMPR_RSULT _ID,
xmltype(TEST_ELEM_DIFF_REL ATED_FLD_N M)
xmlcol from test_element_compr_field_d iff diff, test_element_compare_resul t tecr
where isvalid(TEST_ELEM_DIFF_REL ATED_FLD_N M) = 1) and tecr.TEST_ELEM_COMPR_RSULT _ID =
select diff.TEST_ELEM_COMPR_FLD_D IFF_ID, diff.TEST_ELEM_COMPR_RSULT _ID, tecr.TEST_ELEM_COMPR_RSULT _ID, diff.TEST_ELEM_COMPR_RSULT _ID
extractvalue(xmlcol,'//con tent-descr iption/VAL 2') "content-description"
from myXML
where extractvalue(xmlcol,'//con tent-descr iption/VAL 2')='FURNI TURE'
Thank you.
How do I set this up to work with other tables?
Also can you point me to some kind of training module that might help me understand this code?
Original that works:
with myXML as (
select TEST_ELEM_COMPR_FLD_DIFF_I
xmltype(TEST_ELEM_DIFF_REL
xmlcol from test_element_compr_field_d
where isvalid(TEST_ELEM_DIFF_REL
select TEST_ELEM_COMPR_FLD_DIFF_I
extractvalue(xmlcol,'//con
from myXML
where extractvalue(xmlcol,'//con
Tried this and it doesn't work:
with myXML as (
select diff.TEST_ELEM_COMPR_FLD_D
xmltype(TEST_ELEM_DIFF_REL
xmlcol from test_element_compr_field_d
where isvalid(TEST_ELEM_DIFF_REL
select diff.TEST_ELEM_COMPR_FLD_D
extractvalue(xmlcol,'//con
from myXML
where extractvalue(xmlcol,'//con
Thank you.
ASKER
I'm trying to join 2 tables using this xmltype code. I have several other tables I need to join as well so I am trying to start with 2 tables at first to get the idea of what is needed.
Correction (but I'm still not getting this to work):
with myXML as (
select diff.TEST_ELEM_COMPR_FLD_D IFF_ID, diff.TEST_ELEM_COMPR_RSULT _ID, tecr.TEST_ELEM_COMPR_RSULT _ID,
xmltype(TEST_ELEM_DIFF_REL ATED_FLD_N M)
xmlcol from test_element_compr_field_d iff diff, test_element_compare_resul t tecr
where isvalid(TEST_ELEM_DIFF_REL ATED_FLD_N M) = 1) and tecr.TEST_ELEM_COMPR_RSULT _ID = diff.TEST_ELEM_COMPR_RSULT _ID
select diff.TEST_ELEM_COMPR_FLD_D IFF_ID, diff.TEST_ELEM_COMPR_RSULT _ID, tecr.TEST_ELEM_COMPR_RSULT _ID, diff.TEST_ELEM_COMPR_RSULT _ID,
extractvalue(xmlcol,'//con tent-descr iption/VAL 2') "content-description"
from myXML
where extractvalue(xmlcol,'//con tent-descr iption/VAL 2')='FURNI TURE
Correction (but I'm still not getting this to work):
with myXML as (
select diff.TEST_ELEM_COMPR_FLD_D
xmltype(TEST_ELEM_DIFF_REL
xmlcol from test_element_compr_field_d
where isvalid(TEST_ELEM_DIFF_REL
select diff.TEST_ELEM_COMPR_FLD_D
extractvalue(xmlcol,'//con
from myXML
where extractvalue(xmlcol,'//con
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
WITH myxml
AS (SELECT diff.test_elem_compr_fld_d iff_id,
diff.test_elem_compr_rsult _id,
tecr.test_elem_compr_rsult _id,
xmltype(test_elem_diff_rel ated_fld_n m) xmlcol
FROM test_element_compr_field_d iff diff, test_element_compare_resul t tecr
WHERE isvalid(test_elem_diff_rel ated_fld_n m) = 1
AND tecr.test_elem_compr_rsult _id = diff.test_elem_compr_rsult _id)
SELECT test_elem_compr_fld_diff_i d,
test_elem_compr_rsult_id,
EXTRACTVALUE(xmlcol, '//content-description/VAL 2') "content-description"
FROM myxml
WHERE EXTRACTVALUE(xmlcol, '//content-description/VAL 2') = 'FURNITURE'
When I run this it says:
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 11 Column: 29
AS (SELECT diff.test_elem_compr_fld_d
diff.test_elem_compr_rsult
tecr.test_elem_compr_rsult
xmltype(test_elem_diff_rel
FROM test_element_compr_field_d
WHERE isvalid(test_elem_diff_rel
AND tecr.test_elem_compr_rsult
SELECT test_elem_compr_fld_diff_i
test_elem_compr_rsult_id,
EXTRACTVALUE(xmlcol, '//content-description/VAL
FROM myxml
WHERE EXTRACTVALUE(xmlcol, '//content-description/VAL
When I run this it says:
ORA-00923: FROM keyword not found where expected
00923. 00000 - "FROM keyword not found where expected"
*Cause:
*Action:
Error at Line: 11 Column: 29
ASKER
This worked but I am still trying to figure out how to combine the query I currently have with myxml query. I have a start though - thank you.
WITH myxml
AS (SELECT diff.test_elem_compr_fld_d iff_id,
diff.test_elem_compr_rsult _id,
tecr.test_elem_compr_rsult _id,
xmltype(test_elem_diff_rel ated_fld_n m) xmlcol
FROM test_element_compr_field_d iff diff, test_element_compare_resul t tecr
WHERE isvalid(test_elem_diff_rel ated_fld_n m) = 1
AND tecr.test_elem_compr_rsult _id = diff.test_elem_compr_rsult _id)
SELECT tecr.test_elem_compr_rsult _id, test_elem_compr_fld_diff_i d,
EXTRACTVALUE(xmlcol, '//content-description/VAL 2') "content-description"
FROM myxml, test_element_compare_resul t tecr
WHERE EXTRACTVALUE(xmlcol, '//content-description/VAL 2') = 'FURNITURE'
WITH myxml
AS (SELECT diff.test_elem_compr_fld_d
diff.test_elem_compr_rsult
tecr.test_elem_compr_rsult
xmltype(test_elem_diff_rel
FROM test_element_compr_field_d
WHERE isvalid(test_elem_diff_rel
AND tecr.test_elem_compr_rsult
SELECT tecr.test_elem_compr_rsult
EXTRACTVALUE(xmlcol, '//content-description/VAL
FROM myxml, test_element_compare_resul
WHERE EXTRACTVALUE(xmlcol, '//content-description/VAL
what is this clause supposed to be?
and tecr.TEST_ELEM_COMPR_RSULT
also I think you're missing a comma before
EXTRACTVALUE (xmlcol,'//content-descrip