XMLTABLE : Convert XML into Rows and Columns using SQL

XMLTABLE : Convert XML into Rows and Columns using SQL

ORACLE-BASE.com

8 лет назад

57,013 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@TheOldMaritimer
@TheOldMaritimer - 27.09.2023 23:16

Hi Tim,

Could you do a video on how to ingest a regularly delivered XML file (with several nested children and data) to an Oracle table?

Thanks so much!

Ответить
@VictorKonishchev
@VictorKonishchev - 29.04.2023 21:18

That was awesome. Thank you.

Ответить
@raaghavirajendran1515
@raaghavirajendran1515 - 21.09.2022 13:21

Hi Tim,
Could you please explain how do we fetch asymmetric elements in xml into rows and columns. For example, in my xml, I have 4 employee data in the xml. They have temporary and permanent address. Employee 4 doesn't have have address details. Instead displaying employee 4 address as null, employee 4 record is completely removed from the table. Could you please explain how to handle this

Ответить
@michaelcieslik
@michaelcieslik - 14.06.2021 11:03

This is a very simple XML example with attributes only on the leaves of the xml tree. But how do you use xmltable, if xml elements reside on each level of the xml hierarchy?

Ответить
@romashery5291
@romashery5291 - 14.08.2020 08:11

good but very high level. more details would be helpful.

Ответить
@kavirajnegi
@kavirajnegi - 21.07.2020 22:45

Is there any way to directly parse and query the xml document without adding it into the table?

Ответить
@followMahi
@followMahi - 16.08.2019 04:19

Does similar can be achieved from JSON to rows in Oracle?

Ответить
@atiqmehrin148
@atiqmehrin148 - 13.09.2018 09:54

Hello dear,

I have created below queries; everything works fine except the select query that need your support please...


create table whh_test_1

(
test_id number(10),
xml_txt blob
);

the data is inserted from external drives as below and works fine;

declare
l_bfile bfile;
l_blob blob;
BEGIN

INSERT INTO whh_test_1(test_id) VALUES(1);
COMMIT;
update whh_test_1 set xml_txt=empty_blob() where test_id=1 RETURN xml_txt into l_blob;
l_bfile:=bfilename('DIR_XML','emp.xml');
dbms_lob.open(l_bfile,dbms_lob.file_readonly);
dbms_lob.loadfromfile(l_blob,l_bfile,dbms_lob.getlength(l_bfile));
dbms_lob.close(l_bfile);
commit;
END;

but below select query gives error:

SELECT xt.*
FROM whh_test_1 x,
XMLTABLE('/employees/emp'
PASSING x.xml_txt
COLUMNS
empno VARCHAR2(4) PATH 'empno',
ename VARCHAR2(10) PATH 'ename',
job VARCHAR2(19) PATH 'job',
mgr VARCHAR2(19) PATH 'mgr',
hire_date VARCHAR2(11) PATH 'hire_date',
sal VARCHAR2(11) PATH 'sal',
comm VARCHAR2(11) PATH 'comm'
) xt;

Thanks in Advance

Ответить
@saleemafzali9884
@saleemafzali9884 - 02.07.2018 09:48

Everything works fine except below query could you please give feedback. Thanks :-)
select xt.* from xml_tab x,
xmltable('/employees/employee'
passing x.xml_data
columns
"EMPNO" VARCHAR2(4) PATH 'EMPNO',
"ENAME" VARCHAR2(16) PATH 'ENMAE',
"JOB" VARCHAR2(16) PATH 'JOB',
"HIREDATE" VARCHAR2(16) PATH 'HIREDATE'
) xt;

Ответить
@bbujjin3899
@bbujjin3899 - 08.03.2018 19:14

Hi sir I need to process XML tag values and xpath dynamically how do we do this pls tel me

Ответить
@shiningstar8823
@shiningstar8823 - 15.02.2017 23:54

Thanks Tim for the clear explanation, good to see the CUI screen!

Ответить
@siddhartharao8490
@siddhartharao8490 - 05.08.2016 23:34

Am getting an error as "identifier 'SYS.DBMS_XQUERYINT' must be declared" ?

Ответить
@ZaidAlig
@ZaidAlig - 26.06.2016 01:48

Nice video....thanks....just one concern, do we have any alternate than @ being used in SQL...in some applications @ is defined as different symbol

Ответить
@jeeves251
@jeeves251 - 13.04.2016 15:54

Good video - thanks. How can you use XMLTABLE when the data you need looks like xml, but it's inside a CDATA section?

Ответить
@KentGraziano
@KentGraziano - 06.04.2016 00:24

Nice cameo from Kris Rice in the trailer.

Ответить
@KentGraziano
@KentGraziano - 06.04.2016 00:24

Nice cameo from Kris Rice in the trailer.

Ответить