Select this option for a file (.) CSV)

Hello people,
I work with a table and I want to by a select, put all my result in a .csv file (after that I'll turn into .xls)
Then, I'm doing it:

XFILE: = UTL_FILE. FOPEN ('NOM_DE_DOSSIER', 'Export.csv', 'W');

-THIS IS THE TITLE

UTL_FILE. PUT_LINE ('MES_REF', XFILE |) ';' ||' CHAVE' | « ; » ||' MES1' | « ; » ||' MES2' | « ; » ||' MES3' | « ; » ||' MES4' | « ; » ||' MES5' | « ; » ||' MES6' | « ; » ||' MES7' | « ; » ||' MES8' | « ; » ||' MES9' | « ; » ||' MES10' | « ; » ||' MES11' | « ; » ||' MES12' | « ; » ||' MES13' | « ; » ||' MES14' | « ; » ||' MES15' | « ; » ||' MES16' | « ; » ||' MES17' | « ; » ||' MES18' | « ; » ||' MES19' | « ; » ||' MES20' | « ; » ||' MES21' | « ; » ||' MES22' | « ; » ||' MES23' | « ; » ||' MES24' | « ; » ||' MES25');

FOR R IN (SELECT P_MES AS MES_REF
KEY
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '25' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTHS1
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '24' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH2
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - INTERVAL '23' MONTH), 'YYYYMMDD')) THEN VALOR END) AS PERIOD3
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - INTERVAL '22' MONTH), 'YYYYMMDD')) THEN VALOR END) AS MONTHS4
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '21' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTHS5
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '20' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS 6
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '19' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH7
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '18' MONTHS APART), 'YYYYMMDD')) THEN VALOR END) AS MONTH8
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '17' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH9
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '16' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH10
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '15' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH11
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '14' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH12
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '13' MONTHS INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH13
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '12' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH14
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '11' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH15
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - INTERVAL '10' MONTH), 'YYYYMMDD')) THEN VALOR END) AS MONTH16
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '09' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH17
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '08' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH18
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '07' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH19
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '06' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH20
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '05' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH21
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '04' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS MONTH22
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '03' INTERVAL OF MONTHS), 'YYYYMMDD')) THEN VALOR END) AS MONTH23
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - '02' MONTH INTERVAL), 'YYYYMMDD')) THEN VALOR END) AS SCHEDULE24
MIN (CASE WHEN MY = TO_NUMBER (TO_CHAR ((TO_DATE(FN_GET_CALC_PPM,'YYYYMM') - INTERVAL MONTH ' 01'), 'YYYYMMDD')) THEN VALOR END) AS MONTH25
OF VIA_GAUSS_PPM
GROUP BY KEY
CONTROL KEY)
LOOP
BEGIN
UTL_FILE. PUT_LINE (XFILE, R.MES_REF | ';' |) R.KEY | ';' | R.MONTH1 | ';' | R.MONTH2 | ';' | R.MONTH3 | ';' | R.MONTH4 | ';' | R.MONTH5 | ';' | R.MONTH6 | ';' | R.MONTH7 | ';' | R.MONTH8 | ';' | R.MONTH9 | ';' | R.MONTH10 | ';' | R.MONTH11 | ';' | R.MONTH12 | ';' | R.MONTH13 | ';' | R.MONTH14 | ';' | R.MONTH15 | ';' | R.MONTH16 | ';' | R.MONTH17 | ';' | R.MONTH18 | ';' | R.MONTH19 | ';' | R.MONTH20 | ';' | R.MONTH21 | ';' | R.MONTH22 | ';' | R.MONTH23 | ';' | R.MONTH24 | ';' | R.MONTH25);
EXCEPTION
WHILE OTHERS THEN
BEGIN
CARGA_UTIL. SP_LOG_EXCEPTION (V_PROCNOME, ' KEY: ' |) R.KEY | ', ' || SUBSTR (SQLERRM, 1, 3000));
END;
END;
END LOOP;

UTL_FILE. FCLOSE (XFILE);

The problem is that some lines are getting some error, how do I know what is the reason for these errors?

29/03/2012-09:56:20 CARGA_MEDIAPPM. SP_EXPORT (201203) KEY: Categoria take maison #Sugestão #Sabor, ORA-29285: erro gravacao em land (cannot be saved in the file)

Published by: MrTiberio on 03/29/2012 06:27
The error said

Hello

Maybe it's your line length exceeds the default limit of 1024?

UTL_FILE.FOPEN (
   location     IN VARCHAR2,
   filename     IN VARCHAR2,
   open_mode    IN VARCHAR2,
   max_linesize IN BINARY_INTEGER)   <== You can set max line size here
  RETURN file_type;

Lukasz

Tags: Database

Similar Questions

  • When I select this option I get the dialog box 'Create image s system' but it cannot find any 'backup devices on this computer"and lists the error 0 x 81000036

    Error image system original title: windows 7 0 x 81000036

    I'm doing a backup system image.  When I select this option I get the dialog box 'Create image s system' but it cannot find any 'backup devices on this computer"and lists the error 0 x 81000036.

    I have an ESATA connection on my Dell laptop I was trying to make the image on.  I use the unit every day to save files and which works very well.  He just leaves me CCADE with the system image backup...

    any ideas?

    Hello

    ·         You have created a system image backup before that?

    ·         You did it changes on your computer?

    ·         Is your esata formatted NTFS drive?

    Try to save the image of the boot system: http://support.microsoft.com/kb/929135

    Note: make sure that you start the computer in normal mode after a repair.

    See also the linkfor more information about the backup: http://windows.microsoft.com/en-US/windows7/Back-up-your-programs-system-settings-and-files

  • 14 Photoshop. I'm trying to merge (do a panorama) 2 photos.  The 'automation tools are grayed out', which means that I can not select this option.

    I just upgraded from photoshop 10 to 14. I'm trying to merge (do a panorama) 2 photos.  It was very fast and easy in Photoshop 10.  In photoshop 14 the 'automation tools are grayed out', which means that I can not select this option.  I do something wrong or my installation does not work?

    In the 14 PES Editor, adobe has moved the Photomerge features to guided.

    Photoshop elements help | What's new in Photoshop elements 14

    Photoshop elements help | Guided - mode Photomerge edits

  • Mac OS 10.9.4 I've just updated on a SSD in my IMAC. ? Select this option when Lightroom was once.  How can I get LR5 up and running again?  Por Favor!

    Mac OS 10.9.4 I've just updated on a SSD in my IMAC. ? Select this option when Lightroom was once.  How can I get LR5 up and running again?  Por Favor!

    Lightroom - all versions

    Windows

    http://www.Adobe.com/support/downloads/product.jsp?product=113&platform=Windows

    Mac

    http://www.Adobe.com/support/downloads/product.jsp?product=113&platform=Macintosh

  • When clicking on a tab to select this option, it sometimes makes a new group of tabs.

    When clicking on a tab to select this option, it sometimes makes a new group of tabs. Is there a way to stop this behavior?

    We try to cook something like Outlook, but not to meddle with the support of the tab too at the moment.
    As usual, you can ask on the feature request page :)

  • How to stay signed on a website (eBay)? Selecting this option does not work.

    When signing up on eBay, I always choose the option "Keep me signed." However, I have to sign in again every time that I have access to this site several times throughout the day. Is it a problem to eBay or Firefox? I don't see an option in the tools of Firefox that appears to fix this problem for allowing me to stay connected to the Web sites that I choose.

    Websites to remember you and automatically log you in are stored in a cookie.

    • Create a cookie exception permit to keep such cookies, especially for sites Web secure and if the cookies expire when Firefox is closed.
    • Tools > Options > privacy > Cookies: Exceptions

    In case you use "clear history of Firefox closing:

    • do not delete Cookies
    • do not delete Site preferences

    Note that compensation "Preferences of Site" clears all exceptions for cookies, images, windows pop up, installation of software and passwords.

    Deletion of cookies will delete all cookies (selected) specified, including cookies that have an exception allowing and cookies of plugins.

  • Window display OpenExr playback Options for all files when generating thumbnails

    I use Bridge CC 6.2.0.179 x 64. I work a lot with the OpenExr files. All of a sudden bridge appears this little window of playback options (regarding the Alpha channel) for all OpenExr files when generating thumbnails, which pretty much makes bridge unusable when you enter a folder with many pictures. Is there a way to disable this option? I've never known this behavior before, so it seems to me that it was introduced with a recent update. Any help on this is much appreciated. Google did not until now, anything useful.

    Hello

    We published a new version of Adobe Bridge (CC 2015) on July 19, 2016. This update is available via the Adobe Creative Cloud application.

    We addressed the issue of "Open EXR reading Options Window" in this version. Please try the new version and check the number you have met.

    If you are not able to locate the bridge (CC 2015) on the creative cloud application, you will need to update application creative cloud and restart the machine.

    Thank you

    Praveen wilkenson

  • Automator: use the variable &amp; selected as parameters for shell files

    I rarely use Automator, but it is useful to create services.

    I have a shell script that the tags of the files, and in a service, he travels the files selected in the Finder.

    What I can't get my head is the way to ask the user for the tag to be applied (either as a literal or choose from the list) and then pass this as the file list for the shell as a parameter.

    You're talking about text tags?

    You can use Ask for the text, and then set the Variable, then before run you Script Shell, Get Variable.  If this is the only variable passed, then it will be '$1 '.

    If you click on the [results] in the action before to run the Shell Script, you can see the order of the variables passed:

    Note: $1 should be quoted: echo "$1"

  • When I have 3 tabs open and select this option to make my homepage, then I restart IE8, it opens the first tab, not the other two. How can I fix it?

    IE8 won't remember not all tabs, I opened and saved as part of my homepage.

    Hello dbonser,

    Thank you for visiting the Microsoft answers community.

    By selecting the home page several tabs in Internet Explorer 8:

    ·         Click the drop-down arrow to the right of the home button.

    ·         Select Add or change Home Page

    ·         Select Add this page to your home page tabs

    If you want to open only first home page when you start IE8

    ·         Click Tools > Internet Options > settings (in the tabs Section)

    ·         Select the check box by opening only the first homepage to start Internet Explorer

    ·         Click OK

    ·         Click OK

    Hope this helps

    Chris.H
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • ROLLBACK option for verified files?

    Hello world

    Y at - it an option to cancel the start file. (Case: I checked a bad file so that I don't want to save this file with a different version). Any solution for this? Thanks in advance.

    Thank you

    Guru.

    Simply visit the information content from the content page that you just checked. In the upper right corner, under content of Actions, click on Undo Check-out.

  • Select the options for ALL but some in OBIEE prompt with a single click

    Hello guys,.

    I have the below requirement

    I have a prompt that displays the payment terms.

    On the result - 3 payment terms are the terms of payment we and the rest are Global.

    A user will select these 3 conditions of payment of the United States or the reset of the (Global) payment terms, but not all.

    Y at - it somehow I can create an option that selects all terms of payment with one click (as the option all columns)

    also, I'm trying to use all of the columns, which is to select all the columns including US and global, but once the user selects all the column option - the user is not able to selectively disable certain values.

    Is there a work around for this?

    Please let me know because this would be a great help for me.

    Thank you

    Why don't make you a second guest of the column where you add the CASE WHEN to produce the 2 types of terms (US & Global)?

    Then using the "limited by" you auto-filtre the actual list of terms of payment based on the first selection and is to meet your requirement to select all of the USA or Global all with just 1 click.

    The user you want to select just 1 term given? Just ignore the first field of the prompt with the groups and directly select the one required in the second field.

  • Select this OPTION to generate XML data from the table using XMLELEMENT, XMLAGG gives error ORA-19011 string buffer too small

    My select statement fails with the error:


    The ORA-19011 string buffer too small


    The select statement looks like:


    SELECT TO_CLOB)

    XMLELEMENT ("accounts",

    XMLELEMENT ("count",

    XMLATTRIBUTES)

    rownum AS "recordId."

    To_date('20130520','YYYYMMDD') AS "datestarted."

    123456 AS "previousBatchId."

    56789 AS 'previousRecordId '.

    ),

    ....

    .... .

    .....

    XMLFOREST)

    SIG_ROLE AS "SignatoryRole."

    To_char(TRANSFER_DATE,'YYYY-mm-DD') AS "TransferDate."

    NVL(Reason,0) AS 'reason '.

    ) AS the 'transfer '.

    )

    ()) AS CRDTRPT

    OF ANY_TABLE;

    • It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)

    I'd use the XMLGEN package. But the environment team says no mounted drives in the future with the arrival of the EXADATA.

    NO HARD DRIVE MOUNTED, NO ACCESS TO THE DATABASE DIRECTORIES

    No UTL_FILE

    I need to use the REEL spool the resulting XML data of the SELECT query.

    SQL is a standard in my org, but I can do with a PL/SQL solution also to load data into a table (cannot use a COIL with PL/SQL)

    What I do is:

    1. a column of type CLOB to a xml_report of the loading of the above SELECT query table
    2. Then using SELECT * FROM xml_report to SPOOL the data to a file report.xml

    No need of XMLTYPE data behind. Xml data stream is fine for me.

    In addition, I need to validate the XML file, also using XSD.

    Problem is that the resulting lines of the select query are supposed to be from 15000 to 20000 bytes long.

    Oracle database version: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    A Suggestion or a solution to this problem would be appreciated.

    (Sorry for the use of "BOLD", just to make it more readable and highlight the imp points)

    Bravo!

    Rahul

    It looks like I can choose only 4000 characters using the SELECT statement (please, correct me if I'm wrong)

    You use the right method.

    There is an implicit conversion from XMLType to the data type VARCHAR2 as expected by the function TO_CLOB, where the limitation, and the error.

    To serialize XMLType to CLOB, use the XMLSerialize function:

    SELECT XMLSerialize (DOCUMENT

    XMLELEMENT ("accounts",

    ...

    )

    )

    OF ANY_TABLE;

    For the rest of the requirement, I wish you good luck trying to spool the XML correctly.

    You may need to play around with the SET LONG and SET LONGCHUNKSIZE commands to operate.

  • Select this button for a list of checkboxes - Oracle Forms 10g

    Forms 10 g - step through a LOV to select checkboxes

    I have the following form (as described in the thread above). My client wants me to add a button or a check box that automatically selects all of the checkboxes in the form when you press. I know that I'll need a trigger WHEN-BUTTON-PRESSED on the button or a checkbox, but I don't know what logic I need to browse the list of boxes to check, and then select each box. Could someone advise me?

    Hi ThomasBoxall,

    Have all of the initial value for the box. ??? 1 - checked and Unchecked-0 or at your convenience.

    In the WHEN-BOX-CHANGED, write the following code like this,

    declare
         last_rec number;
         I number;
    begin
    
    /* To Check the list box is Selected or Checked */
    If :block3.CHECK_BOX62=1 then
    
    /* To go to a Particular Block */
    go_block('block4');
    
    /* To Identify the Total records in the Block */
    last_record;
    
    last_rec := :system.cursor_record;
    
    /* Move to the First Record */
    first_record;
    
    /* The Loop Checks all the Check Box */
    for I in 1..last_rec loop
         go_record(I);
         :block4.CHECK_BOX58 :=1;
    end loop;
    first_record;
    end;
    

    Hope this will help you. !!!

    Thank you
    Shankar.

  • On my notes App I was able to sketch on this before now my keyboard won't go for this option

    On my notes App, I was able to sketch on this before now, my keyboard won't do to select this option, how do I fix this (IOS 9.3.2).

    < re-titled by host >

    What do you mean that the keyboard will not go. When you type in a note on the above the keyboard to access commands in the sketch.

  • Search for a file

    How to find a file that was not saved I just closed excel

    There are two answers actaully.  First of all, if you're using Vista Business, Vista Ultimate or Vista Enterprise, there are snapshots. http://www.Microsoft.com/Windows/Windows-Vista/features/shadow-copy.aspx "easily access this feature by right-clicking on a file or folder, by selecting"restore previous versions."" It lets go back in time and access your files and folders as they were at earlier dates. You can get a preview of each file in a version read-only for the file to restore. Then, to completely restore, you can just drag the file to one, or select it and click "Restore" to restore it to its original location. "In Vista Basic or Premium of Vista, this feature is not available unless you use Explorer Shadow http://www.howtogeek.com/howto/windows-vista/recover-files-with-shadow-copies-on-any-version-of-windows-vista/.  Of course, any of these processes to work, there must be previuous copies of the backup files.  It's not like in Outlook, where the projects are saved.   This feature is more for the recovery of files deleted, where earlier versions can be restored to save one of having to start from scratch - not not for recording of the drafts.

    Second, when Exxcel closes with open files even without saving a file, it will sometimes open with these files showing as recovered (it depends on the version of Excel - it works better in 2007) and all you need to do is click on the recovered file to open it and then you can save it.  If it does not show a recovery file so it has not been saved and there is no way to recover the lost information (this works a little, but not exactly as drafts in Outlook - it is not always do and does only periodically for some work may still be lost).  It can also appear in the recent files (when you click on the orb and look right) but that is less likely if it has not been saved at least once.  " In 2007, Microsoft Office Excel, Microsoft Office Outlook, Microsoft Office PowerPoint, and Microsoft Office Word, there is an additional benefit of allowing the AutoRecover or AutoSave. In these programs, if you select this option, certain aspects of the State of the program are recovered when the program is restarted after it closes abnormally. "Whether or not you can recover your work depends on many of these features have been activated or not (and how Excel was closed).  What follows is the last chance to recover a file that has been lost (but it's more for the files previously saved for files that were never registered at all (but it can function as a file1 - I'm not quite sure)):

    1. Click the Microsoft Office button, and then click Open.
    1. In the Open dialog box, type the path and the mask below into the address bar at the window to display a list of the automatically saved files. The path and mask for Excel depend on the version of Microsoft Windows that you are running:
    2. Windows Vista  

      %UserProfile%\AppData\Roaming\Microsoft\Excel\

    • Microsoft Windows Server 2003 or Microsoft Windows XP

      %USERPROFILE%\Application Data\Microsoft\Excel\*.xlsb

    1. Click on the name of the file you want to recover, and then click Open. If you are not sure which file you need to open, do the following:

    • The automatically saved files are named by using the following convention: Original file name (version Version number). For example, if your original file is named trucks, the automatically saved file name should be trucks (version 1).
  • Optionally, you can modify the file list in the Open dialog box to make it easier to browse through files to find one that suits:
  • Click the arrow next to the views button, and then click Details.
  • Click on the column heading to sort the list by name, size, Type, or Date modified. Click on the column heading to sort the list in reverse order. For example, click Update once or twice so that the list of files is sorted with files modified most recently at the top of the list.
  • Continue to open the files until you find the desired. After you find the file, click Save .
  • I hope this helps and that you are able to recover your lost files.

    Good luck!

    If tha above does not meet your qeustions or if you have any other questions or you want to check if there are more options, please see the Discussion of the Office group at: http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.excel.misc&lang=en&cr=US where I'm sure someone will be more than happy to help you.

    Lorien - a - MCSE/MCSA/network + / A +.

Maybe you are looking for