DBMS_XMLGEN package

Hello

I have a table with the following columns

name of the table: TRANSACTION

columns:
ID
STATUS
CREATEDBY
CREATED THE


I want to generate an xml for columns with the following format

transactions <>
< transaction >
< id > 1 < /ID >
< status > < / status >
* < audit > *.
< createdby > LINI < / createdby >
< createdon > < / < createdon >
* < / audit > *.
< / transaction >
<! - transactions more - >
< / transactions >

can it be dione using DBMS_XMLGEN package? I am not able to insert * < audit > * tag between the two. Help, please

Maybe this:

SQL> declare
  x   int;
begin
  x :=
    dbms_xmlgen.newcontext (
      'select id "id", status "status", xmlconcat(xmlelement("createdby", createdby), xmlelement("created_on", created_on)) "audit" from transaction');
  dbms_xmlgen.setrowtag (x, 'transaction');
  dbms_xmlgen.setrowsettag (x, 'transactions');

  dbms_output.put_line (dbms_xmlgen.getxml (x));
end;
/


 
  1
  A
  
   LINI  
 

PL/SQL procedure successfully completed.

?

Tags: Database

Similar Questions

  • Dbmsxml package

    Dear Sir
    I have recd suite error when I try to run after a command in the command sql of oralce 10g xe

    Select xml dbms_xmlgen.getxml ("select doc_no from sales') of double;


    ORA-04067: unaccomplished, body package "of EXCISE. DBMS_XMLGEN"is no ORA-06508: PL/SQL: called program unit is not found: 'EXCISE. DBMS_XMLGEN.

    But it works in my hr diagram

    Select xml dbms_xmlgen.getxml ("select employee_id from employees") of double;

    How can I use the HR dbms_xmlgen package in my scheme of excise

    I install the dbmsxml package in the excise scheme, but still it does not work.

    DBMS_XMLGEN is owned by SYS.

    You don't have to manually install in different schemas.
    All you have to do is to grant the appropriate privileges (and create a synonym if necessary):

    GRANT execute ON dbms_xmlgen to ;
    

    As a general rule, execute privilege is given to the PUBLIC and a synonym PUBLIC is created too:

    create public synonym dbms_xmlgen for sys.dbms_xmlgen;
    grant execute on dbms_xmlgen to public;
    
  • Difference between DBMS_XMLGEN and DBMS_XMLSQUERY

    Hello

    Can someone let me know the fundamental difference between DBMS_XMLGEN and DBMS_XMLQUERY?



    Thanx

    Published by: Apache on October 13, 2008 23:56

    Directly from the documentation:

    H2. DBMS_XMLGEN 125
    DBMS_XMLGEN package converts the results of a SQL query to the canonical XML format. All takes an arbitrary SQL query as input, converts it to XML format, and returns the result as a CLOB. This package is similar to the DBMS_XMLQUERY package, except that it is written in C and compiled in the kernel. This package can be run only on the database.

    H2. DBMS_XMLQUERY 127
    DBMS_XMLQUERY provides database XMLType functionality. If possible, use DBMS_XMLGEN package integrated into the C instead of DBMS_XMLQUERY.

  • to the xml output

    I am sql developer 10g version.
    now, I want to see released in Formate of xml...

    the syntex below does not can not someone help?


    Select * from employees for xml auto;

    I answered this last week, but it seems to have been deleted for some reason any.

    Discover the DBMS_XMLGEN package:

    Select dbms_xmlgen.getxml ("select * from employees where rownum")< 6')="" xml="" from="">

    is the equivalent of your example.

  • Export as XML error report

    Hello

    In the APEX, I try to export a report in XML format which will be then imported into a PDF form. I receive the error:

    "BOLD"report error: ORA-06502: PL/SQL: digital or value error: character string buffer too small * bold *.

    When trying to export on a report that has more than 44 columns. Anything in the exports of 44 columns very well. The full report is 1 row and 61 columns which is which is to be exported. Is this something that can be fixed with a configuration change or get around it?

    Thank you
    Joel

    Because your number of columns column seems to be the problem, you can manually create an XML file for the user with dbms_xmlgen package.

    Select dbms_xmlgen.getxml ("select * from tab where tabtype =" SYNONYM "'") double

    GetXml returns the CLOB data type. You can store the result in a bulk pl/sql clob data type and then write the contents of the present in a flat file where you want using the UTL_FILE package.

    http://www.DBA-Oracle.com/t_dbms_xmlgen.htm

    Thank you

    Tony Miller
    Webster, TX

  • Problems with DBMS_XMLGEN.getXML add features

    Hello

    I use DBMS_XMLGEN on 11 GR 2.

    The documentation Pages of PL/SQL and Types Reference 11 GR 2 (July 2013) reads as follows:

    GETXML functions

    This function returns the XML document. The function is overloaded.

    Syntax

    Gets the XML document from the maximum number of rows specified. It

    adds the XML in the CLOB passed Use this version of GETXML

    To avoid extra CLOB copies and reuse the same CLOB for subsequent functions

    calls. Due to the CLOB reuse, this GETXML Functionscall is potentially more

    effective:

    DBMS_XMLGEN. GETXML)

    CTX IN ctxHandle,

    tmpclob IN OUT NCOPY CLOB,

    dtdOrSchema in numbers: = NONE)

    RETURN A BOOLEAN VALUE;

    11 GR 2 Guide (February 2014) developer Oracle DB XML stipulates the following:
    Parameters

    getXML (ctx IN ctxHandle,

    clobval IN OUT NCOPY clob,

    dtdOrSchema in numbers: = NONE);

    CTX -The context handle from call

    newContext.

    clobval (IN/OUT) - the CLOB to which the XML document is

    being attached,

    dtdOrSchema -If you need to generate the DTD or

    Schema. This parameter is NOT supported.

    Use this version of the function getXML, in order to avoid any supplement

    CLOB copies and if you want to reuse the same CLOB for

    subsequent calls. This getXML call is more effective than the other

    flavor, even if it means that you create the LOB reference.

    When you generate the XML, the number of lines specified by the

    setSkipRows call are ignored, then the maximum number of

    ranks as specified by the setMaxRows call (or all if

    not specified) is read and converted into XML. Use of the

    getNumRowsProce

    I'm bringing 2 parts of XML document.  I use 2 hierarchical queries.  One to generate hierarchical header of a table and another information to generate information of hierarchical detail to a separate table. My code is generally as follows:

    DECLARE

    hdrctx DBMS_XMLGEN.ctxHandle;

    detailctx DBMS_XMLGEN.ctxHandle;

    hdrdoc CLOB.

    BOOLEAN success;

    hdrqry VARCHAR2 (2000): = ' SELECT LEVEL, XMLELEMENT (EVALNAME HTAGNAME, HTAGVAL) OF HDRTABLE

    CONNECT HSUBSEQ = PRIOR HGRPSEQ';

    --

    detailqry VARCHAR2 (2000): = ' SELECT LEVEL, XMLELEMENT (EVALNAME DTAGNAME, DTAGVAL) OF DETAILTABLE

    CONNECT DSUBSEQ = PRIOR DGRPSEQ';

    BEGIN

    hdrctx: = DBMS_XMLGEN.newContextFromHierarchy (hdrqry);

    detailctx: = DBMS_XMLGEN.newContextFromHierarchy (detailqry);

    DBMS_LOB.CREATETEMPORARY (hdrdoc, true);

    DBMS_XMLGEN. GetXml (hdrctx, hdrdoc);

    -dbms_output.put_line (hdrdoc);

    DBMS_XMLGEN. GetXml (detailctx, hdrdoc);

    DBMS_XMLGEN.closeContext (hdrctx);

    DBMS_XMLGEN.closeContext (detailctx);

    dbms_output.put_line (hdrdoc);

    DBMS_LOB. FREETEMPORARY (hdrdoc);

    END;

    I also tried the next iteration:

    BEGIN

    hdrctx: = DBMS_XMLGEN.newContextFromHierarchy (hdrqry);

    detailctx: = DBMS_XMLGEN.newContextFromHierarchy (detailqry);

    DBMS_LOB.CREATETEMPORARY (hdrdoc, true);

    hdrdoc: = DBMS_XMLGEN.getXML (hdrctx);

    -dbms_output.put_line (hdrdoc);

    DBMS_XMLGEN. GetXml (detailctx, hdrdoc);

    DBMS_XMLGEN.closeContext (hdrctx);

    DBMS_XMLGEN.closeContext (detailctx);

    dbms_output.put_line (hdrdoc);

    DBMS_LOB. FREETEMPORARY (hdrdoc);

    END;

    The two sources of documentation indicates that version 3 of overload of getXML parameter adds the CLOB parameter that is passed and yet I am not able to get the details to add to the header.  If I Uncomment the first put_line I get a document of xml output containing the header as expected information.  However, the second put_line outputs of an xml document that contains only the detail information and none of the header information.  It is not adding as stated in the documentation, but substitute instead.  Any ideas what is happening here and how I can get the feature of adding such as specified in the documentation?

    An additional but trivial problem is the difference in the documentation.  Documentation packages and types indicates that 3 parameter getXML overload returns a BOOLEAN value.  DB XML Dev Guide does not indicate this.  When I use this, the call works as a process and not a function, but I'm failed in the 3rd parameter, which must by default to NONE.  I want to just make sure that using the 2 explicit and implicit parameters 1 is not ending up with me call the wrong version.

    Thanks in advance for any help you can give me on this point,

    Paul

    Because that the additional XML prologue is a specific, defined in section it is easy to remove.

    The best way to get something is to not generate it.

    This is the meeting of the 2 segments arbitrarily dimensions and structured it's much more embarrassing for me.

    What you mean?

    I'll look into the possibility of restructuring in those non-hierarchical hierarchical queries as a work-around.

    Don't bother it.

    Simply add two structures manually instead of using a 'function' who obviously don't get you any advantage.

    for example

    DECLARE

    hdrctx DBMS_XMLGEN.ctxHandle;

    detailctx DBMS_XMLGEN.ctxHandle;

    doc CLOB.

    hdrqry VARCHAR2 (2000): = ' SELECT LEVEL, XMLELEMENT ("emp", xmlattributes (empno as "id")) FROM scott.emp

    CONNECT BY prior empno = mgr

    Start with mgr is null';

    detailqry VARCHAR2 (2000): = ' SELECT LEVEL, XMLELEMENT ("emp2", xmlattributes (empno as "id")) FROM scott.emp

    CONNECT BY prior empno = mgr

    Start with mgr is null';

    BEGIN

    hdrctx: = dbms_xmlgen.newContextFromHierarchy (hdrqry);

    detailctx: = dbms_xmlgen.newContextFromHierarchy (detailqry);

    DBMS_LOB.CREATETEMPORARY (doc, true);

    Select xmlserialize (document

    XmlElement ("root"

    dbms_xmlgen.getxmltype (hdrctx)

    dbms_xmlgen.getxmltype (detailctx)

    )

    as clob dash

    )

    in the doc

    Double;

    dbms_xmlgen.closeContext (hdrctx);

    dbms_xmlgen.closeContext (detailctx);

    dbms_output.put_line (doc);

    DBMS_LOB.freeTemporary (doc);

    END;

    /

    output:

    
      
        
          
            
          
        
        
          
          
          
          
          
        
        
          
        
      
      
        
          
            
          
        
        
          
          
          
          
          
        
        
          
        
      
    
    
  • How can I get a dbms_xmlgen.getxml sql statement to write to a file

    I tried several things by using dbms_xmlgen.getxml to work in the generator from Oracle 10 g:
    Select dbms_xmlgen.getxml ("select prefix, suffix, fiscal_yr")
    OF rcv.recv_accessions ra
    where ra.prefix = 8 and ra.fiscal_yr = 11') double xml;

    It works very well in pl/sql developer, but not in the form builder.
    I get the following error in the form builder:
    Restriction of implementing: 'NONE': cannot directly access the slider or the package variable remote

    I also tried the following without success (with the exact same error as above):
    qryctx: = DBMS_XMLGEN. NEWCONTEXT ("select the prefix, suffix, fiscal_yr")
    OF rcv.recv_accessions ra
    in the case where ra.prefix = 8 and ra.fiscal_yr = 11');
    DBMS_XMLGEN. SETROWTAG (qryctx, 'HIV');
    result: = DBMS_XMLGEN.getXML (qryCtx);


    So, how do a query to output to a file in XML format in the form builder?
    Thank you

    The function DB would be something like this:

    create or replace function get_xml
    return clob
    is
       result   clob;
       qryctx  dbms_xmlgen.ctxHandle%type;
    begin
       qryctx:=DBMS_XMLGEN.NEWCONTEXT('select prefix, suffix, fiscal_yr
           FROM rcv.recv_accessions ra
           where where ra.prefix = 8 and ra.fiscal_yr = 11');
       DBMS_XMLGEN.SETROWTAG(qryctx,'SERO');
       result := DBMS_XMLGEN.getXML(qryCtx);
       return result;
    end;
    

    In your trigger of W-B-P, then simply:

    declare
       v_xml    clob;
    begin
       v_xml := get_xml;
    end;
    
  • Uninstall software update Apple says error in seller contact package package unstaller

    Try to get itunes working to make a backup of my faulty iphone before repair.

    First-itunes does not start says error. I'm trying to fix it, who said success but same error when you try to start it.

    Then uninstall completely worked. Then reinstall that seemed to be over except for a message "an older version of Apple software update already exists" then he went down and install itunes apparently had not been completed.

    Then I try to remove the update from the apple software and executed by an error in the installation program - it says there is an error in the installation and contact the supplier of the installation package. Same error if I run the uninstall command line program.

    Try to repair the Apple Software Update of programs & features Control Panel and then try to update iTunes again.

    For general advice, see troubleshooting problems with iTunes for Windows updates.

    The steps described in the second case are a guide to remove everything related to iTunes and then rebuild what is often a good starting point, unless the symptoms indicate a more specific approach.

    Review the other boxes and other support documents list to the bottom of the page, in case one of them applies.

    The more information box has direct links with the current and recent if you have problems to download, must revert to an older version or want to try the version of iTunes for Windows (64-bit - for older video cards) as a workaround for problems with installation or operation, or compatibility with third-party software.

    Backups of your library and device should be affected by these measures but there are links to backup and recovery advice there.

    TT2

  • I need a refund on a package I bought

    I'm not sure on how to request a refund for a package I bought?

    Essentially, iTunes purchases are considered final. This is part of the information provided when you make a purchase. However, you can use this link to contact iTunes support and ask. It is to them. https://www.Apple.com/EMEA/support/iTunes/contact.html

  • Content of library photos - necessary Expert Package

    I've had my MacBook for about 5 years now and I have an insane amount of Photos stored for the past 14 years, but during that time, my library of Photos being scenes has become a bit of a mess. (I think)

    My photo library app itself is very good, but there a total of scatter gun approach to sync my Photos with iTunes (via a cable not iCloud) allows to synchronize some and not others. Now he has decided to not to sync album art by June 2016 for some strange reason.

    I think that it has been corrupted and dare I say I have tinkered around with the "package contents" so I need help

    What records I should have in the contents of package of Photos? I have the following: -.

    Apple TV Photo Cache - I know it's for my Apple TV which is fine

    Spare part - no article here

    Data - photos contained here, no idea what it is for?

    Data.noindex - photos contained here like above?

    database

    iPhotolock.data

    iPod Photo Cache - I know that allows you to synchronize the photos to my iPhone and I deleted before you try and make it work

    Masks - no article here

    Masters - it's the only place where my original showing in Photos is kept? (14 items)

    Plug-Ins - no article here

    Previews - curious as to what this is?

    Private - no idea what it is for?

    ProjectDBversion.plist

    Projects.DB

    resources - no idea what this? Photos here too

    Miniatures - what is - it used to? I had 16 points here, it should not match the masters?

    I'd love to get it back to scratch so any ideas and would love someone to answer some of the questions above

    You are chasing a dream - you may (0r can't) get the answers to all or part of these but he questions not because you can't fix anything and if you messes with the content library autour probably have corrupted you it

    I daresay I could have tinkered around with the "contents of the package.

    rather than wasting time on a quest usless you need

    1 resolve to stay out of the inside of the library in the future - there is not serviceable by the user

    2. now, either restore a working library from before you "tinkered" around

    3 - or start over with a new library, then drag each file in master file to the icon in the Dock to import into the new library of Photos

    LN

  • Airpod will come in the same package with iPhone 7 in October?

    I heard they arrive in October, but they will come with iPhone 7 in the same package? I will be able to choose between Airpod and EarPods?

    Hello

    No - Airpod are a separate purchase.

    EarPods (wired, with lightning connector) are provided with the iPhone 7 and 7 more.

  • When I download itunes on my pc, I get an error of analysis package, any help?

    "When I download itunes on my pc I get a parse error in the package, any help?

    Hello xlAdrenaline,

    Thank you for using communities of Apple Support.

    If I understand your message that you receive a packet parse error when you try to install iTunes on your Windows PC. The following article has some great not to help solve this type of problem:

    If you see an error message "Windows package install" when you try to uninstall iTunes from your PC

    Best regards

  • Driveway and packages

    I have a MacPro of 2009. Recently, I changed all my records. The boot drive is now SSD. I downloaded a fresh copy of logic X on this drive and can't with her.

    First of all, enter car doesn't work simply. When I record select a track, I can see the counters are moving, but hear no sound through the canal. I have to click the Enter button to move audio via. He agrees that if the channel is logging on with the selected entry button, the channel should always pass the audio from the source during playback of the track, but it's not. This isn't the behavior that I'm used from logic after several years of use.

    Also, is there a way to get its default to saving in a folder rather than a package?

    Hello

    Chris Crabtree wrote:

    First of all, enter car doesn't work simply. When I record select a track, I can see the counters are moving, but hear no sound through the canal.

    Switch from Logic Pro X > Preferences > Audio > general

    Enable a software monitoring, disable the entry followed only for the track has worn and tracks active record

    Chris Crabtree wrote:

    Also, is there a way to get its default to saving in a folder rather than a package?

    Here, LPX "remembers" the last format selected, so if I save to a folder once, which will remain as the default.

    TDC

  • I downloaded the update and I can't open the package I need help?

    I downloaded the update and cannotopen software package, why? I need help...

    You have a desktop Mac Pro 2009 with OSX 10.6.3?

  • iPhone packaging 6

    Hello, I just bought an iPhone for my mother from a supplier in line 6.

    The packaging is different from what I had with my own iPhone 6 and since I don't have 100% confidence that

    I would like to know whether or not this packaging is an original Apple box an online provider.

    I checked the IMEI number at the back of the box and it looks OK, but before you open the box, I wanted to check.

    Thank you

    Check the serial number as well by going to this page: https://selfsolve.apple.com/agreementWarrantyDynamic.do

Maybe you are looking for

  • How to install windows 8 or 7 Sierra?

    Tried to install 7 or 8, since the installation of sierra what it messed my partitions where bootcamp windows 10, but now had to work I have to use an old Olympus Studio tool for project work/uni which works only on windows 7. It seems that apple has

  • Satellite M30X powers off the power when you touch the USB port

    Hello everyone, just registered and it is the first problem:As there is no general hardware forum, I post my problem here. I got it twice, my laptop(Product: Satellite M30X, Version: PSA72E - 008010GR) just went completely off. Motherboard: NorthBrid

  • 7 2800 slate

    I had slate 7 2800 little more than a year ago. I did a my orignial sent at the beginning of this year cause he wouldn't come on back. They sent me a refurbished on that one my Tablet crashed... They sent me another handed to nine one like last week.

  • finger 2 roll

    I have just boughed spectrum HP 360 but I want to reverse the direction of travel of the 2 finger, is it possible? I am unable to find it.

  • importing photos with a screen from damage.

    The screen of my iphone is not working, I can't see anything init, but it works ok, if I remember had to touch, how do I import pictures into my PC?