Question about creating multiple output  files from same query

I have a query like this:
select * from emp;
ename empno deptno
Scott 10001 10
Tiger 10002 10
Hanson 10003 20
Jason 10004 30
I need to create multiple output files in xml format for each dept
example:
emp_dept_10.xml
emp_dept_20.xml
emp_dept_30.xml
each file will have the information for employees in different departmemts.
The reason I need to do this is to avoid executing the same query 200 times for generating the same output for different departments. Please let me know if it is practically possible to do this.
Any input is greatly appreciated.
Thanks a lot!!

You can write a shell script to generate the multiple spools files for the same output. Below script may helps you.
#====================
#!/bin/bash
n=0
while [ $n -le 20 ]
do
n=`expr $n + 1`
sqlplus -s system/manager <<EOF
spool emp_dept_$n.xml
select count(1) from tab;
spool off
EOF
done
#====================

Similar Messages

  • Question about creating multiple XML files from same query

    I have a query like this:
    select * from emp;
    ename empno deptno
    Scott 10001 10
    Tiger 10002 10
    Hanson 10003 20
    Jason 10004 30
    I need to create multiple output files in xml format for each dept
    example:
    emp_dept_10.xml
    emp_dept_20.xml
    emp_dept_30.xml
    each file will have the information for employees in different departmemts.
    We are using DBMS_XMLGEN package to generate XML.
    The reason I need to do this is to avoid executing the same query 200 times for generating the same output for different departments. Please let me know if it is practically possible to do this.
    Any input is greatly appreciated.
    Thanks a lot!!

    one solution i can think of is to use SQLX operator instead of dbms_xmlgen.
    here is a sample example.
    declare
      l_xmltype xmltype;
      l_deptno  emp.deptno%type;
    begin
      for i in (select * from emp order by deptno)
      loop
        select xmlconcat(
                    xmlelement("ename", i.ename)
                   ,xmlelement("sal", i.sal)
                   ,xmlelement("detpno", i.deptno))
          into l_xmltype from dual;
        dbms_output.put_line(l_xmltype.GetClobVal());
      end loop;
    end;
    /Now here you can open the query once, keep writing to the file till the deptno
    is same, when the deptno changes, close the file and open a new file with new
    deptno and start writing.
    Note : in this way you will have to add the xmlprolog manually to each of the file which should not be an issue. after opening the file add the prolog string manually.
    Hope this helps.

  • How to create multiple output files using TrAX?

    I am new in this field. I'm trying to create multiple xml output files using TrAX. I have to parse a xml source file and output it to multiple xml files. My problem is that it only creates one output file and puts all the parsed data there. When i use saxon and run xsl and xml files, it works fine and creates multiple files...it has something to do with my java code...Any help is greatly appreciated.
    Here's my XSL file
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
    <xsl:template match="data_order">
    <data_order>
         <xsl:copy-of select="contact_address"/>
         <xsl:copy-of select="shipping_address"/>
         <xsl:apply-templates select="ds"/>
    </data_order>
    </xsl:template>
    <xsl:template match="ds">
    <xsl:variable name="file" select="concat('order', position(),'.xml')"/>
    <order number="{position()}" href="{$file}"/>
    <xsl:document href="{$file}">
    <xsl:copy-of select="."/>     
    </xsl:document>
    </xsl:template>
    </xsl:stylesheet>
    xml source file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE operation SYSTEM 'data_order.dtd'>
    <data_order job_id='00-00-000' origin='PM-ESIP'>
         <contact_address>
              <first_name>ssssss</first_name>
              <last_name>sssss></last_name>
              <phone>2323232</phone>
              <email>dfdfdsaf</email>
         </contact_address>
         <ds ds_short_name ='mif13tbs'>
              <output>
                   <media_format>neither</media_format>
                   <media_type>FTP</media_type>
                   <output_format>GIF</output_format>
              </output>
         </ds>
              <ds ds_short_name ='mif15tbs'>
              <output>
                   <media_format>neither</media_format>
                   <media_type>FTP</media_type>
                   <output_format>GIF</output_format>
              </output>
         </ds>
    </data_order>
    My java file
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import java.io.*;
    public class FileTransform {
    public static void main(String[] args)
    throws Exception {
    File source = new File(args[0]);
    File style = new File(args[1]);
    File out = new File(args[2]);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer t = factory.newTransformer(new StreamSource(style));
    t.transform(new StreamSource(source), new StreamResult(out));

    Saxon has specific extensions. In this case it is <xsl:document>. That looks like a standard XSLT element, but it actually isn't. The history behind it is this: There was a proposal to create a new version of XSLT, called XSLT 1.1. One of the new features of this version was to be this xsl:document element. The author of the Saxon product, Michael Kay, is one of the people on the W3C committee directing the evolution of XSLT, so he upgraded his product to implement XSLT 1.1. But then the committee decided to drop XSLT 1.1 as a recommendation. So that left Saxon in the strange position of implementing a non-existent extension to XSLT.
    The other outcome of this process was that XSLT (1.0) does not have a way of producing more than one output file from an input file. And so the short answer to your question is "Trax can't do that." However, XSLT 2.0 will be able to do that, although it is not yet a formal W3C recommendation, and when it does become one it will take a while before there are good implementations of it. (I predict that Saxon will be the first good implementation.)
    One of the problems with XML and XSLT is that what you knew a year ago is probably obsolete now, because of all the evolution going on. So being new in the field is not a disadvantage, unless you get stung by reading obsolete tutorials or magazine articles.

  • Multiple output files from single Request

    Hi guys
    i have one requirment,can we display multiple outputs files (multiple templates) for a single request .
    ie i have some banks ,if i run an request ,it will get the details of each bank details ,induadual template .
    let me know the solution for this one.
    thanks inadvance.

    Pl post details of OS, database and EBS versions.
    Pl elaborate on your requirements. Assuming you are using XML/BI Publisher, the physical output file will be a single file, but you can use XML/BI Publisher bursting features to separate out different outputs.
    How to Implement XML Publisher Bursting in 11.5.10.2?          (Doc ID 740428.1)
    How to Print Via Bursting Control File          (Doc ID 844276.1)
    HTH
    Srini

  • Create multiple external tables from same flat file ?

    using oracle 10g
    currently create many external tables like so..
    CREATE TABLE "XT_UNITS"
    "Q1_2012" VARCHAR2(25 BYTE),
    "Q2_2012" VARCHAR2(25 BYTE),
    "Q3_2012" VARCHAR2(25 BYTE),
    "Q4_2012" VARCHAR2(25 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "XE_FILES" ACCESS PARAMETERS ( records delimited BY newline
    skip 1 fields terminated BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES
    ARE NULL ) LOCATION ( 'xtunits.csv' ))
    is there any way I can use 1 flat file (csv) to populate many external tables ?
    maybe by section ?

    Jay wrote:
    using oracle 10g
    currently create many external tables like so..
    CREATE TABLE "XT_UNITS"
    "Q1_2012" VARCHAR2(25 BYTE),
    "Q2_2012" VARCHAR2(25 BYTE),
    "Q3_2012" VARCHAR2(25 BYTE),
    "Q4_2012" VARCHAR2(25 BYTE)
    ORGANIZATION EXTERNAL
    TYPE ORACLE_LOADER DEFAULT DIRECTORY "XE_FILES" ACCESS PARAMETERS ( records delimited BY newline
    skip 1 fields terminated BY ',' OPTIONALLY ENCLOSED BY '"' MISSING FIELD VALUES
    ARE NULL ) LOCATION ( 'xtunits.csv' ))
    is there any way I can use 1 flat file (csv) to populate many external tables ?
    maybe by section ?Not a logical question.
    An external table definition relates to one or more files.
    You could probably create multiple externable table definitions to access the same file(s), but you may end up with some operating system file locking issues if you're not careful, and to be honest why would you need to do that?

  • Question about using multiple iPods on the same PC

    I've read the FAQs on this subject but I still have a couple of questions about multiple users with separate iPods using the same PC.
    I want to use my family's desktop (A new Gateway with Vista, if it matters) for my new iPod Classic, but my father already has an iTunes account on there for his iPod. I know I can create a new user account on the PC and move iTunes to a shared folder so that we can share music, but will this second account be able to purchase music from the iTunes store or am I going to have to switch between Windows User accounts to make purchases and then move new songs into my separate iTunes account via the shared folder? Will it be its own separate iTunes account (separate user name, separate credit card used, etc.) or will it just be a second library that's dependant on the first?
    I want to be able to have my own iTunes account, make my own purchases in it, and maybe occasionally share tv shows or something with my father.
    If this can't be done, would I be better off just creating new playlists for our two iPods from the same library, or creating a second library on my Father's account?
    Also, if I want to access things I've purchased from iTunes on this desktop in iTunes on my notebook, will I be able to?
    I hope that made sense.
    Sorry if these seem like silly questions. This will be my first iPod as I'm really excited about the 160gig and want to know if these things are possible.
    Thanks in advance for any help

    Hi, Wes.
    Congratulations on your new iPod Classic and Welcome to the Apple Discussions.
    For no particular reason, let's answer your last question first ...
    ... if I want to access things I've purchased from iTunes on this desktop in iTunes on my notebook, will I be able to?
    The iTunes Store operates on a one download per purchase policy so you will have to copy the purchases from one computer to the other and make sure that you authorize the laptop to play the songs.
    As to your first question ...
    ... will this second account be able to purchase music from the iTunes store or am I going to have to switch between Windows User accounts to make purchases ...
    Whatever XP User Account you are logged in to doesn't really matter. What's important is which Apple Account you sign in to ... yours or your Dad's or - if you had my Apple ID and password - The Mimico Kid's for that matter. You can sign in to any Apple Account on any XP User Account. Or any computer for that matter.
    Where the XP User Account comes into play is that it will determine where on your computer the purchases are downloaded. Files will be sent to the iTunes Music folder as specified in the iTunes Edit menu > Preferences > Advanced tab > General sub-tab. Default settings will have a different location for each User Account - C:\Documents and Settings\ user name \My Documents\My Music\iTunes - but if you've read this article in the Apple Knowledge Base, you will know you can change the location of the iTunes Music folder in each XP Account to a common location such as C:\Documents and Settings\All Users\Documents\My Music\iTunes.
    Post back if all this hasn't been as clear as mud and you need anything clarified.

  • Creating multiple XML files from Schema

    We are extracting data from Oracle DB into XML using ODI. We are successful in generating the XML file, using command "create xmlfile <file name> from schema <Schema Name>, but the entire data comes in Single file.
    Our database schema is relatively Huge and we would like to generate multiple XML files. We want to generate one file per particular number of records. Can anyone help to do this.

    one solution i can think of is to use SQLX operator instead of dbms_xmlgen.
    here is a sample example.
    declare
      l_xmltype xmltype;
      l_deptno  emp.deptno%type;
    begin
      for i in (select * from emp order by deptno)
      loop
        select xmlconcat(
                    xmlelement("ename", i.ename)
                   ,xmlelement("sal", i.sal)
                   ,xmlelement("detpno", i.deptno))
          into l_xmltype from dual;
        dbms_output.put_line(l_xmltype.GetClobVal());
      end loop;
    end;
    /Now here you can open the query once, keep writing to the file till the deptno
    is same, when the deptno changes, close the file and open a new file with new
    deptno and start writing.
    Note : in this way you will have to add the xmlprolog manually to each of the file which should not be an issue. after opening the file add the prolog string manually.
    Hope this helps.

  • Create multiple pdf files from html pages

    I have 15 html pages that I need to convert (possibly several times a day) into pdf files, and I need to get the process as automated as possible. I own an Acrobat Pro 8 license.
    1) is there a command line I can launch to do this automatically?
    2) failing that, is there a way of launching several conversions at a time? There seems to be lot of talk about creating one pdf from several files, but what I want is to convert several html file into several pdf files
    thanks

    Managed it at last, was a bit of a hassle -
    (there was an erroneous error message saying I hadn't selected any files, when I had)
    Note For future readers: to do just a batch conversion, you have to ignore the "commands" section, which isn't intuitive, as it is bang in the middle and looks like the main feature...

  • Possible to create multiple pdf files from links?

    In Acrobat X Pro, is there a way to apply the option "create pdf file from link" to several links on the same website at once?.thanks

    About the closest you can get is to use the Tools > Document Processing > Web Capture > Append all links on page command, which will traverse the links and append them to your existing PDF that has been captured from a web site.

  • How to create multiple pdf files from multiple batch processing

    I have several file folders of jpeg images that I need to convert to separate multi-page pdf files. To give a visual explanation:
    Folder 1 (contains 100 jpeg image files) converted to File 1 pdf (100 pages; 1 file)
    Folder 2 (contains 100 jpeg image files) converted to File 2 pdf (100 pages; 1 file)
    and so on.
    I know I can convert each folder's content as a batch process, but I can only figure out how to do so one folder at a time. Is it at all possible to convert multiple folders (containing jpegs) to multiple pdf files? Put differently, does anyone know how to process a batch of folders into multiple (corresponding) pdf files?
    Many thanks.

    There are two approaches to do this:
    - First convert all JPG files to PDF files using a "blank" batch process. Then combine all PDF files in the same folder using another batch process and a folder-level script (to do the actual combining). I have developed this tool in the past and it's available here:
    http://try67.blogspot.com/2010/10/acrobat-batch-combine-all-files-in.html
    - The othe option is to do everything in a single process, but that requires an application outside of Acrobat, which I'm currently developing.
    If you're interested in any of these tools, feel free to contact me personally.

  • How can I create multiple PDF files from multiple InDesign files?

    I have 144 InDesign files that I need to create a PDF file for each. I do not want to open each InDesign file to create the PDF's. Acrobat Batch create won't open the InDesign files. Is there another way?

    Only InDesign can do this. You may want to look at InDesign automation.

  • Question about cropping multiple tracks at the same time

    Ok, here is the situation. My band jams reguarly, and I am recording 8 tracks concurrently.... each instrument gets their own mic/input.... typical band fare.
    The recording will last a solid 45-60 minutes before we break. In the meantime, there is plenty of downtime, and multiple songs.
    After the jam, I like to cut out the crap, bad takes, etc....
    I do this by editing the waveform of each track individually, selecting the 'good region'.... copying the section ... and pasting into a new track... I repeat this 8 times... once for each track....
    I then mute the original 8 tracks, move all the clips to timecode 0 and export to disk....
    Needless to say, this is very, very time consuming, and I would like some input about a better way to do this.
    Is it possible to select the same region across multiple tracks and copy/paste them into several new tracks? Or is it possible to define the 'playable region' of a larger region so that when I export, I am only exporting the region I am interested in?
    Ultimately, I want to produce an exported .m4a for each 'good take' which is nothing more than a subset of the larger 60 minute take....

    Have you tried selecting all tracks, then split at the beginning and ending of the "good take" then copy and paste it into a new GB file?

  • How do I create multiple text files from a list in another file?

    I have a text file with data in it:
    1. Bristol
    2. Bath
    3. Exeter
    etc
    I want to run an action which outputs the following files:
    1.txt (contents: 1 Bristol)
    2.txt (contents: 2.Bath)
    3.txt (contents: 3.Exeter)
    I can't work ou how to do this, any help appreciated. Thanks
    Dave

    Hi mate, thanks for the suggestion.  I saw that section in the user guide - but it is only for copying from one library to another - I want to copy from an FCP library to a file structure OUTSIDE FCP.  I have had problems with FCP losing media when copying to another library so I just want the files in the Finder where I can see them...
    Stephen

  • I have a question about exporting a music file from Express.

    Hi, I'm a new Logic Express user and I have a question.
    I have been using Garageband for some time and I figured I needed a higher level of music producing. Now, I have created a song in Logic Express. However, I DON'T KNOW HOW TO EXPORT IT! it was so much in GB. But Now, I'm having trouble. I looked through the manual more than once and I can't find a way to export my logic file as an Mp3 file.
    Can anyone help me? Thanks!
    -Justin
    PowerMac G5   Mac OS X (10.3.9)  

    In the file menu there is a BOUNCE option, when you bounce it you can set it to convert to an MP3 right there or you can do it in iTunes. Its up to you.

  • Creating multiple page files from PDF templates

    I have a PDF file that is 3 pages. When I create the 3 page template form through Acrobat 8 Forms,  and then it is placed in Lifecycle designer, I can save it. All of the fields that I create remain in the file. But, I cannot add another page (PDF template)  to this Lifecycle file. I have to go back to the original PDF file, add the page, and then import back into Lifecyle, and add back all of the fields. Can I just save a text file with the correct XML code, and then paste it back in after I add another page. I tried it, but didn't have much success.

    Yes it is possible,
    All you need to do is create 3 destinations each of type Flat file.
    For your data target link to the and Open Destinations1, link by creating a transformation. and while create DTP use filter A.
    Again for your data target link to the another Open Destination2, link by creating a transformation and while creating DTP use Filter B.
    similarly for Open Destination3,  use Filter C.
    Regards,Vj

Maybe you are looking for

  • Error occured in Log  PO169 savings plan under BADI

    Hi, When i am running a payroll for 03/15/2011 for one perner its showing error  in the log under po169 process savings plan under BADI  below is the error , how we can find BADI name  can any one help me Error occured during currency conversion from

  • Creating an Alert on a Parameter

    Hello, I have a parameter that is defined as a range and I want to limit the user to only enter or select up to 4 enteries, how do I set up an alert to accomplish this?  I have tried HasUpperBound with no success, any help will be greatly appreciated

  • A very big problem !!!

    Hi everybody I don't now why, all was ok, and today, logic quit inopinement !!! I try safe mode ... Nothing. If you can look at this please . It's my job, I'm apple trainer on logic 9 but i don't understand ??!! Than you Jean-marc www.sephiramusica.c

  • How to create application to click the corner to turn a page of a book

    Hi all, Please advise how to click the corner to turn a page of a book, like http://www.mixbook.com/books?bid=372858 Please kindly advise and give the example. Regards, Billy

  • A number will no - work on -his compu-er anymore.

    af er S and before U. Le --er _ will no- work anymore. I hope you can read -his. do you know how I can fix -his