Need to create multiple files in CSV through UTL_File package

I have to extract data from table from csv format and maximum number should be 10 each file.how to do this through UTL_File utilities.
i am putting the code...any input would be apprecaited...
CREATE OR REPLACE PACKAGE BODY TEST
AS
PROCEDURE main_test(
errbuff OUT VARCHAR2,
retcode OUT VARCHAR2
IS
-- Variables
lv_file_handle UTL_FILE.FILE_TYPE;
lv_file_name_txt VARCHAR2(25);
lv_file_location_txt VARCHAR2(100) :='/dv1/gfp/ora01/dv1gfpcomn/temp';
v_error_code NUMBER;
v_error_text VARCHAR2(200);
lv_cursor_rowcnt NUMBER := 0;
lv_row_data VARCHAR2(32000);
lv_row_tran_data VARCHAR2(32000);
lv_transaction_number VARCHAR2(1000);
lv_row_head_data1 VARCHAR2(32000);
lv_row_trn_data1 VARCHAR2(32000);
lv_row_data1 VARCHAR2(32000);
lv_period VARCHAR2(100);
row_cnt number := 0;
c integer;
max_rows number;
-- Cursors
CURSOR cur_period IS
select
user_name name,
description description ,
email_address email,
start_date st_date,
end_date end_date
from fnd_user
WHERE ROWNUM <51
ORDER BY 1,4 desc;
BEGIN
lv_file_name_txt := 'test'||TO_CHAR (SYSDATE, 'DDMMYYYY')||'.txn';
lv_file_handle := UTL_FILE.FOPEN(lv_file_location_txt, lv_file_name_txt, 'w');
--code modification here
FOR cur_rec IN cur_period
LOOP
lv_row_data := NULL;
lv_cursor_rowcnt := lv_cursor_rowcnt + 1;
lv_row_data := rpad(nvl(substr(cur_rec.name,1,10),'') ,10,' ') || '+'
|| rpad(nvl(substr(cur_rec.description,1,10),'') ,10,' ') || '+'
|| rpad(nvl(substr(cur_rec.email,1,15),'') ,15,' ') || '+'
|| rpad(nvl(substr( cur_rec.st_date,1,10),'') ,10,' ') || '+'
|| rpad(nvl(substr( cur_rec.end_date ,1,10),'') ,10,' ') ;
END LOOP;
IF lv_cursor_rowcnt = 0 THEN
fnd_log.put_line ('No data found');
END IF;
UTL_FILE.FCLOSE(lv_file_handle);
EXCEPTION
WHEN OTHERS
THEN
v_error_code := SQLCODE;
v_error_text := SQLERRM;
retcode := 2;
fnd_log.put_line ('s-Error :' || v_error_code || '- ' || v_error_text );
fnd_log.put_line (SQLERRM);
UTL_FILE.FCLOSE_ALL();
END;
END TEST;
show err
---

Hi,
and maximum number should be 10 each file.utilities. I could not understand the above line. If you want to put 10 rows in one file , next 10 rows in another file and so on ......
There are two approaches.
1. Simple one is store all records in one file using UTL_FILE and then use unix
split utility to break 10 lines for each file.
2. Store all files name is an array ( VARRAY or Associative Arrays) .
(i) Fetch file name form Array
(ii) Open a File
(iii) Store 10 rows in File
(iv) Close file. Go to step 1.
Regards

Similar Messages

  • How to create multiple files with Receiver File Adapter in SAP PI 7.31 Java Stack

    Dear Friends,
    I am using Sender JDBC Adapter and Receiver File Adapter in Integration Flow in SAP PI 7.3 EHP 1 SP08 Java Stack environment. The requirement is that we need to create multiple files based on the row count in jdbc resultset. If there are 5 rows in resultset, we need to create 5 XML files with one row elements in one file. Similarly if there are 10 rows, we need to create 10 XML files.
    So how can we create multiple files in this scenario. I tried placing a for loop in the Java Mapping as below in the transform method:
    DynamicConfiguration conf = arg0.getDynamicConfiguration();
    StringBuffer sbFileData = new StringBuffer();
    for (int i =0; i < record.size(); i++ {
         . // Create XML for each row and Marshal the object into to the String Buffer
         String strFileName = "DC_" + new SimpleDateFormat("ddMMyyyyHHmm").format(new java.util.Date())+"_"+i+".xml";
         conf.put(KEY_FILENAME, strFileName);
         arg1.getOutputPayload().getOutputStream().write(sbFileData.toString().getBytes("UTF-8"));
         arg1.getOutputPayload().getOutputStream().flush();
    So here I'm flushing the OutputStream for each record. But it's not creating the multiple file, instead it creates only one file will all record XMLs appended to each other.
    Please let me know if I missing something or need to do some thing else.
    Regards,
    Shreyansh Shah

    Hi
    You can easily achieve this using graphical mapping.  Create your target message type like below
    MT_Target
      Details  0 to 1
          Data  0 to 1
    Source sample structure
    <resultset>
    <row>
    <column-name>column-value</ column-name>
    </row>
    Then do the message mapping like below
    map <row> with  MT_Target
    contant ----> Deatils
    column-name ------>Data
    In the signature tab of message mapping, choose the occurrence of your target message type as
    0 to unbounded.
    This will generate multiple files from multiple rows.
    Let me know if you have any doubt.

  • Changing the pdf profile of batch create multiple files in Acrobat?

    Is it possible to load another pdf profile for batch create multiple files from Acrobat? I am batching indesign pages and I need to use a high resolution pdf profile with printer marks
    The default seems to be low res rgb. Any idea if this can be done?

    it is a custom Pdf Profile but basically an X1a with a few tweeks, When I try a watch folder with distiller it just errors out all the files.
    Batch Processing using the "Create PDF, Batch Create Multiple Files " in Acrobat works but does not let me choose a pdf profile.
    C

  • Premiere CS4 is Creating Multiple files when rendering

    We have used Adobe Premiere for just over seven years now with great success.  Five days per week we create videos with Adobe Premiere with three computers. We presently upgraded to the new CS4.  The computer that that program is installed on is used to edit 30 and sixty minute television shows.  The files start out as .AVI files then, when finished they are rendered and saved as MPG2 files.
    We are currently experiencing a problem with this new program that we have not ever experienced in the past.  Description of problem:
    We import a 30 or 60 minute .avi file into a project.  We then place it on the timeline.  On these timelines there are only the video layer and the audio layer, no more than that.  We then make the editing changes that are necessary.  We then go to export the file to the Adobe Encoder to be saved as a MPG2.  When we do this, while in the process of encoding the file, Premiere will create four (4) files when it was not told to do so.  When this happens of course with a 60 minute file, it can take a very long time to encode, (because it is creating multiple files).  We have needed to stop the process, and change the name.  This sometimes works, and sometimes it does not.
    We are hoping that someone has come across this before and can help us.  I have looked at different sources to find the answer to this.  I called Adobe direct, and it was suggested that I try this forum.  Any help would this would be very appreciated.  Thank you.

    OK.  These are all of the screen shots with the settings.  I hope that you can find something.
    Thank you

  • Acrobat 9 Pro - Batch Create Multiple Files from InDesign CS5 files

    When attempting to batch create PDFs from Indesign CS5 files using Acrobat Pro 9's File>Create PDF>Batch Create Multiple Files ... option the operation fails with the error 'Could not find the application that created this file: [path to file] Please select a file created by an application that resides on your computer.' as shown in the screenshot below:
    Acrobat 9 Professional was bundled with Creative Suite 5 Design Standard so shouldn't this work? My machine is running OS X 10.6.7, Acrobat Pro 9.44 and InDesign CS5 7.04.
    Any help to solve this issue would be most gratefully received - this feature had previously saved me a lot of time on my old machine with 10.5.8, Acrobat Pro 9 and CS4.

    I have uploaded the files and shared them.  These are the links
    Grade 11 Maths Standardisation Project Paper 2 2013.doc
    https://files.acrobat.com/preview/9694310d-ca7f-4919-883d-c53b36215d89
    Grade 11 Maths Standardisation Project Paper 2 Analysis Grid 2013.doc
    https://files.acrobat.com/preview/97da9e5f-d412-4d25-9bbc-d1a525d90826
    Grade 11 Maths Standardisation Project Paper 2 Diagram Sheet 2013.doc
    https://files.acrobat.com/preview/f50dd62e-af04-4060-85c5-fa81ce6803d8
    Grade 11 Maths Standardisation Project Paper 2 Formula Sheet 2013.doc
    https://files.acrobat.com/preview/7fc6007b-aaa6-4d65-9a8c-bf99818474a5
    Grade 11 Maths Standardisation Project Paper 2 Marking Guidelines 2013.doc
    https://files.acrobat.com/preview/b3a715bb-3683-48df-b0ec-3d17442275be
    Grade 11 Maths Standardisation Project Paper I Analysis Grid 2013.docx
    https://files.acrobat.com/preview/ab62e6b6-0261-434e-8a2f-382f74335685
    The first file is the problem file.  If you create this file separately, Acrobat will convert it perfectly.  But "Batch create multiple files" and the graphics are deconstructed on page 8

  • Acrobat 9 - Batch Create Multiple Files

    Hopefully someone can help me with this problem, or at least shed some light on it for me.
    I am using Acrobat 9. I have Creative Suite 4 (InDesign, Illustrator, Photoshop, etc.) There is a new feature in Acrobat 9 called "Batch Create Multiple Files", which can be found in the File menu, under "Create PDF".
    This feature is supposed to create pdfs from multiple native file types, including InDesign. Acrobat uses the native application, in this case InDesign CS4, to open each file selected in the batch and then create a pdf file from it. This would be a really cool feature if I could get it to work.
    Each time I try to run this, I get an error message stating "Cannot open the document". I have an operator who can get this to work, if they use CS3 InDesign documents (she also has CS3 installed on her mac), which doesn't make sense to me because Acrobat 9 is a part of CS4.
    Is it possible that I am missing a plug-in? Has anyone experienced a similar problem, or does anyone have a solution for me?
    Thanks,
    Jeff

    You should remember that Acrobat 9 Pro came out BEFORE InDesign CS4. It has not yet had an update. The release InDesign CS4 format DID NOT EXIST when Acrobat 9 Pro came out, so it cannot yet convert it.
    You'll have to wait for an update to Acrobat 9 Pro.

  • Combine functionality Batch Create Multiple files and Set Security

    Greetings,
    Is there any way to combine the functionality of Acrobat Pro’s “Batch Create Multiple Files” (File (drop down) -> Create PDF -> Batch Create Multiple Files…) and running a batch process (Advanced -> Document Processing -> Batch Processing -> Batch Sequences -> Set Security)?
    Ideally I’d like to either:
    1)      Add the “Set Security” batch process to the “Batch Create Multiple Files … command located under the File (drop down) -> Create PDF
    or
    2)      Be able to create a batch process that first allows me to select the documents (Word, Excel, etc.) I want to convert into PDF files, then converts them, then runs the Set Security batch process.
    Right now it isn’t too much trouble to first “Create Multiple Files…” then run the batch process Set Security, but it would be nice to be able to do both with a single command.
    Any suggestions?
    Thank you,
    TPK

    I have uploaded the files and shared them.  These are the links
    Grade 11 Maths Standardisation Project Paper 2 2013.doc
    https://files.acrobat.com/preview/9694310d-ca7f-4919-883d-c53b36215d89
    Grade 11 Maths Standardisation Project Paper 2 Analysis Grid 2013.doc
    https://files.acrobat.com/preview/97da9e5f-d412-4d25-9bbc-d1a525d90826
    Grade 11 Maths Standardisation Project Paper 2 Diagram Sheet 2013.doc
    https://files.acrobat.com/preview/f50dd62e-af04-4060-85c5-fa81ce6803d8
    Grade 11 Maths Standardisation Project Paper 2 Formula Sheet 2013.doc
    https://files.acrobat.com/preview/7fc6007b-aaa6-4d65-9a8c-bf99818474a5
    Grade 11 Maths Standardisation Project Paper 2 Marking Guidelines 2013.doc
    https://files.acrobat.com/preview/b3a715bb-3683-48df-b0ec-3d17442275be
    Grade 11 Maths Standardisation Project Paper I Analysis Grid 2013.docx
    https://files.acrobat.com/preview/ab62e6b6-0261-434e-8a2f-382f74335685
    The first file is the problem file.  If you create this file separately, Acrobat will convert it perfectly.  But "Batch create multiple files" and the graphics are deconstructed on page 8

  • Batch create Multiple files in Acrobat X and X1 cannot convert Word 2010 with graphics

    I work for an exams board where hundreds of exam papers are produced. Once approved, these exams are converted to PDF and sent to print.  Using the Batch Create Multiple Files option is therefore essential to getting these papers print ready on time.  We have found that using this function to convert multiple Word 2010 files with graphics will not render it properly.  It deconstructs the graphics which loses the integrity of the exam paper. 
    I have trialled the same group of files on Acrobat X1 with the same result.
    Have other Acrobat Pro Users experienced the same problem?  Is there a fix? 

    I have uploaded the files and shared them.  These are the links
    Grade 11 Maths Standardisation Project Paper 2 2013.doc
    https://files.acrobat.com/preview/9694310d-ca7f-4919-883d-c53b36215d89
    Grade 11 Maths Standardisation Project Paper 2 Analysis Grid 2013.doc
    https://files.acrobat.com/preview/97da9e5f-d412-4d25-9bbc-d1a525d90826
    Grade 11 Maths Standardisation Project Paper 2 Diagram Sheet 2013.doc
    https://files.acrobat.com/preview/f50dd62e-af04-4060-85c5-fa81ce6803d8
    Grade 11 Maths Standardisation Project Paper 2 Formula Sheet 2013.doc
    https://files.acrobat.com/preview/7fc6007b-aaa6-4d65-9a8c-bf99818474a5
    Grade 11 Maths Standardisation Project Paper 2 Marking Guidelines 2013.doc
    https://files.acrobat.com/preview/b3a715bb-3683-48df-b0ec-3d17442275be
    Grade 11 Maths Standardisation Project Paper I Analysis Grid 2013.docx
    https://files.acrobat.com/preview/ab62e6b6-0261-434e-8a2f-382f74335685
    The first file is the problem file.  If you create this file separately, Acrobat will convert it perfectly.  But "Batch create multiple files" and the graphics are deconstructed on page 8

  • To create multiple files with same content but with different names

    Hi SapAll.
    here i have got a tricky situation on Idoc to File Scenario.
    in my interface of an Idoc to file ,there  is requirement to create multiple files with different file names but with same content based on one Idoc Segment.
    which means there will be one Zsegment with two fields in the idoc,where one field with (content refers to the name which file name should start with .so lets say if this segment is repeated for 3 times then PI should create 3 files in the same directory with same content but with different file names (from the filed).
    so here for now iam using one reciever file communication channel.
    can any body give me the quick answer.
    regards.
    Varma

    What do you mean by different names?
    when i make proper setting in the Receiver Channel....on how to create the filename (what to append) like add Timestamp, counter, date, messageid.....even in this case you will ahve file with different names and that too from same File channel.
    You can perform multi-mapping in XI/ PI and then your File channel will place the files in the target folder with relevant names. You cannot use Dynamic Configuration with Multi-Mapping!
    If you intend to use different File channels, then do the configuration as required (normal)...even over here you can follow multi-mapping.
    Do not use a BPM!
    Regards,
    Abhishek.

  • Create multiple files in different directories for receiver system

    Hi,
    My scenario is File-XI-File. Based on a value of a field(1...Unbounded) & its occurance in source file XI needs to create same file number of times(based on occurance of field in source file) in different directories on receiver system(Single Business System).
    What different ways/solutions are available to achieve this?
    Regards,
    Bharat
    Edited by: Bharat Rathod on Nov 21, 2009 5:24 PM

    Hi Bharath,
    >>Based on a value of a field(1...Unbounded) & its occurance in source file XI needs to create same file number of times(based on occurance of field in source file) in different directories on receiver system(Single Business System).
    This logic needs to be handled in message mapping ... and you need to use multimapping..check the link here
    http://help.sap.com/saphelp_nw04/helpdata/en/42/f3b31d48fb1bc8e10000000a11466f/content.htm
    Regards
    Suraj

  • Need to create multiple PA documents during billing

    Hello,
    We have the following scenario.
    When we create a billing document from an SD order, we need to create multiple PA documents based on the condition types.  We have maintained those condition types to different value fields in KE4I.
    For e.g, for a line item in an order, we have Basic Price = 100, Discount = 20
    When we do billing for the above line item, we want to create two PA documents, one for the Basic Price and one for the discount. Note that the above Basic prive and Discount are mapped to different value fields and different cost element groups.
    Thank you.
    Bala

    Hi,
       This functionality is not possible not does it make any sense. SD conditions are mapped to value fields via KE4I. If you have not activated summarization (tcode KE2S) then for every SD item you will get a COPA document. Each COPA document will contain all the values fields filled via the SD conditions displayed in one line item.
       Imagine if you have a SD billing document with 20 items, each items containing 10 conditions. Then you will get 200 COPA documents as per your requirement !!! This does not make any sense neither from technical point of view nor from business point of view.
    regards
    Waman

  • Dynamically need to create multiple text or select items.

    Hi All,
      There is a requirement in my application, we need to create multiple textbox or selectlist items, on click of "add" button in apex.
      Any help on this how i can process the request to create multiple items dynamically on click of "add" button.
    Regards,
    Sruthitamiri!!

    APEX_ITEM

  • Batch create multiple files in a script

    I have 130,000 gif files I want to convert to pdf.  I can only batch convert about 1,500 at a time, acrobat will bomb out if I do more.  Is there a script I can use to process all my files ?
    Thanks,
    Alex

    I have uploaded the files and shared them.  These are the links
    Grade 11 Maths Standardisation Project Paper 2 2013.doc
    https://files.acrobat.com/preview/9694310d-ca7f-4919-883d-c53b36215d89
    Grade 11 Maths Standardisation Project Paper 2 Analysis Grid 2013.doc
    https://files.acrobat.com/preview/97da9e5f-d412-4d25-9bbc-d1a525d90826
    Grade 11 Maths Standardisation Project Paper 2 Diagram Sheet 2013.doc
    https://files.acrobat.com/preview/f50dd62e-af04-4060-85c5-fa81ce6803d8
    Grade 11 Maths Standardisation Project Paper 2 Formula Sheet 2013.doc
    https://files.acrobat.com/preview/7fc6007b-aaa6-4d65-9a8c-bf99818474a5
    Grade 11 Maths Standardisation Project Paper 2 Marking Guidelines 2013.doc
    https://files.acrobat.com/preview/b3a715bb-3683-48df-b0ec-3d17442275be
    Grade 11 Maths Standardisation Project Paper I Analysis Grid 2013.docx
    https://files.acrobat.com/preview/ab62e6b6-0261-434e-8a2f-382f74335685
    The first file is the problem file.  If you create this file separately, Acrobat will convert it perfectly.  But "Batch create multiple files" and the graphics are deconstructed on page 8

  • Upon launch of Lightroom after initial instalation a warning came up that said lightroom needs to create temporary files and cant open.  The it opened and the catalog i imported will not show the images.  How can I give permission? Running windows 8.1 64

    Upon launch of Lightroom after initial installation a warning came up that said lightroom needs to create temporary files and cant open.  Then it opened and the catalog i imported will not show the images.  How can I give permission? Running windows 8.1 64 bit.  I have avast virus software.

    Upon launch of Lightroom after initial installation a warning came up that said lightroom needs to create temporary files and cant open.  Then it opened and the catalog i imported will not show the images.  How can I give permission? Running windows 8.1 64 bit.  I have avast virus software.

  • JDBC to  File Sender: Create Multiple Files

    Hi All,
    I have a requirement that I have to pick data form a SQL table and then based on the data in it I have to create multiple files using File receiver. Even the file name has to be derived from the data in the SQL table.
    e.g. The SELECT statement is fetchin 30 record and I have to make 3 files out iof it. Please suggest.
    regards,
    Piyush

    Hi,
    You can achieve without BPM, By using Enhance Interface Determination  i,e Multimapping without BPM.
    In additon you would required ASMA and dynamic configuration for this scenario.
    Regards,
    Abid

Maybe you are looking for

  • I can't delete phantom emails

    iPhone 6  IOS 8.1.3 I have recently deleted all the emails from a particular person on my mac email account.  When I search that person's name in the search all email accounts in the the search bar in the email app, I can no longer see any emails fro

  • MarkLogic Server as a datasource in OBIEE

    Does anyone know if its possible to connect MarkLogic as an XML datasource into OBIEE? I've looked on both the Oracle and MarkLogic sites, and searched the net, but their doesn't seem to be an awful lot of info.

  • How can I change the behavior of a key?

    Hi. I have bought a new Macbook Air on the US, and I configured it to use a Spanish keyboard layout. When I press alt+the button left to 1, I want a backslash \, but I'm getting a ≤ symbol. How can I change this? Thanks

  • After cleaning, my trackpad has a dead spot

    Hi, Its been about an hour since I cleaned my ibook with a soft clean cloth and just a tiny touch of dish soap and water. I scrubbed my track pad pretty thoroughly with a moderate amount of force. The cloth was wet enough to leave tiny water drops on

  • No 'import as live photoshop 3D' option

    I have created a 3D sphere in PS CS6 and want to import it into after effects to animate. But when I import the model the option to import as a live 3d model is not coming up? Why is this? What have I done wrong?