Need to remove the tags file Nullable while generating XML files

Hello.

I have a requirement where I have to generate an XML file, but the generated XML file does not display the tags when the column is null. An example below:

CREATE TABLE emp_tab (emp_id NUMBER PRIMARY KEY
name VARCHAR2 (20).
dept_id NUMBER);
Table created.
INSERT INTO emp_tab VALUES (30, 'Scott', NULL);
1 line of creation.
INSERT INTO emp_tab VALUES (31, 'Mary', NULL);
1 line of creation.
INSERT INTO emp_tab VALUES (40, 'John', NULL);
1 line of creation.
COMMIT;

When I generate the XML code, you can find the output like below:
< EMPLOYEE >
< EMP_ID > 30 < / EMP_ID >
Scott < NAME > < / NAME >
< / EMPLOYEE >

I just the Worklfow Developer's Guide and the example above was taken from Page 561 and 562 by looking at the DBMS_XMLGEN.setNullHandling using DBMS_XMLGEN procedure. DROP_NULLS as a parameter.

Now, I understand the concept, but my requirement is a little different. I get a record as my procedure parameter PLSQL type, but requires the choice of a base table, which means maybe I have to insert first the folder I get as parameter in a table of basic and then select in the same when you set the context, which is what I don't want in the DBMS_XMLGEN.newContext. This is an additional burden.

I've previously planned to use XMLELEMENT and XMLFOREST to generate the XML file (and was rather more simple), but this requirement to remove the tags altogether when the values are NULL led me to believe that maybe I might have to go down the path of using the API DBMS_XMLGEN.

Can you suggest a better way, replacement to achieve what I want? Or perhaps give an example on how I can get there using XMLDB?


Thank you and best regards,
JD

Can I use just the XMLElement and XMLForest to achieve?

Sure. As said, XMLForest does not create elements for NULL values:

http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/xdb13gen.htm#ADXDB5006

If the expression value is null, then no element is created for this expression.

This is the code I wrote your above mentioned suggestion discussion forum

Yes, but this solution is taken out of context.
Here, it is obviously preferable to not generate empty items in the first place:

SELECT XMLElement("Address"
       , XMLForest(
           lr_addr_rec.account_name     as "AccountName"
         , lr_addr_rec.address_line_1   as "Addressline1"
         , lr_addr_rec.lot_number       as "Addressline1"
         , lr_addr_rec.address_city     as "City"
         , lr_addr_rec.address_state    as "State"
         , lr_addr_rec.address_postcode as "PostCode"
         )
       )
FROM dual;

Tags: Database

Similar Questions

  • I need to remove the uneeded files: Purenetworks and PCFix. But I get: not deletenmrsrc.dll: access denied make sure the disk is not full or write protected and that the file is not in use.

    Original title: remove unnecessary files

    I need to remove the uneeded files: Purenetworks and PCFix. But I get: not deletenmrsrc.dll: access denied make sure the disk is not full or write protected and that the file is not in use.

    Ditto for PCFIX.exe.

    How can I remove these and clean unnecessary files? Thank you.

    Hello

    1. how exactly you are trying to remove it?
    2 have you connected the administrator account?

    Step 1: Check if the problem persists in the clean boot state.

    From your computer by using a minimal set of drivers and startup programs so that you can determine if a background program is interfering with your game or program. This type of boot is known as a "clean boot".

    Reference:

    How to configure Windows XP to start in a "clean boot" State

    http://support.Microsoft.com/kb/310353

    When you are finished troubleshooting, follow these steps to reset the computer to start as usual:

    1. click on start and then click Run.

    2. type msconfig and click OK.

    The System Configuration Utility dialog box appears.

    3. click on the tab general, click Normal Startup - load all services and device drivers and then click OK.

    4. When prompted, click on restart to restart the computer.

    Step 2: Take possession of these program at the following location folder, and then check the issue. C:\Program Files\ 

    Reference: How is ownership of a file or a folder in Windows XP

  • I need to remove the program files o to send to:

    original title:?

    I need to remove the program files o to send to:

    I need to remove the program files o to send to:

    You want to remove entries from the right-click send to menu?

    If so, click on the round of Windows (start), type shell: sendto and hit enter. To remove a shortcut, right-click and choose Remove.

  • You need to remove the XML tag... Having the same element

    Hello guys,.

    need help, im having trouble removing the tag < EVENT [elem = 6] >

    < EVENTS elem = "6" >

    < FROM_CODE / >

    < PROMO_ID / >

    < TO_CODE / >

    < TELCO_INFO >

    < CALLED_TO > 0063 < / CALLED_TO >

    < CALLING_FROM > 63937390517 < / CALLING_FROM >

    < / TELCO_INFO >

    < GSM_INFO >

    < Indicated / >

    < USAGE_TYPE > DATA < / USAGE_TYPE >

    < / GSM_INFO >

    < START_T > 20/11/2015 22:08 < / START_T >

    < END_T > 20/11/2015 22:08 < / END_T >

    < BAL_IMPACTS elem = "0" >

    < AMOUNT > 0.89 < / AMOUNT >

    < IMPACT_TYPE > 258 < / IMPACT_TYPE >

    < QUANTITY > 103229 < / QUANTITY >

    < RATE_TAG / >

    VAT < TAX_CODE > < / TAX_CODE >

    < / BAL_IMPACTS >

    < BAL_IMPACTS elem = "1" >

    < AMOUNT > 0.11 < / AMOUNT >

    < IMPACT_TYPE > 4 < / IMPACT_TYPE >

    < QUANTITY > 0.89 < / QUANTITY >

    < RATE_TAG / >

    VAT < TAX_CODE > < / TAX_CODE >

    < / BAL_IMPACTS >

    < elem TOTAL = "608" >

    < AMOUNT > 1 < / AMOUNT >

    < / TOTAL >

    < AMOUNT_GROSS > 1 < / AMOUNT_GROSS >

    < AMOUNT_TAXED > 0.89 < / AMOUNT_TAXED >

    < / EVENTS >

    < EVENTS elem = "6" >

    < SYS_DESCR > Cycle before expenses (rev): 549 DUAL-DEF < / SYS_DESCR >

    < BAL_IMPACTS elem = "0" >

    < QUANTITY > 1 < / QUANTITY >

    Plan < RATE_TAG > < / RATE_TAG >

    < AMOUNT > 490,18 < / AMOUNT >

    < IMPACT_TYPE > 1 < / IMPACT_TYPE >

    VAT < TAX_CODE > < / TAX_CODE >

    < / BAL_IMPACTS >

    < BAL_IMPACTS elem = "1" >

    < QUANTITY > 549 < / QUANTITY >

    Plan < RATE_TAG > < / RATE_TAG >

    < AMOUNT > - 490.18 < / AMOUNT >

    < IMPACT_TYPE > 32 < / IMPACT_TYPE >

    < TAX_CODE > VTSKY < / TAX_CODE >

    100% of < DISCOUNT_INFO > < / DISCOUNT_INFO >

    < / BAL_IMPACTS >

    < BAL_IMPACTS elem = "2" >

    < QUANTITY > 490,18 < / QUANTITY >

    Tax of < RATE_TAG > < / RATE_TAG >

    < AMOUNT > 58,82 < / AMOUNT >

    < IMPACT_TYPE > 4 < / IMPACT_TYPE >

    VAT < TAX_CODE > < / TAX_CODE >

    < / BAL_IMPACTS >

    < BAL_IMPACTS elem = "3" >

    < QUANTITY > - 490.18 < / QUANTITY >

    Tax of < RATE_TAG > < / RATE_TAG >

    < AMOUNT > - 58.82 < / AMOUNT >

    < IMPACT_TYPE > 4 < / IMPACT_TYPE >

    < TAX_CODE > VTSKY < / TAX_CODE >

    < / BAL_IMPACTS >

    < elem TOTAL = "608" >

    < AMOUNT > 0 < / AMOUNT >

    < / TOTAL >

    < CYCLE_START_T > 20/12/2015-00:00:00 < / CYCLE_START_T >

    < CYCLE_END_T > 20/01/2016 00:00:00 < / CYCLE_END_T >

    < START_T > 20/12/2015-00:00:00 < / START_T >

    < END_T > 20/12/2015-00:00:00 < / END_T >

    < AMOUNT_GROSS > 490,18 < / AMOUNT_GROSS >

    < AMOUNT_TAXED > 0 < / AMOUNT_TAXED >

    < / EVENTS >

    in my XML file, it apprear 2 < elem = 6 EVENTS > but you just have to remove the entire < elem = 6 EVENTS > with < SYS_DESC >.

    Thanks in advance.

    Your XML file is invalid because it is not an outside element.  In any case, after that...

    with Data (THE_XML) as)

    Select xmltype (')

    0063

    63937390517

    DATA

    20/11/2015-22:08

    20/11/2015-22:08

    0.89

    258

    103229

    VAT

    0.11

    4

    0.89

    VAT

    1

    1

    0.89

    Cycle advance costs (rev): DUAL-DEF 549

    1

    Plan

    490,18

    1

    VAT

    549

    Plan

    -490.18

    32

    VTSKY

    100% discount

    490,18

    Tax

    58,82

    4

    VAT

    -490.18

    Tax

    -58.82

    4

    VTSKY

    0

    20/12/2015-00:00:00

    20/01/2016 00:00:00

    20/12/2015-00:00:00

    20/12/2015-00:00:00

    490,18

    0

    ')

    of the double

    )

    Select deletexml (the_xml, "/ ROOT/EVENTS[@elem="6 "and SYS_DESCR]')

    from the data

    (As requested) RESULT

    0063

    63937390517

    DATA

    20/11/2015-22:08

    20/11/2015-22:08

    0.89

    258

    103229

    VAT

    0.11

    4

    0.89

    VAT

    1

    1

    0.89

  • If I reinstall the original software, which removes the existing files from my hard drive?

    I accidentally deleted programs that my computer needs access to the Internet.  I tried the system restore, but nothing.  Can I re - install the original software without compromising documents on the hard drive?

    Thank you

    Jill

    Hi Jill,

    Yes, reinstall the programs would not remove the existing files on your hard drive. Your old files remain unchanged

  • "How to remove the cookie file.

    Win vista Home / Prem 32.

    Surfing the net last night at 3:45 a file appeared in the cookies folder is 3 k in size and when I tried to open it the answer was "access denied" after a lot of searching and trying some old win 3.1, 95, 98 tips same thicket home with XTREE GOLD still could not access.

    Renamed the CookieX cookie folder and made a new Cookie file and finished my research I was doing and turns off the computer.

    Today I see the file disappeared, but I need to remove the CookieX folder and cannot.

    Is the way to remove this folder?

    Thanks for your help

    Hi Bob351,

    Have you tried using disk cleanup?  Please take a look at the article here with information and instructions on how to use it to remove items.

    I hope this helps!

  • I need to remove the old version of windows easy transfer to install a new... How can I do this

    I recently got a new laptop and I need to transfer my files to my computer windows vista to windows 7, but I need to remove the transfer windows easy off vista to install the new Windows 7... How can I do this. its driving me crazy

    You cannot remove the Windows program like that... Windows 7 easy transfer to restore.

  • Prime Minister 9. I made a mistake when I did drag an audio file in the line of the image. How to remove the audio file. I tried ctrl z and shift delete nothing done.

    Using Adobe Elements 9 first, I made a mistake when I did drag an audio file in the line of the image.

    How can I delete this audio file? I tried ctrl z and shift delete. software has the ' delete the scene and all of the properties in gray. Just "delete scene only" it and it does nothing to remove the audio file.  I had to drag the line from the soundtrack.

    Who can help me?

    LinFos04

    What you wrote, it seems that you are in the scene of Premiere Elements 9.0/9.0.1 workspace.

    Please see screenshot showing you how to remove the audio immediately after you dragged in the film that had been marked "Drag the next clip here"

    Moving forward consider working in the workspace of timeline that gives you a better view of what is happening and therefore gives you more control over the flow of work. Please click chronology to watch how this audio present in the workspace of chronology after what you did in the space of the stage line.

    Please let us know if it worked to get rid of the audio unwanted in the Premiere Elements 9.0/9.0.1 workspace sceneline.

    For any question or need more information on the above, please ask.

    Thank you.

    RTA

  • Adobe first is not recognize my I need to edit the flv files.

    Adobe first is not recognize my I need to edit the flv files. Flv files are not an Adobe creation?

    This should be fixed!

    What I can do in the interem... and no, I DON'T want to convert the files to another format.

    Welcome to the forum.

    What PrPro version do you use?

    FLV Import support has been removed from PrPro recently - * think * it was with on the second update to CS6, but others can check the exact time it was deleted.

    Good luck

    Hunt

  • Find, edit, and remove the tag XML (Adobe InDesign Server CS5)

    Hi all

    I work with Indesign CS5 server and JavaScript, although having some difficulties to come with a solution to a problem...

    I have to build a script JS (called through SOAP) that will allow me to search for an XML tag in an InDesign file.

    After you find the XML tag, if the variable 'action' is set to remove, it should remove the tag and its content.

    If the action is set to edit, he should change the content of the tag to the user-defined content.

    The main warning is that the XML tag is variable, as is the XML of the InDesign file structure.

    Here's what I have in mind, in pseudocode:

    function findXMLTag (tag, action) {}

    app.searchForTag (tag);

    If {(tagIsFound)

    If (action == 'delete') {}

    tag. Delete;

    } Else if (action == 'edit') {}

    tag.contents = "update content";

    }

    }

    }

    Any help would be greatly appreciated!

    Thank you

    Ben Kay

    'searchForTag' can be implemented as a recursive function.

    Recursion is defined as follows: I thought: "I'll just get this forum for"recursion"." The first post I found was one of my own, which suggests that the poster should search the forum for "recursion".

    Here is an example: find the XML element []

    And another: remove the xml using JS [CS3] element (read carefully, as the OP is stuck on how to remove an item and continue successfully)

    And the other using XML rules - which I am quite familiar with, but may work for you: changing values in XML tags

  • How can tag photos - I remove the 'Tag' because it's in every picture!

    Remember - this is a public forum so never post private information such as numbers of mail or telephone!

    Ideas: How can I remove the "Tag" I didn't tag each photo. I thought that I have WAS MARKING ALONE.  I can't get rid of the label on each photo

    • You have problems with programs
    • Error messages
    • Recent changes to your computer
    • What you have already tried to solve the problem

    Right click on the tag in the left pane, click on remove, then click Yes. (Windows Photo Gallery)

    Click on the descriptive tag, click on manage tags, right click on the tag you want to delete, then click on delete and then Yes. (Windows Live Photo Gallery)

    teengeek.freehostingcloud.com

  • PC DM files: my hard drive is currently filled by PC DM files in my folder/Public user folder. How can I safely remove the right files in this folder?

    My hard drive is currently filled by PC DM files in my folder/Public user folder.  How can I safely remove the right files in this folder?  Vista Home Premium 64 bit is my os.

    Hi templar_39,

    DM (Message Delivery) file types are not Windows files, they can be generated by a third-party program.

    This particular file type is often associated with audio data and can be hosted on some cell phones to be used as ringtones or multimedia clips. To my knowledge, these files can be generated by your mobile phone.

    Note: you can go ahead and remove these files only if you notice that the files do not contain any important information.

    If this happens without connect you all devices (like mobile PHONES), this may be a virus or malware activity. You can run a virus scan to get rid of them

    Step 1: A scanner online for any threat and try to correct

    http://OneCare.live.com/site/en-us/Center/cleanup.htm

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • account users: I need to remove the old user accounts

    I need to remove the old user accounts

    http://www.Vistax64.com/tutorials/93026-user-account-delete.html

    Read the tutorial above.

    http://www.tech-recipes.com/Rx/2054/vista_how_to_delete_user_account/

    And meanings, too.

    The information above should solve the problem for you.

    See you soon.

    Mick Murphy - Microsoft partner

  • Remove the uninstallation files after an upgrade

    After an upgrade to Windows XP, I used to remove the uninstall files in the system directory.


    Is it possible to do it on Vista?

    Windows Update Forum:

    It comes with Vista, upgrade install and activate Forum.

    You will get the best help for any update/Service Pack problem or issue in the Windows Update Forum; the link below:

    http://social.answers.Microsoft.com/forums/en-us/vistawu/threads

    See you soon.

    Mick Murphy - Microsoft partner

  • I can't open the system when he was sht down. But the system was the heat and I have to remove the battery for a while and it should re-sttart, what the problem.

    I can't open the system when he was sht down. But the system was the heat and I have to remove the battery for a while and it should re-sttart, what the problem.

    Too generic a question, can you clarify considerably more for us? Your question could be reformulated in the following way and always be true?

    "I can't start my computer once he has had a BSOD. Something overheated, but I don't know. I removed the CMOS battery and replaced in order to asure me that a bad overclock on a core component has not caused the problem. Now, it restarts correctly, what is / was the problem? »
    The foregoing, what I thought you meant. The above statement is correct?

Maybe you are looking for