Java OracleXML
I have just downloaded the Oracle XML SQL Utility for Java and run the environment script. Then I tried to execute the command line 'java OracleXML'. I get the following error:
Unable to initialize threads: cannot find class java/lang/Thread
What am I missing?
probably best addressed on the XML forum
Similar Messages
-
Java OracleXML putXML & non-unique keys
I am using the XML SQL Utility for java on the client (NT) to insert multi-row XML documents into an ORACLE table. Everything works fine until I hit a row with a non-unique key. It appears insertXML throws an error and the insert stops at that point. Rows after the non-unique key row are not processed.
Is there any way to process all rows of an XML document, telling me how many read, how many inserted, how many not processed??
Also, what about update capabilities? Presently I am not needing to update from XML into ORACLE, all I can do now is insert.
Thanks in advance,
RickOne way to make this work would be to take advantage of Oracle8i's INSTEAD OF triggers on views.
Basically, you would:
(1) CREATE VIEW someview
AS SELECT * FROM sometable;
(2) CREATE TRIGGER someview_trig
INSTEAD OF INSERT ON someview
DECLARE
BEGIN
-- Check for existence of
-- row using the value of
-- :NEW.pk_column_name
IF (you-found-an-existing-one) THEN
-- Do something here like
-- NULL; to ignore the insert altogether
-- or possible an INSERT into
-- and EXCEPTIONS table...
ELSE
INSERT INTO sometable
VALUES (:NEW.column1, ..., :NEW.columnn);
END IF;
END;
(3) Then point XML SQL Utility at someview
instead of sometable
and you'll be in business, as they say. -
OracleXML - java.lang.OutOfMemoryError
Hi,
I want use OracleXML for upload/download a data in database,
but I have a very big memory use :
java -Xms64m -Xmx128m OracleXML getXML -user "userXML/userXML" "select * from USER_LINK
Exception in thread "main" java.lang.OutOfMemoryError
<<no stack trace available>>
this OK with :
-Xms128m -Xmx256m
1. Are you now if memory use is function to SQL or number off rows ?
2. With this Big consumption ?
3. Which is the limit or good use
G.I used XSU's command line interface with folloeing code:
export ORACLE_HOME=/sys2/oracle/product/8.1.7
export LIBPATH=$ORACLE_HOME/lib:
export CLASSPATH=$ORACLE_HOME/rdbms/jlib/xsu12.jar:$ORACLE_HOME/lib/xmlparserv2.
jar:$ORACLE_HOME/jdbc/lib/classes12.zip
java OracleXML getXML -DateFormat 'dd-MMM-yyyy' -withDTD -rowsetTag PO -conn
"jdbc:oracle:oci8:@server_name" -user "userID/password" "select * from table_name" >file_name
It works only when the selected data is small and fails when the file is large, said above 30 MB, with Outof memoryError message.
I tried to use similar command in your answer to Guillaume Moulard's question:
java oracle.xml.sql.query.OracleXMLQuery.getXMLSAX -DateFormat 'dd-MMM-yyyy' -withDTD -rowsetTag PO -conn
"jdbc:oracle:oci8:@server_name" -user "userID/password" "select * from table_name" >file_name
but got an error message "Can't find class oracle.xml.sql.query.OracleXMLQuery.getXMLSAX".
Could you please help me to find out the problem and solution?
Thank you.
Yiguang Zhong -
XML to database using OracleXML ...
I am trying to insert xml file into CCX_persons table :
I got the error message:
C:\XML>java OracleXML putXML -user shrikant/akola@devdb -fileName xmlperson.xml
"ccx_persons"
oracle.xml.sql.OracleXMLSQLException: java.lang.ClassCastException: oracle.xml.p
arser.v2.XMLPI
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:245)
at OracleXML.Put_XML(OracleXML.java:352)
at OracleXML.ExecutePutXML(Compiled Code)
at OracleXML.Execute(OracleXML.java:164)
at OracleXML.main(OracleXML.java:139)
java.lang.ClassCastException: oracle.xml.parser.v2.XMLPI
What could be wrong. Please help.
Thanks
ShriDo you have XML Processing instructions in the XML document that you're trying to insert?
They'd look like:
<?xxx ?>
null -
I am working on a 2200 row table with 20 columns. Datatypes a mixture of smallish varchar, integer and date.
Oracle 8.1.5.2 on Redhat Linux 6.1. Pentium III 500, 256MB.
JRE and JDK 1.1.6v5
I have output the table to an XML document (java OracleXML getXML ....). This takes about 25 seconds, which is fine (although spool to a table takes only 3 seconds). The resulting file size is 1.2mb
However, when I re-load the table (java OracleXML putXML ...) it takes 35 minutes, which is way slower than I want or expected...
As a comparison, I have also output the table to a tab-delimited file, which I have loaded using SQL*Loader. This load takes about 10 seconds.
So my questions are:
1. Why is it so slow on the XML load? Am I doing something wrong; can I tune somehow?
2. I could implement an XML loader in PRO*C (presumably the C XML parser will help here), but is there a better solution?
nullHi,
We have improved the speeds of execution of the generation component recently after doing some deep analysis. But there are going to be overheads with regard to creating Strings.
With respect to insert, 35 minutes is completely unacceptable. The reason is that internally, we parse the document into a DOM object and then bind it row by row to an insert statement. We are working next to improve this performance by using direct load APIs and using SAX instead of DOM.
It would also help if u can send the SQL script (with all sensitive info blocked), which would be useful for us to take a look at and do some improvements on the current engine.
But currently, if u want to increase the speed the only way is to transform the XML data using XSL or otherwise into SQL loader format and directly load it.
Thx
Murali -
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/
XSLException
Hi
I have downloaded XDK and was trying to use the XSU feature..
I unzipped the XDK file, I ran the following query on SQL plus
select * from emp. It displayed the full table.
Then i set the class path for XDK,XMLparserv2,oracle JDBC driver and then ran the same query on dos prompt(that is front end command line for java in my case).
The following is the line i tried to execute on the command prompt
java OracleXML getXML -user "scott/tiger" -conn "jdbc:oracle:thin:@localhost
:1521:PomonaT" "select * from emp"
PomonaT is the db name(Host string i use to enter SQL+)
I get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/xml/parser/v2/
XSLException
at OracleXML.To_XML(OracleXML.java:1038)
at OracleXML.ExecuteGetXML(OracleXML.java:917)
at OracleXML.main(OracleXML.java:184)
IS SOMETHING MISSING IN MY CLASSPATH??
IF YES? Could anyone tell what??
KunalAdd xmlparserv2.jar to Classpath & reboot.
-
XML to SQL conversion using OracleXML putXML
Hi,
How many rowTag values can I use when I use OracleXML putXML ? I have an XML file in the following format.
I have to use "ABC" as rowTag. What Can I do with "GRANT_ROW" ? I have a table with
R_DATE and
GRANT columns
where GRANT is an object type with elements
NAME and ATYPE.
Thanks.
<?xml version = '1.0'?>
<EXCH>
<ABC num="1">
<R_DATE>5/21/2003 0:0:0</R_DATE>
<GRANT>
<GRANT_ROW num="1">
<NAME>GUNACAR</NAME>
<ATYPE>TE</ATYPE>
</GRANT_ROW>
<GRANT_ROW num="2">
<NAME>GUNACAR</NAME>
<TYPE>TE</TYPE>
</GRANT_ROW>
</GRANT>
</ABC>
</EXCH>
I get the following error when I run
java OracleXML putXML ....
oracle.xml.sql.OracleXMLSQLException: 'The XML element tag 'GRANT_ROW'
does not match the name of any of the columns/attributes of the
target database object.' encountered during processing ROW element 0.
Thanks....RTF FormattingKit
http://www.schema.de/sitehtml/site-e/xmlnach0.htm -
Hi,
I am trying to load OracleXMLSQL utility into the Oracle 8.1.5
database from our SUN box, but for some reason, I get the
following error message:
"SQL Error while connecting with oci8 driver to ....could not
open connection"
(I have had the USER_PASSWORD set to the right name. sqlplus
connects fine with USER_PASSWORD)
Any pointers ??
Thanks,
-Sandeep.
nullOracle Team, it is a month since I posed the question. Do U mind
replying ???
I am using XML SQL Utility on OAS server using Java. The code
compiled fine and displays perfect results using the command
line(on the server), but when I call the program thru browser
using OAS4.0 server, it starts to download a file which has the
following text in it:
Exception caught..!
... /oracle.xml.sql.query.OracleXMLQuery.class
Can U please explain this behavior, and advise on what need to be
done to overcome it ??
-Sandeep.
Sandeep Khanna (guest) wrote:
: Hi,
: Thanks for your reply. I don't understand why I got the error.
: Downloading the utility again, and running it worked without
: problems.
: Now, I can see the results on the UNIX box by using: "java
<class
: name>"
: But, when I call the program thru browser using OAS4.0 server,
it
: starts to download and has the following in the downloaded
file:
: Exception caught..! <path of my
: classfile>/oracle.xml.sql.query.OracleXMLQuery.class
: Any ideas/suggestions ??
: -Sandeep.
: Oracle XML Team wrote:
: : Hi Sandeep,
: : where is the error being raised? During loading? (i.e. when
: : running oraclexmlsqlload.csh?) Or is it when using
: : " java OracleXML " ?
: : The primary cause for this could be that the database is not
: up
: : and running. The second cause could be that the ORACLE_SID
and
: : ORA_SID is not set to the right values.
: : If you are having problems with running the client side
"java
: : OracleXML" then u need to supply the user name and password
: thru
: : the parameter, java OracleXML getXML -user
: "username/password"...
: : Hope this helps,
: : Oracle XML team
: : Sandeep Khanna (guest) wrote:
: : : Hi,
: : : I am trying to load OracleXMLSQL utility into the Oracle
: 8.1.5
: : : database from our SUN box, but for some reason, I get the
: : : following error message:
: : : "SQL Error while connecting with oci8 driver to ....could
not
: : : open connection"
: : : (I have had the USER_PASSWORD set to the right name.
sqlplus
: : : connects fine with USER_PASSWORD)
: : : Any pointers ??
: : : Thanks,
: : : -Sandeep.
: : Oracle Technology Network
: : http://technet.oracle.com
null -
I am trying to run xsu from the command line and must have my java incorrectly setup. Could someone look at my class path and problem to point out the solution. I suspect I need to install a higher version of java on the box.
here goes
(harbor:oracle) --> echo $CLASSPATH
/harborv01/app/oracle/product/9.2.0/jdbc/lib/ojdbc14.jar:/harborv01/app/oracle/p
roduct/9.2.0/jdbc/lib/classes12_g.zip:/harborv01/app/oracle/product/9.2.0/lib/xs
u12.jar:/harborv01/app/oracle/product/9.2.0/lib/xmlparserv2.jar
(harbor:oracle) --> java OracleXML getXML -user "ras/ras" -conn "jdbc:oracle:oci
8:rasxdevl" "select * from all_tables"
Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoint
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass0(Compiled Code)
at java.lang.ClassLoader.defineClass(Compiled Code)
at java.security.SecureClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.defineClass(Compiled Code)
at java.net.URLClassLoader.access$1(Compiled Code)
at java.net.URLClassLoader$1.run(Compiled Code)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessController.doPrivileged(Compiled Code)
at java.net.URLClassLoader.findClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClass(Compiled Code)
at java.lang.ClassLoader.loadClassInternal(Compiled Code)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(Compiled Code)
at oracle.jdbc.driver.OracleDriver.connect(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at java.sql.DriverManager.getConnection(DriverManager.java:130)
at OracleXML.getConnection(OracleXML.java:1214)
at OracleXML.To_XML(Compiled Code)
at OracleXML.ExecuteGetXML(Compiled Code)
at OracleXML.main(OracleXML.java:184)
(harbor:oracle) -->
thanks in advance
tomthanks
I made those additions and now have a different error:
(harbor:oracle) --> java OracleXML getXML -user "ras/ras" -conn "jdbc:oracle:oci
8:rasxdevl" "select * from all_tables"
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/dms/console/DM
SConsole
at <Unloaded Method>
at oracle.jdbc.driver.OracleConnection.createDMSSensors(OracleConnection
.java:662)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:325)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(Compiled Code)
at oracle.jdbc.driver.OracleDriver.connect(Compiled Code)
at java.sql.DriverManager.getConnection(Compiled Code)
at java.sql.DriverManager.getConnection(DriverManager.java:130)
at OracleXML.getConnection(OracleXML.java:1214)
at OracleXML.To_XML(Compiled Code)
at OracleXML.ExecuteGetXML(Compiled Code)
at OracleXML.main(OracleXML.java:184)
I appreciate your help and patience. Is there a document that I should be looking at?
tom -
Java.lang.UnsatisfiedLinkError: no ocijdbc8
I received the java.lang.UnsatisfiedLinkError: no ocijdbc8 error while running the following command:
java OracleXML putXML -user xxx/xxx .....
I saw a few posts regarding dll files for NT but nothing for AIX.
Any help would be greatly appreciated.
Thanks,
JohnHi Jinyu,
Here are the things I was checking for to fix this error.
I made sure the xsu12.jar and classes12.zip file were in the classpath, and they are.
I made sure the directory that contains the libocijdbc8.so library was in the classpath. It wasn't so I added it.
I added the directory that holds the libocijdbc8.so library to the LD_LIBRARY_PATH env variable.
Thanks,
John -
I upgraded the Oracle XML SQL Utility from 1.1.1 to 1.2 (and changed my ClassPath to use classes12.zip). When I run OracleXML putXML, rows are getting inserted into my table, but I'm getting the following error. Should I worry about it? I did not get this error message with XSU111. Thanks.
========================================
E:\vj\Test>java OracleXML putXML -user scott/tiger -fileName test-out_MANUAL.xml
t1
A nonfatal internal JIT (3.10.107(x)) error 'Structured Exception(c0000005)' has
occurred in :
'oracle/xml/sql/dml/OracleXMLSave.cleanLobList ()V': Interpreting method.
Please report this error in detail to http://java.sun.com/cgi-bin/bugreport.cgi
successfully inserted 3 rows into t1
========================================Please ignore this posting. My classpath was messed up. It's resolved.
-
Oracle XML SQL Utility for Java ..
I installed the Oracle SQL utility. But when i give a command on client side like
C:\>java OracleXML
it gives an error OracleXML class not found.
Can anybody help how to run this utility.
Thanks
ShrikantYou have to make sure that the oraclexmlsql.jar is in your java CLASSPATH.
Assume you have oraclexmlsql.jar in C:\temp
On NT, you would do something like:
C:\> set CLASSPATH=C:\temp\oraclexmlsql.jar;%CLASSPATH%
C:\> java OracleXML
and it will work. -
How to use OracleXML getXML utility?
I am first time use this utility. Is any one can give me a good example how should I use this utility?
For example:
my database connect string in my tnsname.ora is testdb. I wang send query ask "select username from dba_users;" the username/password is system/manager. I tryed syntax as follow:
java OracleXML getXML -user "system/manager@testdb" -fileName mysql
the sql statement save in mysql file. but it doesn't work for me. Anything I did wrong here. Thank you for you help.
nullHi,
1. create a properties file (the following example is relevant if you have an ORACLE repository, you can find more information in http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_hp_admin/frameset.htm?ch09s01s01.html]):
SOURCE_APP_JDBC_CATALOG=SOURCE_APP
SOURCE_APP_JDBC_DRIVER=hyperion.jdbc.oracle.OracleDriver
SOURCE_APP_JDBC_URL=jdbc:hyperion:oracle://RepositoryDatabaseServer;SID=DatabaseSID
SOURCE_APP_JDBC_USERNAME=schemaName
SOURCE_APP_JDBC_PASSWORD=schemaPassword
SOURCE_APP_JDBC_DATABASE_TYPE=ORA
SOURCE_APP_OLAP_SERVER=olapServerName:port
SOURCE_APP_OLAP_USERNAME=olapUserName
SOURCE_APP_OLAP_PASSWORD=olapUserPassword
SOURCE_APP_OLAP_APPNAME=SOURCE_APP
TARGET_APP_JDBC_CATALOG=TARGET_APP
TARGET_APP_JDBC_DRIVER=hyperion.jdbc.oracle.OracleDriver
TARGET_APP_JDBC_URL=jdbc:hyperion:oracle://RepositoryDatabaseServer;SID=DatabaseSID
TARGET_APP_JDBC_USERNAME=DatabaseSchemaName
TARGET_APP_JDBC_PASSWORD=DatabaseSchemaPassword
TARGET_APP_JDBC_DATABASE_TYPE=ORA
TARGET_APP_OLAP_SERVER=olapServerName:port
TARGET_APP_OLAP_USERNAME=olapUserName
TARGET_APP_OLAP_PASSWORD=olapUserPassword
TARGET_APP_OLAP_APPNAME=TARGET_APP
2. open CMD and enter copyapp /S:yourSourceAppName /T:yourTargetAppName /P:yourPropertiesFileName.properties /L:yourLogFileName.log
After the migration has been succeded you should update your users using the UpdateUsers.cmd (UpdateUsers.cmd PlanningServer PlanningUserName PlanningUserPassword TARGET_APP).
Hope this helps...
KInd regards
André -
XSU -- java.lang.UnsatisfiedLinkError
I am trying to use the XSU, I have loaded the jar files into the
db, but I get this error
C:\>java OracleXML getXML -user "scott/tiger" "select * from emp"
Exception in thread "main" java.lang.UnsatisfiedLinkError:
get_env_handle
at oracle.jdbc.oci8.OCIEnv.get_env_handle(Native Method)
at oracle.jdbc.oci8.OCIEnv.getEnvHandle(OCIEnv.java:70)
at oracle.jdbc.oci8.OCIDBAccess.logon
(OCIDBAccess.java:359)
at oracle.jdbc.driver.OracleConnection.<init>
(OracleConnection.java:252)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance
(OracleDriver.java:365)
at oracle.jdbc.driver.OracleDriver.connect
(OracleDriver.java:260)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at OracleXML.getConnection(OracleXML.java:1086)
at OracleXML.To_XML(OracleXML.java:915)
at OracleXML.ExecuteGetXML(OracleXML.java:826)
at OracleXML.main(OracleXML.java:162)I am getting a lot of errors trying to run the initjvm.sql, like
Warning: Package Body created with compilation errors.
drop table java$rmjvm$aux *
ERROR at line 1:
ORA-00942: table or view does not exist
and
begin if :jvmrmaction = 'FULL_REMOVAL' or :jvmrmaction
= 'GRADE_REMOVAL' then
ERROR at line 1:
ORA-04068: existing state of packages has been discarded
ORA-04063: package body "SYSTEM.INITJVMAUX" has errors
ORA-06508: PL/SQL: could not find program unit being called
ORA-06512: at line 3
and
CREATE PUBLIC SYNONYM "NameFromLastDDL" FOR sys."NameFromLastDDL"
ERROR at line 1:
ORA-00955: name is already used by an existing object
I am new to this, so all these errors doesn't say anything
to me -
How to putXML on a joined View?
Hi
I would like to insert an XML document into two tables (some
elements into table 1 and some into table 2). I have created a
joined view of the two tables and have tried to insert into the
view with:
java OracleXML putXML -user %USER_PASSWORD% -filename myfile.xml
myView
But I get the error "cannot modify a column which maps to a non
key-preserved table". PLEASE GIVE A SPECIFIC EXAMPLE OF AN
UPDATABLE 'VIEW' WHERE AN INSERT CAN MODIFY MORE THAN ONE
UNDERLYING TABLE. Is it possible?
Any example will do. But here is what I tried to do. I tried
to map the first few ROW child elements of an XML document (shown
at the bottom) into columns of the EMP table and the remaining
child
elements into another table called RELATIVE (this is a table
containing next-of-kin contact information for each employee). I
created a RELATIVE table with:
CREATE TABLE RELATIVE (
IDREL NUMBER(15) PRIMARY KEY,
EMPNUM NUMBER(4) CONSTRAINT FK_REL REFERENCES SCOTT.EMP(EMPNO),
RNAME VARCHAR2(20) NOT NULL,
TEL NUMBER(14),
STREET VARCHAR2(30),
CITY VARCHAR2(20),
STATE VARCHAR2(10),
ZIP VARCHAR2(12),
COUNTRY VARCHAR2(20)
I added a EMPNO_DUP column to the EMP table that is a copy of
the
EMPNO primary key (I did this so as to use EMPNO_DUP for the two
table join, rather than the EMPNO primary key. My first attempts
to make the joined view with EMPNO also gave the same error). I
wrote a PL/SQL trigger than would make sure that EMPNO_DUP and
EMPNO remain in synch if EMPNO is updated or if there is an
INSERT on EMP. Then I created a joined view of EMP and RELATIVE
with:
CREATE OR REPLACE VIEW EMPREL
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO, EMPNO_DUP
IDREL, EMPNUM, RNAME, TEL, STREET, CITY, STATE, ZIP, COUNTRY)
AS SELECT
E.EMPNO, E.ENAME, E.JOB, E.MGR, E.HIREDATE, E.SAL, E.COMM,
E.DEPTNO,E.EMPNO_DUP,
R.IDREL, R.EMPNUM, R.RNAME, R.TEL, R.STREET, R.CITY, R.STATE,
R.ZIP, R.COUNTRY
FROM EMP E, RELATIVE R WHERE E.EMPNO_dup=R.EMPNUM;
I tried to insert the XML document shown at the bottom with:
java OracleXML putXML -user %USER_PASSWORD% -filename myfile.xml
myView
I also tried the direct SQL command:
INSERT INTO EMPREL
(EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO,EMPNO_DUP,
IDREL, EMPNUM, RNAME, TEL, STREET, CITY, STATE, ZIP, COUNTRY)
VALUES
(7944, 'WIZARD', 'CLERK', 7782, '25-JUL-82', 1325, 0, 10, 7944,
1, 7944, 'SUE', 4087200111, '200 MAIN ST.', 'PALO ALTO', 'CA',
'94043', 'USA')
Both attempts resulted in this error message:
"cannot modify a column which maps to a non key-preserved table"
I would really appreciate an example of how to create an
updatable view where two or more underlying tables can be
modified. Thanks.
Regards
Mehran Moshfeghi
Here is the sample XML file. I want the first set of elements to
map to EMP table columns and the second set of elements (after
the blank line) to map to the RELATIVE table columns.
<?xml version="1.0"?>
<ROWSET>
<ROW>
<EMPNO>7942</EMPNO>
<ENAME>GUNNEL</ENAME>
<JOB>CLERK</JOB>
<MGR>7782</MGR>
<HIREDATE>1982-02-25 00:00:00.0</HIREDATE>
<SAL>1350</SAL>
<DEPTNO>10</DEPTNO>
<EMPNO_DUP>7942</EMPNO_DUP>
<IDREL>2</IDREL>
<RNAME>SMITH</RNAME>
<TEL>6504262551</TEL>
<STREET>2171 LANDINGS DRIVE</STREET>
<CITY>MOUNTAIN VIEW</CITY>
<STATE>CA</STATE>
<ZIP>94043-0837</ZIP>
<COUNTRY>USA</COUNTRY>
</ROW>
</ROWSET>
nullHi Mehran,
This is a classic view update problem where the database cannot
figure out automatically which table(s) to update given a join
view. Any update/insert/delete cannot act on more than one
table.So if you are updating a column in a join-view, then that
column must map to a particular column of a single table
unambigously. You should look at the documentation on updatable
join views.
One of the easiest solutions to your problem is to create
INSTEAD-OF trigger on those views. INSTEAD-OF triggers are
triggers that can be created over non-updatable views to make
them updatable. Here in the trigger body you specify the
appropriate insert statements into the base tables. So your view
can be as complicated as possible and yet updatable using these
triggers.
Thx
oracle XML team
Mehran (guest) wrote:
: Hi
: I would like to insert an XML document into two tables (some
: elements into table 1 and some into table 2). I have created a
: joined view of the two tables and have tried to insert into
the
: view with:
: java OracleXML putXML -user %USER_PASSWORD% -filename
myfile.xml
: myView
: But I get the error "cannot modify a column which maps to a
non
: key-preserved table". PLEASE GIVE A SPECIFIC EXAMPLE OF AN
: UPDATABLE 'VIEW' WHERE AN INSERT CAN MODIFY MORE THAN ONE
: UNDERLYING TABLE. Is it possible?
: Any example will do. But here is what I tried to do. I tried
: to map the first few ROW child elements of an XML document
(shown
: at the bottom) into columns of the EMP table and the remaining
: child
: elements into another table called RELATIVE (this is a table
: containing next-of-kin contact information for each employee).
I
: created a RELATIVE table with:
: CREATE TABLE RELATIVE (
: IDREL NUMBER(15) PRIMARY KEY,
: EMPNUM NUMBER(4) CONSTRAINT FK_REL REFERENCES SCOTT.EMP
(EMPNO),
: RNAME VARCHAR2(20) NOT NULL,
: TEL NUMBER(14),
: STREET VARCHAR2(30),
: CITY VARCHAR2(20),
: STATE VARCHAR2(10),
: ZIP VARCHAR2(12),
: COUNTRY VARCHAR2(20)
: I added a EMPNO_DUP column to the EMP table that is a copy of
: the
: EMPNO primary key (I did this so as to use EMPNO_DUP for the
two
: table join, rather than the EMPNO primary key. My first
attempts
: to make the joined view with EMPNO also gave the same error).
I
: wrote a PL/SQL trigger than would make sure that EMPNO_DUP and
: EMPNO remain in synch if EMPNO is updated or if there is an
: INSERT on EMP. Then I created a joined view of EMP and
RELATIVE
: with:
: CREATE OR REPLACE VIEW EMPREL
: (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO, EMPNO_DUP
: IDREL, EMPNUM, RNAME, TEL, STREET, CITY, STATE, ZIP, COUNTRY)
: AS SELECT
: E.EMPNO, E.ENAME, E.JOB, E.MGR, E.HIREDATE, E.SAL, E.COMM,
: E.DEPTNO,E.EMPNO_DUP,
: R.IDREL, R.EMPNUM, R.RNAME, R.TEL, R.STREET, R.CITY, R.STATE,
: R.ZIP, R.COUNTRY
: FROM EMP E, RELATIVE R WHERE E.EMPNO_dup=R.EMPNUM;
: I tried to insert the XML document shown at the bottom with:
: java OracleXML putXML -user %USER_PASSWORD% -filename
myfile.xml
: myView
: I also tried the direct SQL command:
: INSERT INTO EMPREL
: (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO,EMPNO_DUP,
: IDREL, EMPNUM, RNAME, TEL, STREET, CITY, STATE, ZIP, COUNTRY)
: VALUES
: (7944, 'WIZARD', 'CLERK', 7782, '25-JUL-82', 1325, 0, 10, 7944,
: 1, 7944, 'SUE', 4087200111, '200 MAIN ST.', 'PALO
ALTO', 'CA',
: '94043', 'USA')
: Both attempts resulted in this error message:
: "cannot modify a column which maps to a non key-preserved
table"
: I would really appreciate an example of how to create an
: updatable view where two or more underlying tables can be
: modified. Thanks.
: Regards
: Mehran Moshfeghi
: Here is the sample XML file. I want the first set of elements
to
: map to EMP table columns and the second set of elements (after
: the blank line) to map to the RELATIVE table columns.
: <?xml version="1.0"?>
: <ROWSET>
: <ROW>
: <EMPNO>7942</EMPNO>
: <ENAME>GUNNEL</ENAME>
: <JOB>CLERK</JOB>
: <MGR>7782</MGR>
: <HIREDATE>1982-02-25 00:00:00.0</HIREDATE>
: <SAL>1350</SAL>
: <DEPTNO>10</DEPTNO>
: <EMPNO_DUP>7942</EMPNO_DUP>
: <IDREL>2</IDREL>
: <RNAME>SMITH</RNAME>
: <TEL>6504262551</TEL>
: <STREET>2171 LANDINGS DRIVE</STREET>
: <CITY>MOUNTAIN VIEW</CITY>
: <STATE>CA</STATE>
: <ZIP>94043-0837</ZIP>
: <COUNTRY>USA</COUNTRY>
: </ROW>
: </ROWSET>
Oracle Technology Network
http://technet.oracle.com
null
Maybe you are looking for
-
I have a new iMac running OS 10.9. When I use the Command S shortcut in any of my apps (numbers, text edit etc), it no longer saves the active document it speaks it instead. How can I revert to the save shortcut function?
-
ITune does not remember my purchase anymore - all apps now list price as if I never purchase them
During chrismas, I discovered several games I previously bought are now listed with full price, even after I went into the info page of the game. Why is this happening? Now every game I have ever bought are all now listed as full price so there is no
-
Hi All, I am working on a scenario where the employee Timesheet data is available in SQL server. The same data has to be passed into SAP. Basically the data from SQL has to be passed into BAPI_CATIMESHEETMGR_CHANGE. This Function module will update t
-
Desperate Help needed! Video breaking up...
I'm in a situation where we have serious deadlines... and the exported video from Compressor is unacceptable. I am importing video AVCHD video, which is interlaced, into Final Cut from a Sony HDR-S11. Here are my settings: Sequence Preset: Apple ProR
-
Installing Leopard on a Mac Pro
As I am a bit of a scaredy cat, I have put off installing Leopard on my Mac Pro. This is a work machine and although I have another G5 that is perfectly usable if this machine went belly up I have still not bit the bullet so to speak... until now. I'