How do I use UTL_FILE to insert a large number of fields to a file?

Hi
I am trying to use UTL_FILE for the first time in a Stored Procedure. I need to run a complex query to select 50 fields from various tables. I need these to be inserted into one line in the output file for all rows. Is this possible? My procedure so far is like the following
CREATE OR REPLACE PROCEDURE PROC_TEST IS
output_file UTL_FILE.FILE_TYPE;
BEGIN
FOR query in (SELECT FIELD1, FIELD2, ..........FIELD50)
FROM TABLE A, TABLE B
WHERE A.ID = B.ID
ETC
LOOP
UTL_FILE.PUT_LINE(output_file, <put all 50 fields for all records into file> );
END LOOP;               
UTL_FILE.FCLOSE (output_file);
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
     UTL_FILE.FCLOSE_ALL;
RAISE;
END PROC_TEST;
Do I need to define 'query' (after the FOR) anywhere, also please advise with how I put all of the fields into the file.
Thanks
GB

Thanks Steve,
I have the UTL_FILE working fine now.
I have other queries to run and conditions to apply in the same procedure, and I need to schedule via Enterprise Manager, therefore using UTL_FILE in a procedure seemed the best option. I looked up Data-pump but this seems to be an 11g feature, and we are still on 10g therefore I will not be able to use it.
Thanks for your help.
GB

Similar Messages

  • How can I use multiple row insert or update into DB in JSP?

    Hi all,
    pls help for my question.
    "How can I use multiple rows insert or update into DB in JSP?"
    I mean I will insert or update the multiple records like grid component. All the data I enter will go into the DB.
    With thanks,

    That isn't true. Different SQL databases have
    different capabilities and use different syntax, That's true - every database has its own quirks and extensions. No disagreement there. But they all follow ANSI SQL for CRUD operations. Since the OP said they wanted to do INSERTs and UPDATEs in batches, I assumed that ANSI SQL was sufficient.
    I'd argue that it's best to use ANSI SQL as much as possible, especially if you want your JDBC code to be portable between databases.
    and there are also a lot of different ways of talking to
    SQL databases that are possible in JSP, from using
    plain old java.sql.* in scriptlets to using the
    jstlsql taglib. I've done maintenance on both, and
    they are as different as night and day.Right, because you don't maintain JSP and Java classes the same way. No news there. Both java.sql and JSTL sql taglib are both based on SQL and JDBC. Same difference, except that one uses tags and the other doesn't. Both are Java JDBC code in the end.
    Well, sure. As long as you only want to update rows
    with the same value in column 2. I had the impression
    he wanted to update a whole table. If he only meant
    update all rows with the same value in a given column
    with the same value, that's trivial. All updates do
    that. But as far as I know there's know way to update
    more than one row where the values are different.I used this as an example to demonstrate that it's possible to UPDATE more than one row at a time. If I have 1,000 rows, and each one is a separate UPDATE statement that's unique from all the others, I guess I'd have to write 1,000 UPDATE statements. It's possible to have them all either succeed or fail as a single unit of work. I'm pointing out transaction, because they weren't coming up in the discussion.
    Unless you're using MySQL, for instance. I only have
    experience with MySQL and M$ SQL Server, so I don't
    know what PostgreSQL, Oracle, Sybase, DB2 and all the
    rest are capable of, but I know for sure that MySQL
    can insert multiple rows while SQL Server can't (or at
    least I've never seen the syntax for doing it if it
    does).Right, but this syntax seems to be specific to MySQL The moment you use it, you're locked into MySQL. There are other ways to accomplish the same thing with ANSI SQL.
    Don't assume that all SQL databases are the same.
    They're not, and it can really screw you up badly if
    you assume you can deploy a project you've developed
    with one database in an environment where you have to
    use a different one. Even different versions of the
    same database can have huge differences. I recommend
    you get a copy of the O'Reilly book, SQL in a
    Nutshell. It covers the most common DBMSes and does a
    good job of pointing out the differences.Yes, I understand that.
    It's funny that you're telling me not to assume that all SQL databases are the same. You're the one who's proposing that the OP use a MySQL-specific extension.
    I haven't looked at the MySQL docs to find out how the syntax you're suggesting works. What if one value set INSERT succeeds and the next one fails? Does MySQL roll back the successful INSERT? Is the unit of work under the JDBC driver's control with autoCommit?
    The OP is free to follow your suggestion. I'm pointing out that there are transactions for units of work and ANSI SQL ways to accomplish the same thing.

  • How can i use BAPI to insert a few records  into standard table

    Can anyone help me with how can i use BAPI to insert some records into a standard table from an internal table?

    Hi,
    First of All try to Explain your Question first.
    This is a general question without mentioning the Table you want to Update.
    Please give the details before posting a question  so it will help people to understand your Problem.
    Regards
    Sandipan

  • Analyze table after insert a large number of records?

    For performance purpose, is it a good practice to execute an 'analyze table' command after inserting a large number of a records into a table in Oracle 10g, if there is a complex query following the insert?
    For example:
    Insert into foo ...... //Insert one million records to table foo.
    analyze table foo COMPUTE STATISTICS; //analyze table foo
    select * from foo, bar, car...... //Execute a complex query whithout hints
    //after 1 million records inserted into foo
    Does this strategy help to improve the overall performance?
    Thanks.

    Different execution plans will most frequently occur when the ratio of the number of records in various tables involved in the select has changed tremendously. This happens above all if 'fact' tables are growing and 'lookup' tables stayed constant.
    This is why you shouldn't test an application with a small number of 'fact' records.
    This can happen both with analyze table and dbms_stats.
    The advantage of dbms_stats is, it will export the current statistics to a stats to table, so you can always revert to them using dbms_stats.import_stats.
    You can even overrule individual table and column statistics by artificial values.
    Hth
    Sybrand Bakker
    Senior Oracle DBA

  • How to show data from a table having large number of columns

    Hi ,
    I have a report with single row having large number of columns . I have to use a scroll bar to see all the columns.
    Is it possible to design report in below format(half columns on one side of page, half on other side of page :
    Column1
    Data
    Column11
    Data
    Column2
    Data
    Column12
    Data
    Column3
    Data
    Column13
    Data
    Column4
    Data
    Column14
    Data
    Column5
    Data
    Column15
    Data
    Column6
    Data
    Column16
    Data
    Column7
    Data
    Column17
    Data
    Column8
    Data
    Column18
    Data
    Column9
    Data
    Column19
    Data
    Column10
    Data
    Column20
    Data
    I am using Apex 4.2.3 version on oracle 11g xe.

    user2602680 wrote:
    Please update your forum profile with a real handle instead of "user2602680".
    I have a report with single row having large number of columns . I have to use a scroll bar to see all the columns.
    Is it possible to design report in below format(half columns on one side of page, half on other side of page :
    Column1
    Data
    Column11
    Data
    Column2
    Data
    Column12
    Data
    Column3
    Data
    Column13
    Data
    Column4
    Data
    Column14
    Data
    Column5
    Data
    Column15
    Data
    Column6
    Data
    Column16
    Data
    Column7
    Data
    Column17
    Data
    Column8
    Data
    Column18
    Data
    Column9
    Data
    Column19
    Data
    Column10
    Data
    Column20
    Data
    I am using Apex 4.2.3 version on oracle 11g xe.
    Yes, this can be achieved using a custom named column report template.

  • How do I create new versions of a large number of images, and place them in a new location?

    Hello!
    I have been using Aperture for years, and have just one small problem.  There have been many times where I want to have multiple versions of a large number of images.  I like to do a color album and B&W album for example.
    Previously, I would click on all the images at one, and select new version.  The problem is this puts all of the new versions in a stack.  I then have to open all the stacks, and one by one move the new versions to a different album.  Is there any way to streamline this proccess?  When it's only 10 images, it's no problem.  When it's a few hundred (or more) its rather time consuming..
    What I'm hoping for is a way to either automatically have new versions populate a separate album, or for a way to easily select all the new versions I create at one time, and simply move them with as few steps as possible to a new destination.
    Thanks for any help,
    Ricardo

    Ricardo,
    in addition to Kirby's and phosgraphis's excellent suggestions, you may want to use the filters to further restrict your versions to the ones you want to access.
    For example, you mentioned
      I like to do a color album and B&W album for example.
    You could easily separate the color versions from the black-and-white versions by using the filter rule:
    Adjustment includes Black&white
         or
    Adjustment does not include Black&white
    With the above filter setting (Add rule > Adjustment includes Black&White) only the versions with Black&White adjustment are shown in the Browers. You could do similar to separate cropped versions from uncropped ones.
    Regards
    Léonie

  • How to give out a status message indicating the number of fields selected

    Hi experts,
    I hope some one might have done what I'm trying to do. Could some one please show me how to give out a status message saying for example how many fields have been give out(or selected) in the t_ouput in an alv grid? Is there a FM that could do this? I mean like giving the FM the t_output and it will show a status message with the number of fields selected?
    Thank you for your input.
    Nadin
    Message was edited by:
            nadin ram

    Hi Ram,
    Write this code,
    Message 'Select Only Ten Fields' type 'I'.
    It displays The Message in Message Box.
    Or if you want the Error Message means,
    Message 'Select Only Ten Fields' type 'E'.
    Thanks,
    reward If Helpful.

  • How do I use jstl  to insert  links that passes sql info?

    Hi all,
    I'm using JSTL with sql and I want to create a link for every row so that the link would also contain the item in the first column of every row. But I keep getting stuck at saving the value. This is what I've tried:
    <c:set var="myName" value="test" scope="page"/>
    <tr>
    <c:forEach var="row" items="${name.rowsByIndex}">
         <tr>
    <c:forEach var="column" items="${row}">
         <c:if test="row =='uname'">
              <c:set var="myName" value="${column}"/>
         </c:if>
         <td>myName=<c:out value="${pageScope.myName}"/>"> <c:out value="${column}"/> </td>
    </c:forEach>
    </tr>
    </c:forEach>
    I either get a link of "edit.jsp?uName=$myName".
    Any ideas would be appreciated.
    Chris

    Introducing the <c:url> and <c:param> tags!
    <c:url value="edit.jsp">
      <c:param name="uName" value="${myName}"/>
    </c:url>Why the nested loops? When does row=='uname'? Could that ever occur?
    If you are after a specific column why not have one loop over ${name.rows} and get ${row.uname}?
    What server are you using?
    What version of JSTL?
    What is the taglib import you have made?

  • How can i use BAPI to insert a few records into standard table usobt_c

    I needed to compare the records of this table on two different systems and update the records that were in system A but not in system B into system B. Please give your inputs.

    Hi,
    First of All try to Explain your Question first.
    This is a general question without mentioning the Table you want to Update.
    Please give the details before posting a question  so it will help people to understand your Problem.
    Regards
    Sandipan

  • How do I use SQL statements to perform calculations with form fields????

    Please help!!! I don't know how to use a SQL statement within my APEX form......
    My form is below. The user will enter the values in the form. Click on Submit. Then we need to run a SQL select statement with those values.
    Our form looks like this:
    Start_Date ____________
    Per_Period ____________
    Period ____________
    [Submit Button]
    The user will enter these 3 values in the form.
    This is an example of an user providing the values:
    Start_Date 03/14/08_______
    Per_Period $200.00________
    Period 4____________
    [Submit Button]
    Then they will click the Submit Button.
    The SQL statement (BELOW) returns output based on the users selections:
    START_DATE PER_PERIOD PERIOD
    14-MAR-2008 00:00 200 Week 1 of 4
    21-MAR-2008 00:00 200 Week 2 of 4
    28-MAR-2008 00:00 200 Week 3 of 4
    04-APR-2008 00:00 200 Week 4 of 4
    Total 800
    This is the full text of the SQL that makes the output above:
    with criteria as (select to_date('03/14/08', 'mm/dd/rr') as start_date,
    4 as periods,
    'Week' as period,
    200 per_period from dual),
    periods as (select 'Week' period, 7 days, 0 months from dual
    union all select 'BiWeek', 14, 0 from dual
    union all select 'Month', 0, 1 from dual
    union all select 'ByMonth', 0, 2 from dual
    union all select 'Quarter', 0, 3 from dual
    union all select 'Year', 0 , 12 from dual
    t1 as (
    select add_months(start_date,months*(level-1))+days*(level-1) start_date,
    per_period,
    c.period||' '||level||' of '||c.periods period
    from criteria c join periods p on c.period = p.period
    connect by level <= periods)
    select case grouping(start_date)
    when 1 then 'Total'
    else to_char(start_date)
    end start_date,
    sum(per_period) per_period,
    period
    from t1
    group by rollup ((start_date, period))
    THANKS VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    You're just doing a parameterized report, where the input fields are your parameters.
    Check out the Advanced Tutorial titled Parameterized Report here:
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/rprt_query.htm#BGBEEBJA
    Good luck,
    Stew

  • How do I use the same preset on a number of photos?

    I have imported a preset and want to use it on several photos in the same folder.  How do I do this? I cant seem to see the option when I try to sync them.

    Also in the Develop Module, select the files you wish to make the same changes in the film strip. Then in the lower right corner there is an option to change the sync function to auto sync. With Auto Sync active any develop changes made (including presets) will be applied to all the selected images.
    Important: When you finish using this feature make sure you turn it off, if not whenever you select multiple images it will be active again.

  • How can I use iCloud just as Dropbox e.g. (having access to saved files from several devices)?

    I want to have access to some PDF's and pictures for example on my iPad when i saved it to iCloud on my MacBook. Is that possible? How? (Sry for my bad English, I'm from Germany and didn't use iCloud before )

    iCloud does not offer a generic file storage facility.
    Try using an alternative service such as Dropbox, GoogleDrive, OneDrive, SugarSync, Box etc. which does offer this facility.

  • How do you use a drop down menu to populate other fields?

    I am creating a PDF that upon choosing from a list of People their address, phone, etc will automatically come in the remaining fields, or if a new person is choosen than you can add names address phone and it will save for future referrence ?
    Any help would be appreciated,
    THank you

    Thanks for your comment.
    Try doing this:
    Connect the form to a database and bind the fields in the form to the associated nodes in the data source so the data values automatically appear in the bound fields when a name is selected in the list.
    Add scripting to the list of names so the associated fields for address and phone number appear only when the user enters a new name and needs the other fields to enter new data.
    If that doesn't work, please provide more information about what you are trying to do. For example, here are a few questions to consider:
    Q. What object are you using for the list?
    Q. You say you want to be able to choose a person from a list of People, and their address, phone, etc automatically appears in the remaining fields address and phone number. What do you mean by etc. That is, exactly what objects are you planning to use for the other fields, and how many fields are there in total?
    Q. Is your form connected to a data base, which can supply the data values for the address and phone number fields.
    Q. What do you mean by 'a new person is chosen'. Normally the options on a list are pre-determined and added when you create the form. Do you want users to be able to add a new name to the list, and then enter that person's address and phone number in some adjacent fields?
    Have a look at these sections in the Help to gain a better understanding of what's involved:
     Working with Data Sources
    http://livedocs.adobe.com/livecycle/8.2/acrobat_designer/000844.htmlhttp://livedocs.adobe.com/livecycle/8.2/acrobat_designer/000844.html 
    Buildling actions in forms
    http://help.adobe.com/en_US/livecycle/9.0/designerHelp/000109.html#1627696 
    Thanks,
    Drew

  • I recently bought a new iMac as well as a wireless time capsule and have it connected how can I use this external drive as the location to store all my files for iTunes, or is this even possible?

    New iMac user here, I recently bought a new iMac and Time capsule and have the whole network up and running now. I have connected another external HD to the time capsule as well and have a total of 3 TB of storage connected wireless to my new iMac. My question is can I use this location as the default location for iTunes?  I doubt I am gonna run out of room considering the iMac has 1 TB of storage already, but I'd prefer to keep my movies and music off the Mac to keep it running smoothly. If this is possibly, I'd like to do this with iPhoto as well. 

    I would advise against placing your iTunes library on a Time Capsule.
    The Time Capsule is designed as a backup device and not for wireless streaming of video.
    Before you do anything more, can I suggest you put into place a reliable, redundant backup strategy.
    Unless you are prepared to risk loss of your iTunes library due to a hard drive failure, I would not put iTunes on the Time Capsule.
    Leave your iTunes library on your iMac until such time as your internal drive is full. Backup to Time Capsule using Time Machine and create a clone of your internal iMac HD to your external drive.
    That's my 2 cents worth. Others may have a different opinion.

  • I activated a gift card and have a credit of $16. when I go to buy a song it asks for the number on the card which I don't have anymore as I have already activated it.  How can I use my credit without the card number.

    I would like to know how to buy a song with a credit from a gift card that shows on my account, but when I go to buy a song they want the card number.  I no longer have the card as I discarded it when the credit showed on my account. 

    Hi ...
    If the total purchase price exceeds the balance of a redeemed card, then the difference is charged to a credit or debit card account.
    You need to take into account the purchase price including any applicable taxes or fees > iTUNES STORE - TERMS AND CONDITIONS

Maybe you are looking for

  • Administrative Rights Segregation

    I'm working with BPM 11.1.1.5.0. Does anyone know of a way to segregate administrative rights in the workspace such that only certain users can manipulate role membership, others can manipulate task configurations, others can manipulate calendaring,

  • Fiscal Year Calculation

    I need to set the start of year to a different date than 01/01/. Lets say I want to set the start date of the year to 23-02. I want the java calendar classes to return the fields e.g week days, month etc according to this new date.for example Calenda

  • Error in cache refresh

    Error in cache refresh Dear all expert I have created one BPM scenario after when execute that scenario then problem come in cache Before that scenario my Pi working fine now. I have delete communication channel of BPM scenario but still facing probl

  • How can I turn off the large blue location circle in apple maps?

    How can I turn off the large blue location circle in apple maps, MacBook Pro 15 (2011)?  It is to large.  At times I need to  zoom into my home location, but the large blue circle hides the location I need.

  • Selecting clip from event browser

    Hi, just curious why I can't grab a clip & drag it to timeline after having done so many times.  It works for some time but then it just won't hold the clip i.e. show the the little blue film strip icon.  It works again after turning FCP X off/on. No