Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4024700
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:45:14+00:00 2026-05-20T10:45:14+00:00

I have an existing table in an Oracle 10gR2 that I added a XMLTYPE

  • 0

I have an existing table in an Oracle 10gR2 that I added a XMLTYPE column to it. Now, I need to fill this field with a XML that is composed with a mixture of values from the fields of each row, but I can’t get the syntax down correctly. Below is the correctly working SELECT statement that generates the desired XML for each row:

SELECT XMLELEMENT("TBLOrigs",
  XMLELEMENT("TBLOrig", XMLATTRIBUTES(Field1 AS "Field1"),
  XMLFOREST(Field2 AS "Field2", Field3 AS "Field3", Field4 AS "Field4", Field5 AS "Field5"),
    XMLELEMENT("Dets",
    XMLFOREST(Field6, Field7 AS "Field7")))) AS XmlCol
  FROM TBLOrigin Orig1
WHERE Field1 <= 10

The UPDATE I’m trying is something like this, but it’s not working:

UPDATE TBLOrigin
SET AUXFIELD = (
  SELECT XMLELEMENT("TBLOrigs",
  XMLELEMENT("TBLOrig", XMLATTRIBUTES(Field1 AS "Field1"),
  XMLFOREST(Field2 AS "Field2", Field3 AS "Field3", Field4 AS "Field4", Field5 AS "Field5"),
    XMLELEMENT("Dets",
    XMLFOREST(Field6, Field7 AS "Field7")))) AS XmlCol
  FROM TBLOrigin Orig1
  WHERE Orig1.Field1 = Orig2.Field1
  AND Orig1.Field2 = Orig2.Field2
  AND Orig1.Field3 = Orig2.Field3
  AND Orig1.Field4 = Orig2.Field4
  AND Orig1.Field5 = Orig2.Field5)
FROM TBLOrigin Orig2
WHERE Field1 <= 10

I’m trying to UPDATE each row with the XML content generated from it’s fields. I keep getting the error below:

Erro na Linha de Comando:13 Coluna:47
Relatório de Erro:
Erro de SQL: ORA-00933: SQL command not properly ended
00933. 00000 -  "SQL command not properly ended"
*Cause:    
*Action:

Just as a reference, below is the working UPDATE in Transact Sql

UPDATE dbo.TBLOrigin
SET AuxInfo = (SELECT 
  Field1 as "@Field1",
  Field2 as "Field2", 
  Field3 as "Field3", 
  Field4 as "Field4", 
  Field5 as "Field5", 
  Field6 as "Dets/Field6", 
  Field7 as "Dets/Field7"
FROM dbo.TBLOrigin AS Orig1
WHERE Orig1.Field1 = Orig2.Field1
AND Orig1.Field2 = Orig2.Field2
AND Orig1.Field3 = Orig2.Field3
AND Orig1.Field4 = Orig2.Field4
AND Orig1.Field5 = Orig2.Field5
  FOR XML PATH('TBLOrig'), TYPE, ROOT('TBLOrigs'))
FROM dbo.TBLOrigin Orig2

Tks so much for any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:45:15+00:00Added an answer on May 20, 2026 at 10:45 am

    Oracle doesn’t do UPDATE…FROM

    Does the following work ?

    UPDATE TBLOrigin
    SET AUXFIELD = 
           XMLELEMENT("TBLOrigs",
             XMLELEMENT("TBLOrig", XMLATTRIBUTES(Field1 AS "Field1"),
             XMLFOREST(Field2 AS "Field2", Field3 AS "Field3", 
                       Field4 AS "Field4", Field5 AS "Field5"),
             XMLELEMENT("Dets",
                XMLFOREST(Field6, Field7 AS "Field7")))) AS XmlCol
    WHERE Field1 <= 10
    

    If not, can you post the table definition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an already existing table with a field that should be unique but
I have an existing table structure that looks something like this: AnimalTable ------------- |Id
I have an existing database with the table Transactions in it. I have added
I have existing java code and need to create Design Document based on that.
I have an existing table 'people_table', with a field full_name . Many records have
I have a (pre-existing) table witha column 'foo'. I want the model to have
I have table with data. Is it possible slug field automatically generated on existing
i have an existing mysql table with the id column defined as primary, and
I have a table with 2 varchar2 columns. I have added new number column
I have a table in an Oracle database with a timestamp column nextTime and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.