Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Using ON DUPLICATE KEY UPDATE

user10903866Mar 21 2013 — edited Mar 21 2013
i want to add a row to a database with insert but when inserting if a row exists with the same unique key i want to update the row. e.g

CODE:

INSERT INTO FILETERCALENDAR ( c_DATE, ONCE_WINDOW) values ('13/MAR/2013',1) ON DUPLICATE KEY UPDATE ONCE_WINDOW=1;

I am getting the following error:

ERROR:

Error starting at line 1 in command:
INSERT INTO FILETERCALENDAR ( c_DATE, ONCE_WINDOW) values ('13/MAR/2013',1) ON DUPLICATE KEY UPDATE ONCE_WINDOW=1
Error at Command Line:1 Column:77
Error report:
SQL Error: ORA-00933: SQL command not properly ended
00933. 00000 - "SQL command not properly ended"
*Cause:
*Action:


It gives "SQL COMMAND NOT PROPERLEY ENDED" error. Which I do not understand why as if you see the query it is correct.

Questions
Can Anyone help what is wrong with the above QUERY Please?

Comments

843834
It doesn't itself, but since you can feed jaxb a DOM document from any source, you can always use a processor that does support xinclude and feed the result to the unmarshaller. Try this:

(1) Get the XInclude Engine at http://xincluder.sourceforge.net/

(2) build the xinclude document with something like:


DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware( true );
factory.setCoalescing( true );
DocumentBuilder parser = factory.newDocumentBuilder();
InputSource input = new InputSource();
input.setByteStream( new FileInputStream( fname ) );
Document masterDoc = parser.parse( input );
Document doc = DOMXIncluder.merge( masterDoc, input.getSystemId() );

(3) then unmarshal the document with:

JAXBContext jc = JAXBContext.newInstance( "my.context" );
Unmarshaller u = jc.createUnmarshaller();
MyClass x = (MyClass) u.unmarshal( doc );

there's probably a faster Sax equivalent of this. Also works (better) with Castor.

hope this helps,

Graham
843834
Oops! sorry: looking at it again, I see I misread your question. I thought you meant using xinclude in a datafile (which I'd just worked out how to do) rather than in a schema (which I haven't worked out). Apologies.

Graham
843834
Yes. JAXB 1.0 supports included and imported schemas.
Can you please attach the COS.xsd too

Regards,
Bhakti Mehta
Sun Microsystems
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 18 2013
Added on Mar 21 2013
2 comments
2,539 views