"for XML path " Oracle equivalent of this SQL expression
SELECT TheID,
REPLACE(
RTRIM(
SELECT StudentID + ' '
FROM StudentinSchoolLocation TL
WHERE (LocationID = Results.LocationID)
FOR XML PATH ('')
) AS StudentIDs,
What is the equivalent of 'For XML path' used above
The goal is to get a concatenated list of the group by columns. Like where ever the location is same , get the studentIds and make a comma seperated list of all ids for common location
Works perfectly in SQL.
Thank you
Hi,
user6287828 wrote:
The goal is to get a concatenated list of the group by columns. Like where ever the location is same , get the studentIds and make a comma seperated list of all ids for common locationThat's called "String Aggregation"
[AskTom.oracle.com|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] shows several different ways to do it.
I recommend the first one, the user-defined function STRAGG, which you can copy from that page.
On Oracle 10 (and up) you may have a similar function, WM_CONCAT (owned by WMSYS), already installed.
WM_CONCAT is not documented, so you may not want to use it in your Production applications.
STRAGG is not so convenient if the order of items in the concatenated string is important.
In that case, use XMLAGG or SYS_CONNECT_BY_PATH, as shown later in the asktom page.
MODEL can also do ordered string aggregation.
Similar Messages
-
Looking for the oracle equivalent of T-SQL 'SELECT TOP n'
Hi,
I'm looking for the Oracle equivalent of T-SQL 'SELECT TOP n'
and can't find any. There is SAMPLE(n) function but it supposed
to pick up random values and I'm not sure if it's possible to
make it select top values. Please help 8-)
ThanxHi Marina.
Oracle does not have a functionality like SQL Server for TOP
selection. The ROWNUM option should be used with great care and
you may get unreliable results.
Try looking at Metalink
Doc ID: 291065.999
Doc ID: 267329.999
- They discuss this issue, and solutions. -
Biztalk WCF-SQL polling sample using a FOR XML Path
I've been searching in the web for a sample that uses FOR XML "PATH" to poll the SQL database . The result returned from my query is a parent child data and FOR XML PATH is the best choice to structure it in that way . I guess I'm missing something while
generating the schemas from this stored procedure.
I guess Dan Rosanova has touched on this concept (http://social.technet.microsoft.com/wiki/contents/articles/3480.aspx)
, but its using XML Auto. Again there is no sample available so makes things a bit difficult.
Can someone point to a sample walkthrough , generating the schemas and then later using it in the application.
Thanks
AnthstoneI used XMLPolling and it worked for me. you can go for XMLPolling. Steps to be followed:
1) Create the SP which will have the SELECT query similar to below:
;WITH XMLNAMESPACES (default 'http://yourcustomnamespace')
Select * from Employee FOR XML PATH('YourCustomRootNode')
2) Create a schema out of the table using the following query
Select * from Employee for
xml
auto,
xmlschema
3) Re-name the root name and namespace as per you mentioned in point#1 (YourCustomRootNode)
4) Create an Envelope Schema and refer the schema from point#3. Also make a note of the root node name and namespace that we need to specify
in the admin console.
5) Assign the Body XPath to debatch. Refer
this. Deploy the solution.
6) In the Admin console, add the Root Node Name and namespace mentioned in point#4 under "XmlStoredProcedureRoodNodeName" and "XmlStoredProcedureRoodNodeNamespace"
There you go. I did this for debatching. You can do for nomarl batch message instead of Envelope create a normal document schema.
Thanks
SKGuru -
Execute SQL Task - FOR XML PATH query error
I have the following query
SELECT pl.Id,
pl.StartTime,
pl.EndTime,
pl.PackageName,
pl.Computer,
pl.Operator,
CASE WHEN (CHARINDEX('stack trace', pl.ErrorDescription) > 0) Then
SUBSTRING(pl.ErrorDescription, 0, CHARINDEX('stack trace', pl.ErrorDescription))
ELSE
pl.ErrorDescription
END as ErrorDescription
ISNULL(ErrorFile,'') as ErrorFile,
'Not Applicable' as SourceSystem
FROM etl.PackageLog as pl
WHERE pl.Processed = 0
ORDER BY pl.StartTime, pl.PackageName
FOR XML PATH('Row'), ROOT(N'FieldingCounts')
in a Execute SQL Task and i get the following error:
[Execute SQL Task] Error: Executing the query "SELECT pl.Id,
pl.StartTime,
pl.EndTime,
pl.Package..." failed with the following error: "An invalid character was found in text content.
". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
The query execute without problem in database and in the ssis package doens't run because of the column
CASE WHEN (CHARINDEX('stack trace', pl.ErrorDescription) > 0) Then
SUBSTRING(pl.ErrorDescription, 0, CHARINDEX('stack trace', pl.ErrorDescription))
ELSE
pl.ErrorDescription
END as ErrorDescription
Any help to overcome the problem?
ThanksHi,
It looks like that you must be trying to set the result of the query to some variable from the Execute SQL Task. If yes, make sure that the target variable is of the correct data type where XML string can fit into. Considering that in SSIS, we have
some limit for XML strings.
Please let me know if it doesn't help.
Thanks,
Nimit -
Does oracle have similar functionality like MsSql "for xml path('')"
Does oracle have similar build in functionality like MsSql “for xml path(‘’)” , or in another word, it can enforce the result set(multiple rows) into ONE line such kind of presentation way.
Thanks in advance. Any help would be greatly appreciated.Here I would like specify my question mnore clearly,
CREATE TABLE t(
line NUMBER(3),
site VARCHAR2(4),
phase VARCHAR2(5),
test VARCHAR2(25));
INSERT INTO t VALUES (1, '0100', '*','1111111111111111111111111' );
INSERT INTO t VALUES (2, '0100', '=','2222222222222222222222222' );
INSERT INTO t VALUES (3, '0100', '=','3333333333333333333333333' );
INSERT INTO t VALUES (4, '0100', '*','4444444444444444444444444' );
INSERT INTO t VALUES (5, '0100', '=','5555555555555555555555555' );
INSERT INTO t VALUES (6, '0200', '*','6666666666666666666666666' );
Here I want to retrieve the 'line' column information in ONE line way
select line from t I want the result is like '1,2,3,4,5,6'
Any generous help would be greatly appreciated!!! -
Hi all,
I am learning XPATH and XQUERY from the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles, (published by apress). I copied the Code Listing 12-8 FOR XML PATH Using XPath Node Tests (listed below) and executed it in my
SQL Server 2012 Management Studio:
--Coles12_8.sql // saved in C:/Documemnts/SQL Server Management Studio
-- Coles Listing 12-8 FOR XML PATH Using XPATH Node Tests
-- Retrieving Name and E-mail Addresses with FOR XML PATH in AdvantureWorks
-- 16 March 2015 0935 AM
USE AdventureWorks;
GO
SELECT
p.NameStyle AS "processing-instruction(nameStyle)",
p.BusinessEntityID AS "Person/@ID",
p.ModifiedDate AS "comment()",
pp.PhoneNumber AS "test()",
FirstName AS "Person/Name/First",
MiddleName AS "Person/Name/Middle",
LastName AS "Person/Name/Last",
EmailAddress AS "Person/Email"
FROM Person.Person p
INNER JOIN Person.EmailAddress e
ON p.BusinessEntityID = e.BusinessEntityID
INNER JOIN Person.PersonPhone pp
ON p.BusinessEntityID = pp.BusinessEntityID
FOR XML PATH;
I got the following error message:
Msg 6850, Level 16, State 1, Line 2
Column name 'test()' contains an invalid XML identifier as required by FOR XML; '('(0x0028) is the first character at fault.
I have no ideas why I got this error message. Please kindly help and advise me how to resolve this error.
Thanks in advance, Scott ChangHi Michelle, Thanks for your nice response.
I corrected the mistake and executed the revised code. It worked nicely.
I just have one question to ask you about the appearance of the xml output of my Co;les12_8.sql:
<row>
<?nameStyle 0?>
<Person ID="1" />
<!--2003-02-08T00:00:00-->697-555-0142<Person><Name><First>Ken</First><Middle>J</Middle><Last>Sánchez</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="2" />
<!--2002-02-24T00:00:00-->819-555-0175<Person><Name><First>Terri</First><Middle>Lee</Middle><Last>Duffy</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="3" />
<!--2001-12-05T00:00:00-->212-555-0187<Person><Name><First>Roberto</First><Last>Tamburello</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="4" />
<!--2001-12-29T00:00:00-->612-555-0100<Person><Name><First>Rob</First><Last>Walters</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="5" />
<!--2002-01-30T00:00:00-->849-555-0139<Person><Name><First>Gail</First><Middle>A</Middle><Last>Erickson</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="6" />
<!--2002-02-17T00:00:00-->122-555-0189<Person><Name><First>Jossef</First><Middle>H</Middle><Last>Goldberg</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="7" />
<!--2003-03-05T00:00:00-->181-555-0156<Person><Name><First>Dylan</First><Middle>A</Middle><Last>Miller</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="8" />
<!--2003-01-23T00:00:00-->815-555-0138<Person><Name><First>Diane</First><Middle>L</Middle><Last>Margheim</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="9" />
<!--2003-02-10T00:00:00-->185-555-0186<Person><Name><First>Gigi</First><Middle>N</Middle><Last>Matthew</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="10" />
<!--2003-05-28T00:00:00-->330-555-2568<Person><Name><First>Michael</First><Last>Raheem</Last></Name><Email>[email protected]</Email></Person></row>
<row>
<?nameStyle 0?>
<Person ID="11" />
<!--2004-12-29T00:00:00-->719-555-0181<Person><Name><First>Ovidiu</First><Middle>V</Middle><Last>Cracium</Last></Name><Email>[email protected]</Email></Person></row>
<row>
I feel this xml output is not like the regular xml output. Do you know why it is diffrent from the regular xml xml output? Please comment on this matter.
Thanks,
Scott Chang
What do you mean by regular xml document? Are you referring to fact that its missing a root element? if yes it can be added as below
USE AdventureWorks;
GO
SELECT
p.NameStyle AS "processing-instruction(nameStyle)",
p.BusinessEntityID AS "Person/@ID",
p.ModifiedDate AS "comment()",
pp.PhoneNumber AS "text()",
FirstName AS "Person/Name/First",
MiddleName AS "Person/Name/Middle",
LastName AS "Person/Name/Last",
EmailAddress AS "Person/Email"
FROM Person.Person p
INNER JOIN Person.EmailAddress e
ON p.BusinessEntityID = e.BusinessEntityID
INNER JOIN Person.PersonPhone pp
ON p.BusinessEntityID = pp.BusinessEntityID
FOR XML PATH('ElementName'),ROOT('RootName');
replace ElementName and RootName with whatever name you need to set for element as well as the root element
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Use of variables in "FOR XML PATH"
Other than using dynamic sql (which we don't want to use) is there a way to use a variable in For XML Path, e.g.
select
FOR XML PATH (@BookName), ROOT('Book'), TYPE
TIA,
edm2In terms of general XML design this is poor. An element is normally a 'thing', and the attributes are normally the properties of that thing. Therefore in your case you would have a Book property with a 'name' attribute. It would be impossible
to create an XSD for your xml, and makes it awkward for readers of your xml - how do they know the book name beforehand? Creating this xml in the normal fashion would also make it easy to create without any messing around ( string manipulation,
other hacks ), eg
DECLARE @BookName NVARCHAR(20) = 'SomeBook'
SELECT
@BookName "@name"
-- Other book attributes
FOR XML PATH ('Book'), ROOT('Books'), TYPE
So now you have a Book item(s) within a Books collection. Easy! : ) -
I have found a script that contains the following:
stuff(
select
', ' +
fielda
from
tablea
for
xml path (''),
type).value
'nvarchar(max)')
,1,2,
anotherfield
This will concatenate field a and the stuff will remove the leading comma.
I have amended the script to the following and it still works:
Stuff(
select
', ' +
fielda
from
tablea
for
xml path (''))
,1,2,
Afield,
Please could somebody tell me why the following has been inserted after the
for xml path ('')
section
type).value
('.', 'nvarchar(max)')Erland - I just did a quick test. The differences weren't as bad as the subtree estimates would have indicated but they weren't exactly close either. The typed version (on average) took just over twice as long to execute.
Test conditions were as follows:
AdventureWorks2012 database
On average, the non-typed version executed in ~190 ms and the typed version executes in ~405 ms.
Test bed was the following:
@@VERSION =
Microsoft SQL Server 2012 - 11.0.2218.0 (X64)
Jun 12 2012 13:05:25
Copyright (c) Microsoft Corporation
Developer Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )
Hardware =
Processor: Core i7-4770K @ 3.50GHz (4 physical cores / 8 logical cores)
Ram: 16.0 GB @ 2400 MHz
HD: SSD
Here are the two test scripts that I used... (each run in it own SSMS tab)
-- Typed version --
DECLARE @BegDT DATETIME2(7) = SYSDATETIME()
SELECT
sod1.SalesOrderID,
STUFF((
SELECT ', ' + CAST(sod2.ProductID AS VARCHAR(8))
FROM Sales.SalesOrderDetail sod2
WHERE sod1.SalesOrderID = sod2.SalesOrderID
FOR XML PATH(''), TYPE).value('.', 'varchar(max)'), 1, 2, '') AS csv
FROM
Sales.SalesOrderDetail sod1
GROUP BY
sod1.SalesOrderID
SELECT DATEDIFF(ms, @BegDT, SYSDATETIME()) AS ExecTimeMS
-- Non-typed version --
DECLARE @BegDT DATETIME2(7) = SYSDATETIME()
SELECT
sod1.SalesOrderID,
STUFF((
SELECT ', ' + CAST(sod2.ProductID AS VARCHAR(8))
FROM Sales.SalesOrderDetail sod2
WHERE sod1.SalesOrderID = sod2.SalesOrderID
FOR XML PATH('')), 1, 2, '') AS csv
FROM
Sales.SalesOrderDetail sod1
GROUP BY
sod1.SalesOrderID
SELECT DATEDIFF(ms, @BegDT, SYSDATETIME()) AS ExecTimeMS
If you see holes in my test approach, please let me know.
Thanks,
Jason
Jason Long -
Generate xml using FOR XML PATH from table with hierarchy
I need to create xml from a table like:
EL1 EL2 EL3 Attr01 Attr02 Attr03 Attr04
E10, , ,a,b,c,d
E10,E1010, ,a,b,c,d
E10,E1010,E101010,a,b,c,d
E10,E1010,E101020,a,b,c,d
E10,E1010,E101030,a,b,c,d
E10,E1020, ,a,b,c,d
E10,E1020,E102010,a,b,c,d
E20, , ,a,b,c,d
E20,E2010, ,a,b,c,d
E20,E2010,E201010,a,b,c,d
E20,E2020, ,a,b,c,d
E20,E2020,E202010,a,b,c,d
E20,E2020,E202020,a,b,c,d
The hierarchy is EL1--EL2--EL3, and the 3 columns should be elements of xml;
The other for columns Attr01,Attr02,Attr03,Attr04 should be attributes of xml;
The actual table could have more than 500 rows(there are many values for El1,EL2,and EL3).
The expected xml should like:
<root>
<E10 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E1010 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E101010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
<E101020 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
<E101030 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E1010>
<E1020 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E102010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E1020>
</E10>
<E20 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E2010 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E201010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E2010>
<E2020 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
<E202010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
<E202020 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
</E2020>
</E20>
</root>
I create a sample Src table:
CREATE TABLE Src
EL1 VARCHAR(10),
EL2 VARCHAR(10),
EL3 VARCHAR(10),
Attr01 VARCHAR(10),
Attr02 VARCHAR(10),
Attr03 VARCHAR(10),
Attr04 VARCHAR(10)
GO
INSERT INTO Src
(EL1,EL2,EL3,Attr01,Attr02,Attr03,Attr04
SELECT 'E10','','','a','b','c','d'
UNION SELECT 'E10','E1010','','a','b','c','d'
UNION SELECT 'E10','E1010','E101010','a','b','c','d'
UNION SELECT 'E10','E1010','E101020','a','b','c','d'
UNION SELECT 'E10','E1010','E101030','a','b','c','d'
UNION SELECT 'E10','E1020','','a','b','c','d'
UNION SELECT 'E10','E1020','E102010','a','b','c','d'
UNION SELECT 'E20','','','a','b','c','d'
UNION SELECT 'E20','E2010','','a','b','c','d'
UNION SELECT 'E20','E2010','E201010','a','b','c','d'
UNION SELECT 'E20','E2020','','a','b','c','d'
UNION SELECT 'E20','E2020','E202010','a','b','c','d'
UNION SELECT 'E20','E2020','E202020','a','b','c','d'
GO
I tried to use FOR XML PATH to generate xml for the sample data. When the records increase to a few hundreds, it's not a good idea.
Here is my script:
SELECT
(SELECT Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E101010'
FOR XML PATH('E101010'),TYPE
) AS 'node()'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E101020'
FOR XML PATH('E101020'),TYPE
) AS 'node()'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E101030'
FOR XML PATH('E101030'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E1010' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E1010'),TYPE
) AS 'node()'--1010
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E102010'
FOR XML PATH('E102010'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E1020' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E1020'),TYPE
) AS 'node()'--1020
FROM Src
WHERE EL1 = 'E10' AND (EL2 ='' AND EL3 ='')
FOR XML PATH('E10'),TYPE) 'node()'
,(SELECT Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E201010'
FOR XML PATH('E201010'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E2010' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E2010'),TYPE
) AS 'node()'--2010
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E202010'
FOR XML PATH('E202010'),TYPE
) AS 'node()'
,( SELECT
Attr01 AS '@Attr01'
,Attr02 AS '@Attr02'
,Attr03 AS '@Attr03'
,Attr04 AS '@Attr04'
FROM Src
WHERE EL3 = 'E202020'
FOR XML PATH('E202020'),TYPE
) AS 'node()'
FROM Src
WHERE EL2 = 'E2020' AND (EL1 <>'' AND EL3 ='')
FOR XML PATH('E2020'),TYPE
FROM Src
WHERE EL1 = 'E20' AND (EL2 ='' AND EL3 ='')
FOR XML PATH('E20'),TYPE) AS 'node()'
FOR XML PATH(''),ROOT('root')
If I get a few hundreds of rows, how huge the script should be. Does anyone have better solution for this? Thanks.
TaowBob,
Thanks! And sorry for late feedback.
The XSD requires the xml structures like the following
<Schools>
<School01>Some school</School01>
<School02>Some other school</School02>
</Schools>
I have to use the number in the element name.
Right now I just use the nested FOR XML PATH, although I have to write thousand lines code.
Thanks anyway.
Tao
Tao -
Question on Support for XML in Oracle 9i and XDK 9.0.1
Hi All,
I just went through the Oracle 9i's features for XML. I have been working with Oracle's XDK too. I noticed that there are some new packages in Oracle 9i like SYS_XMLGEN and DBMS_XMLGEN that produce a XML file when presented a query to it. This feature is there in the XDK (XML SQL Utility) too. So, my question is as follows:
1. Are there any differences in the XML File produced by XDK and these database packages?
2. What are the scenerios when I should go for these packages and when should I go for the XSQL Utility.
Cos I found out that both are doing effectively the same things. Is there any difference between them? Please explain the second question.
Thanks in advance,
RajatThe sys_xmlagg and sys_xmlgen are native implementations of functionality tied into the database code line. They replicate some of the functionality that was previously provided in a 'plugin' form by the XDK. DBMS_XMLGEN is a PLSQL Package that also provides access to native implimentations of some of this functionalitu. You should find that as a result of being native implimentation they are much more performant.
SYS_XMLGEN and SYS_XMLAGG allow XML to be generated directly from a SQL Query. DBMS_XMLGEN is designed for use in procedural processing and provides a finer grain of control over the generated output.
There are still some features, such as DTD and Schema generation that are not (yet) available with the native implementation, and for this reason, and backwards compatability the XDK functionality is still available
As a rules of thumb, if you can use the native implimentations do so, as performance should be much better.
Mark D. Drake
Senior Product Manager,
XML Infrastructure,
Server Technology -
Import/Export-Tools for XML on Oracle-Lite
We have to import/export XML-Format on the Oracle-Lite-Database.
-Are there any tools available supporting Import and Export of XML-Data ?
-Can someone give us a recomendation how to perform XML-Imports/Exports if there is
no "out of the box-tool" available ?
Thanks.So try. It is called Oracle XML-SQL utility and it set of classes for direct XML manipulation from/to database with HUGE amount of features. You can use it from JAVA and PL/SQL (via Java Stored Procedures). It is realy great.
-
Looking for a better way to write this SQL
Oracle version 11R2
OS version (does not matter)
What I trying to do is write a query that finds Public Synonyms without a target object. I came up with this but I thinking there's a better way.
Select
s.owner, s.synonym_name, s.table_name, s.table_owner, s.db_link, InitCap(o.object_type) object_type
from
sys.DBA_SYNONYMS s, sys.DBA_OBJECTS o
where
s.synonym_name is not null
and
s.table_owner = o.owner (+)
and
s.table_name = o.object_name (+)
and
s.owner = 'PUBLIC'
and
object_type is null; object_type is null appears to be the weakness. It seems the check of the target object should be better.
Feedback, comments, queries welcome.I'm not sure exactly what "better" means in this context (faster, easier to read, etc.) but I'd tend to use a NOT EXISTS
SELECT s.*
FROM dba_synonyms s
WHERE owner = 'PUBLIC'
AND s.db_link IS NULL
AND NOT EXISTS (
SELECT 1
FROM dba_objects o
WHERE o.owner = s.table_owner
AND o.object_name = s.table_name )I added the DB_LINK criteria to filter out public synonyms that reference objects in remote databases which obviously don't exist in the local DBA_OBJECTS.
Justin -
Hello,
I have an issue while installing SQL Server 2008 R2 Express. When I was installing SQL Server, I occurred an error message as shown in the figure.
I have followed couple of links as in
this and
this links but it did not fix the issue. Can anyone help me on this issue?
Regards
GauravHi gauravroondhe2306,
According to your description, you fail to install SQL Server 2008 R2 express with the error that SQL Server Browser service group does not exist. Please help to post SQL Server setup error log for analysis. By default, SQL Server setup summary and detail
logs are located in C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log.
Based on my research, this issue could occur when you install SQL Server on a Domain Controller, or the machine's name has been changed and the browser service group is named with the original machine's name.
To troubleshoot the issue, you could follow the solutions below.
1.Use SQL Server 2008 R2 Best Practice Analyzer to detect if SQL Server is installed on a domain controller. If SQL Server is installed on a domain controller, please demote your machine from being a domain controller and install the SQL Server again since
it is not recommended to install SQL Server on a domain controller.
2.Check if the name of local user group matches the machine's current name. If it doesn't match, please change the name of the local user group accordingly, and install SQL Server again. For more information about the process, please refer to the article:
http://geekswithblogs.net/TedStatham/archive/2014/04/15/installation-problems-with-sql-server-2008-r2-express.aspx
Regards,
Michelle Li -
For XML - Oracle Equivalent:
Hey people,
I was wondering... SQL server has the 'for xml path' clause; does oracle have its equivalent?
I wasn't able to find any leads online. Thought the experts here'd know.
Thanks.
Edited by: user10175043 on May 23, 2011 11:06 AMSee this,
XML parent child records
G. -
Problems using Quick Migrate in SQL Developer 1.5 for MySQL to Oracle 10g
Hi all,
I am trying to use SQL Developer 1.5 migration tools (Quick Migrate) to perform online capture and build source model to migrate from MySQL 5.x to Oracle 10g on Windows platform. I get these errors and the Quick Migrate process fails:
oracle.dbtools.metadata.persistence.PersistableObject.doInsert(PersistableObject.java:238)
I did a search and used the sqldeveloper.cmd script but still fails. Then I created a new database and truncated the repository. I now get the above error plus two new ones listed below:
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
Error loading nls:OALL8 is in an inconsistent state
Error occurred during capture: Protocol violation
It fails during the capture process for MySQL 5.1 database
when it begins to capture the tables from MySQL.
Does anyone know how to resolve these issues when migrating from MySQL to Oracle 10g using Quick Migrate with SQL Developer 1.5 release?
Regards,
Ben Prusinski
Message was edited by:
benprusinski
Message was edited by:
benprusinskiHi all,
I put the following in my sqldeveloper.cmd file:
SET ORACLE_HOME=%CD%
What is very confusing is that with SQL Developer 1.5, there are several levels and several SQL Developer executables! I am really not sure which of these to use:
I created the SQLDeveloper 1.5 directory called SQLDeveloper1_5 on Windows:
1) cd C:\sqldeveloper1_5\sqldeveloper-5338
there exists a sqldeveloper.exe
2) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper.exe
3) cd c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloer\bin\sqldeveloper.exe
Which SQLDeveloper 1.5 executable should I be using and where should I place the
sqldeveloper.cmd file?
Also I did try to use a different database and schema for the repository with Quick Migrate but it appears a bug exists in SQL Developer 1.5 version that causes errors with Quick Migrate for MySQL to Oracle? Is this correct?
As an update, I ran the following commands:
cd to
c:\sqldeveloper1_5\sqldeveloper-5338\sqldeveloper\sqldeveloper\bin
sqldeveloper.cmd sqldeveloper.exe
Start sqldeveloper.exe
Perform standard capture for MySQL using the new mig2 schema as the new repository
It starts the capture but fails on the errors below:
Error loading nls:OALL8 is in an inconsistent state
UPDATE
============================
I tried this again and it worked with the exception of one error message listed below:
Here are the steps that I followed:
1. Create a Windows cmd script
Put the following entries in the script:
SET ORACLE_HOME=%CD%
save the command windows script as sqldeveloper.cmd
Copy this script to the base installation directory for SQLDeveloper
Example:
1. cd c:\SQLDeveloper1_5\sqldeveloper-5338\sqldeveloper
2. Start SQLDeveloper with the command script that you created earlier
Example:
Open a Windows shell prompt window and execute the following scripts:
a) sqldeveloper.cmd sqldeveloper.exe
b) sqldeveloper.exe
3) In SQL Developer 1.5
From the Migrate menu,
a) Delete current repository and create a new schema in Oracle target database call it mig2.
b) Then create a new repository in SQL Developer 1.5
c) Right mouse click on the MySQL 5.x database and choose capture
It worked with the exception of one error message:
o.jdbc.driver.OracleDriver
Error while registering Oracle JDBC Diagnosability MBean.
So it looks like something is screwed up with my JDBC drivers and configuration for MySQL. How do I diagnose the JDBC driver issue for MySQL?
Thanks!!!
Ben
Thanks
Ben
Maybe you are looking for
-
What is the diffrence between business Activity and task?
Hi plz explain business activity and task Madhavi
-
I want new pages to open in an existing tab rather than a new tab
We are setting up a public computer in our local tourism visitor center for people to check information on area lodging. We have created icons on the desktop for each establishment's web page, so when someone dbl clicks the icon, the web page comes u
-
Where to find a newsletter tool/app for a sharepoint online public site ?
where to find a newsletter tool/app for sharepoint online public site ? can anybody tell me where/how to find a newsletter tool/app in the sharepoint online solution for sharepoint public site ? Its for marketing, where visiter can add his/her mail f
-
Fail to install solaris 8 for intel
hello. i downloaded three files and made a CD for each one. but during the installing on a Dell PowerEdge 6450 (4 x Pentium III 550)which has two AIC 7899 ultra160/m SCSI adapters and a Dell PERC RAID controller (i note they are not included in the h
-
When are you going to allow users to set their own language to use. There are many complaints about the use of local languages I dont speak bloody arabic, I dont speak or read chinese!!!!!!!!!!!!!!!!!!! I want to have a switch in firefox that says ig