Availability of the SQL/XML functions (XMLELEMENT, etc.) in Oracle 10g XE
Hi,
I have installed Oracle 10g XE on a Windows PC. According to the Oracle XML DB Developer's Guide p.2-1, the installation of the Oracle XML DB can be checked via the following commands:
select * from all_users;
describe resource_view
I ran both commands and got the desired output according to the Developer's guide, i.e.: The user XDB exists and so does the view resource_view. However, when I ran a small test with the XMLELEMENT function, then I got unsatisfactory results:
Example:
SELECT
XMLELEMENT (
NAME Land,
XMLATTRIBUTES (L.LCode AS LCode),
XMLELEMENT (NAME LName, L.LName)
) AS Mondial
FROM Land L;
Output on Oracle 10g XE:
MONDIAL
SYS.XMLTYPE
SYS.XMLTYPE
SYS.XMLTYPE
SYS.XMLTYPE
Expected output (which I got from a successful run on an Oracle 10g EE Server):
MONDIAL
<LAND LCODE="A "><LNAME>Austria</LNAME></LAND>
<LAND LCODE="F "><LNAME>France</LNAME></LAND>
<LAND LCODE="D "><LNAME>Germany</LNAME></LAND>
<LAND LCODE="I "><LNAME>Italy</LNAME></LAND>
i.e., rather than the four XML elements, I just got four times the output sys.xmltype - which is of course useless. What can I do to get the desired output? Thank you for your help.
Reini, user524179
What program are you using to run the sql? Are you sure you are using sql*plus for getting this?
Output on Oracle 10g XE:
MONDIAL
SYS.XMLTYPE
SYS.XMLTYPE
SYS.XMLTYPE
SYS.XMLTYPE
Similar Messages
-
Using SQL/XML Functions or XSU to generate structured XML file.
Hi,
I have a view on a relational database I need to generate an XMLfile based on that view. I need to have below structure
<Employees>
<Employee A>
<Employee info>
</Employee info>
< Contact info>
<Address>
</Address>
</Contact info>
</Employee>
<Employee B>
<Employee info>
</Employee info>
< Contact info>
<Address>
</Address>
</Contact info>
</Employee>
</Employees>
Also in the next step I need to read from XML file and transfer data to the Database.
For this situation which way is the best one to generate XML file, using SQL/XML functions (XMLELEMENT, XMLAGG,... ) or using XSU?
and which one is the best to extract data from XML file to Oracle database?
Oracle DB version: 9.2.0.8.0
SQL*Plus version: 10.2.0.1.0
Thanks,
ShivaI would do it from the database, but then again, I am a database / PL/SQL guy.
IMHO the database will deliver you with more options. I don't know about "speed" between the two. -
Creating optional elements using SQL / XML functions
Hi,
I am struggling with some SQL / XML functionality in order to create some optional elements in a XMLType.
I have one table with data to be generated into an XML document. The table looks like this (only the attributes related to the problem are shown):
msg_id (pk)
geslacht_hoofdverzekerde
geboortedatum_hoofdverzekerde
geslacht_medeverzekerde
geboortedatum_medeverzekerde
I have to create an XML document that looks like this:
<ber:rekenparameters>
<ber:verzekerde>
<ber:codeRelatierol>HVZ</ber:codeRelatierol>
<ber:geslacht>M</ber:geslacht>
<ber:datumGeboorte>01-01-1960</ber:datumGeboorte>
</ber:verzekerde>
<ber:verzekerde>
<ber:codeRelatierol>MVZ</ber:codeRelatierol>
<ber:geslacht>V</ber:geslacht>
<ber:datumGeboorte>01-01-1961</ber:datumGeboorte>
</ber:verzekerde>
</ber:rekenparameters>
Where <ber:codeRelatierol> is hard coded: i.c. of hoofverzekerde 'HVZ' in case of medeverzekerde 'MVZ'.
Geslacht en datumGeboorte are taken form the table.
The element <ber:verzekerde> is obligatiry for hoofdverzekerde but optional for medeverzekerde: only in case geslacht_medeverzekerde and geboortedatum_medeverzekerde are not null this 2nd <ber:verzekerde> element has to be added.
I created the next SQL (I skipped some stuff in order to focus on the problem):
CREATE OR REPLACE
VIEW dps_v_berekening_berichten
AS
SELECT msg_id as msg_id
, XMLElement( "ber:berekening"
, XMLAttributes( 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
, 'http://www.mycompany.nl/berekenen' AS "xmlns:ber"
, 'http://www.mycompany.nl/berekenen http://www.mycompany.nl/berekenen/berekening.xsd' AS "xsi:schemaLocation"
, XMLElement( "ber:nummerRekenRegel"
, XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
, 1
, XMLElement( "ber:rekenparameters"
, XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
, XMLElement( "ber:codeEvolutie" ) -- Empty
, XMLElement( "ber:verzekerde"
, XMLForest ( 'HVZ' AS "ber:codeRelatierol"
, xoa.geslacht_hoofdverzekerde AS "ber:geslacht"
, xoa.geboortedatum_hoofdverzekerde AS "ber:datumGeboorte"
, XMLElement( "ber:verzekerde"
, XMLForest ( 'MVZ' AS "ber:codeRelatierol"
, xoa.geslacht_medeverzekerde AS "ber:geslacht"
, xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
-- Some more elements.
) AS bericht
FROM DST_UP1_XML_OUTDATA xoa
The problem is that the XMLForest always creates an <ber:verzekerde> element for medeverzekerde. I tried to create an inline view with just the "vezekerde"attributes and conditionally joining this inline view with the dst_up1_xml_outdata table. That didn't solve my problem. Because in case of a medeverzekerde available it returned two XML documenst: one that included the hoofdverzekerde and one that included the medeverzekerde. And obviously that's not what I want.
I imagine I have to juggle with some of these SQL / XML functions although I cannot put the finger on the exact differences between some of these (XMLElement, XMLForest, XMLAgg, XMLSequence). The examples shown in de XML DB Developer's Guide don't seem to adress my problem.
Help !Hi, are you talking about this part that you don't want to be there? I am not so clear about your requirements.
XMLElement( "ber:verzekerde"
, XMLForest ( 'MVZ' AS "ber:codeRelatierol"
, xoa.geslacht_medeverzekerde AS "ber:geslacht"
, xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
If you want to control certain subelements so they don't appear, do not use xmlforest. Use xmlelement instead so it is easier to control it using case when. Mark (of Oracle, he should be here soon since OOW is over) showed me this technique and it helps tremendously, because oftentimes XDB will return an empty tag even though your consumers don't like it!
try something like this,
(case when xoa.geboortedatum_medeverzekerde = 'MVZ' then
xmlelement("ber:verzekerde",
xmlelement("What you want", colname),
xmlelement("ber:codeRelatierol", 'MVZ'),
(case when colname is not null or = some other value then
xmlelement("Rest", colname))
end)
end),
You may have to twig some details there. But the key is to use the case when construct to get rid of unwanted elements or empty elements. So you should only have the elements if you have a value of 'MVZ'. Hope this helps.
Ben -
What is the maximum number of characters in an Oracle 10G Instance Name
All,
Can I know what is the maximum number of characters in an oracle 10g instance name under AIX? Is it 7 characters or 8 characters?
regards
SanthoshOne should really make the difference between db_name and instance_name: if instance_name default value is db_name it can be different
(even on a non RAC database).
For example with Oracle 10.2.0.4 you can create a database named DB78 with instance_name=DB12345678:
$ uname -a
Linux lx01.localdomain 2.6.18-92.el5 #1 SMP Fri May 23 22:17:30 EDT 2008 i686 i686 i386 GNU/Linux
$ ps -fu oracle | grep smon
oracle 6353 1 0 20:30 ? 00:00:01 ora_smon_DB12345678
oracle 6412 5596 0 20:37 pts/1 00:00:00 grep smon
$ export ORACLE_SID=DB12345678
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Sep 8 20:34:26 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> show parameter name
NAME TYPE VALUE
db_file_name_convert string
db_name string DB78
db_unique_name string DB78
global_names boolean FALSE
instance_name string DB12345678
lock_name_space string
log_file_name_convert string
service_names string DB78I would not recommend this practice: but it's interesting to know to avoid confusing between db_name and instance_name. -
How to integrate from MS SQL SERVER 2005 and Flatfile to Oracle 10g.
Hi
I am new to ODI. I am trying to load sample data from MS SQL Server 2005 and Flatfile to Oracle 10g.
1. I have created three models.
1-1. SQL2005 (SRC_CUSTOMER table)
1-2. Flatfile (SRC_AGE_GROUP.txt & SRC_SALES_PERSON.txt)
1-3. Oracle 10g (TRG_CUSTOMER table)
You may know I got those environments from the ODI DEMO environment.
2. I could able to reverse the tables also.
3. I have created an interface which contains source table (from MSSQL 2005), Flatfile and target table from ORACLE model.
4. I have imported the knowledge modules. But I am confusing in selecting the knowledge modules to source and target tables.
I've selected LKM File to SQL for flatfile model.
I've also selected LKM SQL to SQL for MSSQL 2005 model and IKM Oracle Incremental Update for the target table (ORACLE).
I've also implemented the interface that I created. It worked without errors. But there is no data in target table which is TRG_CUSTOMER.
I really would like to know what happened and what the problems are.
You can email me [email protected]
Thanks in advance
Jason Leewhat did give for SRC_AGE_GROUP SRC_CUSTOMER join condition
if it is
(SRC_CUSTOMER.AGE=SRC_AGE_GROUP.AGE_MIN) AND SRC_CUSTOMER.AGE=SRC_AGE_GROUP.AGE_MAX
give it as
(SRC_CUSTOMER.AGE>SRC_AGE_GROUP.AGE_MIN) AND SRC_CUSTOMER.AGE<SRC_AGE_GROUP.AGE_MAX -
How to check/find the size of current ROLLBACK segment in oracle 10g
How to check/find the size of current ROLLBACK segment in oracle 10g ? Kindly help
A rollback segment name like "_SYSSMU231$" is used when you have Automatic Undo Management enabled.
The only relevant parameters are :
1. UNDO_MANAGEMENT=AUTO
2. UNDO_RETENTION=n minutes ==> this is what everyone should be interested in
3. The sizes of the Undo Tablespace datafiles and whether AUTOEXTEND is ON or OFF
No one should be interested in the size of a single undo segment when Automatic Undo Management is enabled.
Possible causes of ORA-01555 errors in Automatic Undo Management
a. UNDO_RETENTION is too low
b. Undo tablespace is too small
Hemant K Chitale -
See the detalis of DDL commands executing on oracle 10g
Hi,
how can i see the detail of DDL command executed on oracle 10g on ECC 6.0
ECC 6.0
HPUX
Regards,Did you activated the auditing mechanish on the Oracle? If it is active, you can query the audit table;
select * from sys.aud$;
Another way is using Oracle Log Miner. You can find the related information, on the link below;
http://docs.oracle.com/cd/B10501_01/server.920/a96521/logminer.htm
Best regards,
Orkun Gedik -
Running SQL Server Function and Procedures from Oracle
I am trying to run SQL Server 2005 functions and/or procedures from a SQL statement in Oracle. I have gone throught the hetergeneous services and have connected to the SQL Server database successfully. I can also do a query to a table in SQL Server successfully; but I have not been able to execute a procedure or a function.
Have you tried Oracle syntax? It seems to me that you have only tried T-SQL syntax, e.g. execute proc.
Wrap it in a begin..end tag like you would a normal PL/SQL function or proc call. Assumption is that as Oracle makes the remote database (via the dblink) look like an Oracle database, you should also play along and pretend it is one and treat it as such.
E.g.declare
r integer;
begin
-- execute remote proc
procFoo@dblink( 'ABC' );
-- call a remote function
r := funcFoo@dblink( 123 );
end; -
Function not executing in oracle 10g
Hi ALL,
I have a problem executing below Function in oracle 10g.
Pls do help me solve the prblm it wud be a great help.
Thanks in advance.
Here is a below function and the error i am getting:
create or replace FUNCTION UnpackArray
Source IN VARCHAR2 DEFAULT NULL,
Delimiter IN CHAR DEFAULT ','
RETURN reSourceArray0 PIPELINED
IS
SourceArray00 SourceArray0:=SourceArray0(NULL);
TYPE REFCURSOR IS REF CURSOR;
CURSOR0 REFCURSOR;
DelLen int;
Pos int;
Cnt int;
str int;
LEN int;
Holder VARCHAR2(220);
BEGIN
--Check for NULL
IF Source is null or Delimiter is null THEN
Return;
END IF;
--Check for at leat one entry
IF RTRIM(LTRIM(Source)) = '' THEN
Return;
END IF;
/*Get the length of the delimeter*/
SELECT LENGTH(RTRIM(Delimiter)) INTO DelLen FROM DUAL;
SELECT INSTR(UPPER(Source), UPPER(Delimiter)) INTO Pos FROM DUAL;
--Only one entry was found
IF Pos = 0 THEN
BEGIN
INSERT INTO UnpackArray_TBL
( Data )
VALUES ( Source );
return;
OPEN CURSOR0 FOR SELECT * FROM UnpackArray_TBL;
END;
END IF;
/*More than one entry was found - loop to get all of them*/
SELECT 1 INTO str FROM DUAL;
<< LABEL4 >>
WHILE Pos > 0
LOOP
BEGIN
/*Set current entry*/
SELECT Pos - str INTO len FROM DUAL;
SELECT SUBSTR(Source, str, len) INTO Holder FROM DUAL;
/* Update array and counter*/
/* Update array and counter*/
INSERT INTO UnpackArray_TBL
VALUES ( Holder );
/*Set the new strting position*/
SELECT Pos + DelLen INTO str FROM DUAL;
SELECT INSTR(UPPER(Source), UPPER(Delimiter), str) INTO Pos FROM DUAL;
OPEN CURSOR0 FOR SELECT * FROM UnpackArray_TBL;
END;
END LOOP;
/*Set last entry*/
SELECT SUBSTR(Source, str, length(RTRIM(Source))) INTO Holder FROM DUAL;
-- Update array and counter if necessary
IF length(RTRIM(Holder)) > 0 THEN
INSERT INTO UnpackArray_TBL
VALUES ( Holder );
OPEN CURSOR0 FOR SELECT * FROM UnpackArray_TBL;
END IF;
--Return the number of entries found
Return; LOOP
FETCH CURSOR0 INTO
SourceArray00.Data;
EXIT WHEN CURSOR0%NOTFOUND;
PIPE ROW(SourceArray00);
END LOOP;
CLOSE CURSOR0;
RETURN;
END;
Error is : Compilation failed,line 6 (12:13:25)
PLS-00201: identifier 'RESOURCEARRAY0' must be declared
Compilation failed,line 0 (12:13:25)
PL/SQL: Compilation unit analysis terminateduser11917384 wrote:
Error is : Compilation failed,line 6 (12:13:25)
PLS-00201: identifier 'RESOURCEARRAY0' must be declared
Compilation failed,line 0 (12:13:25)
PL/SQL: Compilation unit analysis terminatedHave you created a sql user defined type with name RESOURCEARRAY0...??
Ravi Kumar -
XML parser error occured in oracle 10g
Hi,
XML parser failed while we are using the XMLTYPE.TRANSFORM in oracle 10g product version is 10.2.0.3.0
I am getting the fallowing error message
XML-24521: (Error) Element not completed: 'PurchaseOrder' Parser Exception: Element not completed: 'PurchaseOrder'
but it's working in oracle 9i,both XSD and XSL files are valid only and it's returns the XML data with only one line,the data is truncated in 10g but not in 9i
In oracle 9i it's returns whole XML data
is there any idea why the XML parser error in oracle 10g versionYou would be better asking XML questions over in the XML DB
-
SQL Tuning using Enterprise manager in oracle 10g
Hi,
In oracle 10g you have the enterprise manager which can be used to tune sql statements using the SQL Tuning ADvisor and SQL access advisor.
I believe in oracle 10g the process of SQL Tuning is slightly easier using the Enterprise Manager ...so if some one could explain me that process...
Again thanking you in advance
regds
Manoj GokhaleHi Manoj,
Didn't you already start two other threads about this same question the SQL forum?
How do i do the SQL Statement tuning
Enterprise Manager - sql tuning advisor , Access advisor for SQL Tuning -
How to find the db accounts using default passwords in oracle 10g
Hi, can someone pleas tell me , how to find the oracle accounts in the database which are using default passwords. DB verion is 10g and 9i.
in 11g version we can query the view DBA_USERS_WITH_DEFPWD to view the users....
any idea in 10g and 9i ?
thanks in advance.951658 wrote:
Hi, can someone pleas tell me , how to find the oracle accounts in the database which are using default passwords. DB verion is 10g and 9i.
in 11g version we can query the view DBA_USERS_WITH_DEFPWD to view the users....
any idea in 10g and 9i ?
thanks in advance.the only way I've found is to search the web for lists of default users and their passwords, then attempt to log on with said credentials. I'd start with Pete Finnigan's site (google is your friend). He may already have some scripts ready to go, or at least the lists you'd need to get started. -
Are there SQL/XML functions for XML-to-SQLtable direction?
When I look on the descriptions and samples shown here:
http://www.oracle.com/technology/oramag/oracle/03-may/o33xml.html
I can see only one direction: SQLrecords->XML
Are there functions for the opposite direction as well?
Read: I send XML docs to Oracle DB and they are (atomatically) INSERTED into existing relational tables ?
If yes: Where are these function described/samples shown?
Thank you
PeterPlease read the FAQ
-
The Date/Time option for header set-up shows both date and time. I only want to show the date
Not related to your question, but you are running an extremely old and out of date version of Firefox that is no longer supported or maintained and thus is vulnerable to many security holes. You should update to Firefox 14 immediately. [[Update Firefox to the latest version]]
-
Error while instaling the MEP server for Single tier, using Oracle 10g DB
createDatabaseTables:
getAppServer:
============================================================
Sun Java System Mobile Enterprise Platform
============================================================
checkAppServer:
defaultDomainExists:
checkDefaultDomain:
Found "domain1", do you want to delete it? [y/n]
y
shouldDeleteDefaultDomain:
deleteDefaultDomain:
The domain (domain1) isn't running.
Domain domain1 deleted.
setup:
getDomainProperties:
Enter the name for the new Application Server domain (default: mep)
mep
Enter the Admin Port for the new domain [mep] (default: 4848)
Enter the HTTP Port for the new domain [mep] (default: 8080)
Enter the HTTPS Port for the new domain [mep] (default: 8181)
Enter the admin password for the new domain (default: adminpass)
remoba123
installGateway:
init:
getDomainProperties:
createDomain:
Using port 4848 for Admin.
Using port 8080 for HTTP Instance.
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
Domain being created with profile:developer, as specified by variable AS_ADMIN_P
ROFILE in configuration file.
Security Store uses: JKS
Domain mep created.
startDomain:
Attempting to start domain...
Waiting for domain to finish initializing
Waiting for status to be: mep running
init:
configureDomain:
Copying files to installation directory ...
Copying 53 files to F:\Sun\AppServer\domains\mep\ds
Copying 101 files to F:\Sun\AppServer\domains\mep\lib
Copying 1 file to F:\Sun\AppServer\domains\mep\lib
Copying 1 file to F:\Sun\AppServer\domains\mep\lib
Copying 1 file to F:\Sun\AppServer\domains\mep\lib
Copying 1 file to F:\Sun\AppServer\domains\mep\lib\classes\META-INF
init:
copyOracleJar:
Copying 1 file to F:\Sun\AppServer\domains\mep\lib\ext
Copying 1 file to F:\Sun\AppServer\domains\mep\lib\ext
server.java-config.classpath-suffix = F:\Sun\AppServer/domains/mep/ds/skin/user/
messages/i18n;F:\Sun\AppServer/domains/mep/ds/skin/admin/messages/i18n
Command create-jvm-options executed successfully.
Command create-jvm-options executed successfully.
Command create-jvm-options executed successfully.
Command create-jvm-options executed successfully.
Command create-jvm-options executed successfully.
Command create-jvm-options executed successfully.
Command create-jms-resource executed successfully.
Command create-jmsdest executed successfully.
Command create-jms-resource executed successfully.
configure:
configureMySQL:
configureOracle:
Command create-jdbc-connection-pool executed successfully.
Command create-jdbc-connection-pool executed successfully.
server.resources.jdbc-connection-pool.musicdb_jdbc_pool_oracle.match-connections
= true
configureRealm:
Command create-jdbc-resource executed successfully.
Command create-jdbc-resource executed successfully.
Command create-auth-realm executed successfully.
deployEAR:
stopDomain:
Domain mep stopped.
startDomain:
Attempting to start domain...
Waiting for domain to finish initializing
Waiting for status to be: mep running
Still waiting for status to be: mep running
Command deploy executed successfully with following warning messages: WARNING:
JDO76611: Cannot connect to database via JNDI name 'jdbc/gw': java.sql.SQLExcept
ion: Connection could not be allocated because: ORA-01017: invalid username/pass
word; logon denied.
installJCAconnectors:
stopDomain:
Domain mep stopped.
Aug 22, 2008 8:22:55 PM com.sun.jbi.installer.JBICoreInstaller main
INFO: OpenESB JBI Core Components successfully installed in F:\Sun\AppServer\jbiThe error suggests that the oracle gwdb database was incorrectly created with the wrong username and password for the database. The installation expects the gwdb database to be created with the username of "gwdbuser" and password of "gwdbpass". I would check the login credentials for this database. Also the installation expects the musicdb database to be created with the username of "musicdbuser" and password "musicdbpass". You may want to check this as well.
JDO76611: Cannot connect to database via JNDI name 'jdbc/gw': java.sql.SQLExcept
ion: Connection could not be allocated because: ORA-01017: invalid username/pass
word; logon denied.
Alan Frechette
Sun MEP SQA Engineer
Maybe you are looking for
-
I have windows server 2012 R2 and install active directory
My question is I install active directory in windows server 2012 R2 and create Group Policy. ( These set-up is only for test) Have not registered domain only install active directory to test. So the problem is when I created Group policy for my user
-
Purchase order rejection via BAPI
Hi, i need to use BAPIs for purchase order release because it is interfaced with Notes. I'm looking for a BAPI or Function module in order to reject PO as it is possible in ME29N transaction in ECC 6.0 . I found BAPI_PO_RELEASE (to release) and BAPI_
-
I am about to remove 1.4 I have found that for some reason I have a number of .lrcat files on the drive, taking up some considerable amount of space. My master photos' are all safe on a drive. Can I just delete the .lrcat files and the associated fol
-
Runtime Sharing & Component Inspector Bug
I'm not sure if this is a bug with Flash or me doing something wrong. Here are the steps to reproduce: 1) Create "Source.fla" draw a box on the stage and convert it to a movie clip. Call it "Component" export Component for actionscript. Give make the
-
I am using Chrome as a browser. When I shop on Amazon, for example, items that I'm shopping for then appear in ads on other sites that I am browsing later. How can I stop that from happening?