How to Export data from a Table to Excel using PL/SQL Code

Hi,
I need to export data from a table to the excel sheet using PL/SQL script.
could you pls provide with custom codes or sample procedures.
Bobby

http://asktom.oracle.com/pls/ask/f?p=4950:8:7947129213057862756::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:728625409049

Similar Messages

  • How to Export Data from a table in database directly to Excel.

    Hi,
    I have some sqls that i need to run on a daily basis.My client wants them to be scheduled through a job and the result output of the query should be in the form of Excel.
    Now i am no sure how to do this.Is there any in-built function in the DBMS package that can export data drectly from table to Excel. ?
    Please Help me !!

    SQL> spool exlfile.cvs
    SQL> set colsep ','
    SQL> set lines 300
    SQL> set pages  9999
    SQL> set trimspool on
    SQL>
    SQL> select * from DEPARTMENTS
      2  /
    DEPARTMENT_ID,DEPARTMENT_NAME               ,MANAGER_ID,LOCATION_ID
               10,Administration                ,       200,       1700
               20,Marketing                     ,       201,       1800
               30,Purchasing                    ,       114,       1700
               40,Human Resources               ,       203,       2400
               50,Shipping                      ,       121,       1500
               60,IT                            ,       103,       1400
               70,Public Relations              ,       204,       2700
               80,Sales                         ,       145,       2500
               90,Executive                     ,       100,       1700
              100,Finance                       ,       108,       1700
              110,Accounting                    ,       205,       1700
              120,Treasury                      ,          ,       1700
              130,Corporate Tax                 ,          ,       1700
              140,Control And Credit            ,          ,       1700
              150,Shareholder Services          ,          ,       1700
              160,Benefits                      ,          ,       1700
              170,Manufacturing                 ,          ,       1700
              180,Construction                  ,          ,       1700
              190,Contracting                   ,          ,       1700
              200,Operations                    ,          ,       1700
              210,IT Support                    ,          ,       1700
              220,NOC                           ,          ,       1700
              230,IT Helpdesk                   ,          ,       1700
              240,Government Sales              ,          ,       1700
              250,Retail Sales                  ,          ,       1700
              260,Recruiting                    ,          ,       1700
              270,Payroll                       ,          ,       1700

  • How to load data from oracle table to XML using ODI ?

    Hello Team
    I am trying to load data from an oracle table to an xml file. I have configured the physical and the logical schemas for the same. I have used SQL to SQL as LKM and SQL to SQL Append as IKM with Sunopsis Memory Engine as staging area.
    After this, when I am executing the interface, it is executed without any errors but to my surprise I am not finding the relevant data in the xml file. What could be the reason ?
    Please look into this and lemme know how to solve it.
    Thanks.

    908458 wrote:
    Hello Phanikanth
    Even IKM SQL Control Append is not solving the problem. There are many " order columns" in the target xml table. I have not mapped them or specified any order. Does the problem persist because of this ?
    Thanks
    Manoj
    Ocle to XML file loading issue in ODI 10.1.3.5

  • [b]export data from a table to a csv or .txt file[/b]

    hi plz i need help in how to export data from a table to a csv or .txt file

    If you are using TOAD, then you can execute the statement like SELECT * FROM TABLE1
    Then, you can go to Output Grid and you can say save as and you can save it as you want, excel, tab delimited or whatever.
    Thanx,
    Cheers,

  • How to export data from a Oracle table to a delimited file?

    I know how to load delimited file into a table, but how to export
    data from a Oracle table to a delimited file?
    Thanks in advance.

    Try looking at this link, it's long but there's three different solutions discussed in it. If you look at Barbara Boehmer's
    solution in her posts in the link below you'll see that she's addressed your concerns with spool files.
    Re: utl_smtp and triggers

  • Export data from a table to text file using srcipt task

    Hi
    i am new to SSIS
    i have to export data from a table and append it into a existing file through SSIS script task
    please help
    Thanks
    Umesh

    Hi Umesh,
    The data structure of the source table and the structure of the destination file are the same, right? Is the destination file a flat file? Do you have to do it through Script Task? If the destination file is a flat file, this can be done easily by using
    the stock tasks/components other than .NET code. In the Data Flow Task, we choose the appropriate source adapter (such as OLE DB Source or ADO.NET Source) to extract data from the source table, perform transformation if necessary, and then load to the destination
    file via a Flat File Destination. When setting up the Flat File Destination, uncheck the “Overwrite data in the file” option so that the extracted data will be appended to the existing file.
    If you need to implement it through Script Task/Component indeed, you may benefit from the following code examples:
    http://stackoverflow.com/questions/8070163/how-to-add-custom-footer-to-an-ssis-flat-file-seperate-component-or-script-tas 
    http://stackoverflow.com/questions/8467326/add-header-and-footer-row-flat-file-ssis 
    If you need further help about the script, I suggest that you ask a new question in .NET forums where you can get more dedicated support:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=netdevelopment 
    Regards,
    Mike Yin
    TechNet Community Support

  • How to Retrieve data from Variant Table

    Can anyone help me by telling how to retrieve data from variant table which was created by user. I am able to see data of variant table only thru cu60 transaction but not se11. I s there any function module to do this?

    Hello Mohan,
    if u already have data and u want to populate it in F4 help then use below code -
    u Have to make use of FM - 'F4IF_INT_TABLE_VALUE_REQUEST'
    REPORT  ZGILL_VALUE_REQUEST                     .
    data: begin of lt_all occurs 0.
            include structure DYNPREAD.
    data  end of lt_all.
    data: begin of lt_selected occurs 0.
           include structure DDSHRETVAL.
    data: end of lt_selected.
    DATA: BEGIN OF lt_code OCCURS 0,
                code LIKE zgill_main-PERNR,
          END OF lt_code.
    data no_dyn like sy-dynnr.
    Parameters : ECODE like zgill_main-PERNR.
    *parameters: pernr like pa0001-pernr .
    no_dyn =  sy-dynnr.   "give the scren no directly or sy-dynnr in case of report.
    At selection-screen on value-request for ECODE.
    select PERNR into table lt_code from zgill_main.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
            retfield               = 'ECODE'
            dynpprog               = sy-repid
           dynpnr                  = no_dyn
          dynprofield              =       'ECODE'
          window_title           = 'Employee Details'
           value_org              = 'S'
          DISPLAY                = 'F'
       TABLES
            value_tab             = lt_code
           RETURN_TAB             = lt_selected.
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
    *if sy-subrc eq '0' .
      write: 'success'.
    *endif.
    read   table lt_selected index sy-tabix.
    move lt_selected-fieldval to ECODE.

  • How to send data from internal table to the shared folder in ABAP

    Hi experts,
             My requirement is to transfer data from a file to shared folder. i just did reading data from a file to a internal table. Now i want to send this internal table data into a shared folder which is  "
    xxx\y\z....".
    I do not have any idea on how to send data from internal table to the shared folder path.
    can anybody please help me out how to do this?
    Thanks & Regards
    Sireesha.

    Where that folder is located, its on presentation server i.e. desktop or application server.
    If its on presentation server, use FM GUI_UPLOAD.
    If its on application server, then use DATASET functions. Have a look at below link.
    [File Handling in ABAP|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm]
    I hope it helps.
    Thanks,
    Vibha
    Please mark all the useful answers

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • How to select data from a table by passing document number from another tab

    How to select data from a table by passing document number from another table.
    for eg:-
    I want to display name, adres, region from ADRC table
    by using field delivery document number
    Kind Regards,
    Shanbagavalli.S

    Hi Shanbagavalli,
    There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
    **Consider that you have a Internal table having document number from other table..
    SELECT NAME ADRES REGION FROM ADRC
           INTO IT_ADRC
           FOR ALL ENTRIES IN IT_DOC
           WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
    **Consider that you have 1 document number then
    SELECT NAME ADRES REGION FROM ADRC
         INTO IT_ADRC
         WHERE DOCUMENT_NO = W_DOCUMENT_NO.
    Hope this solves your problem.
    Regards,
    Kunjal

  • How to export data from a spread sheet which has multiple work sheets?

    How to export data from a spread sheet which has multiple work sheets to a single text file with fixed length fields?

    Hello s1,
    saving them as CSV will not give a fixed legth output but, as the naming says, a Character Separated Value file.
    Regards
    Marcus

  • Export data from a table (not a bi query) to pdf

    Hi experts,
    I would like to know the way to export data in VC 7.0 from a table to a pdf. This table is generated NOT from a BI query but from an SQL using connection to Oracle DBMS.
    Thank you all
    Alessandro

    Hi,
    Use this link:[https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123]
    and Go through he below thread.
    [Re: Export data from visual composer to excel]
    Regards,
    Govindu
    If helpful reward points

  • How to Export data from webdynpro using Jecxcel

    Hi ,
    Can anyone help me how to export data from web dynpro using Jexcel. kindly send me the related links.
    Thanks

    Hi Sandeep,
    Have you refered in the blogs?
    U can find may more document related to this.the below blog helps u in
    Exporting Data from Web Dynpro in Different Formats Using Open Source (POI, JExcel, iText) APIu2019s.
    https://www.sdn.sap.com/irj/sdn/index?rid=/library/uuid/b030e7fb-2662-2b10-0dab-c4aa52c3550b
    Regards
    Supraja

  • How to select data from cluster table

    hi experts,
                   I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
    how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
    please advice.
    mani

    Hi Manikandan,
    The following code may be helpful to understand how to select the data from cluster table.
    Types: Begin of ty_kna1,
    Kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_kna1,
    begin of ty_bseg,
    belnr type bseg-belnr,
    kunnr type bseg-kunnr,
    end of ty_bseg,
    begin of ty_final,
    belnr type bseg-belnr,
    kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_final.
    Data: it_kna1 type table of ty_kna1,
    wa_kna1 type ty_kna1,
    it_bseg type table of ty_bseg,
    wa_bseg type ty_bseg,
    it_final type table of ty_final,
    wa_final type ty_final.
    Select kunnr adrnr from kna1 into table it_kna1 where....
    if sy-subrc = 0.
    select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
    endif.
    sort it_kna1 by kunnr.
    Loop at it_bseg into wa_bseg.
    move wa_bseg-belnr to wa_final-belnr.
    read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
    if sy-subrc = 0.
    move: wa_kna1-kunnr to wa_final-kunnr,
    wa_kna1-belnr to wa_final-belnr.
    endif.
    append wa_final to it_final.
    clear wa_final.
    endloop.
    Loop at it_final into wa_final.
    write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
    endloop.
    Reward if useful.
    Thankyou,
    Regards.

  • How to retrieve data from catsdb table and convert into xml using BAPI

    How to retrieve data from catsdb table and convert into xml using BAPI
    Points will be rewarded,
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi,
    This is not your requirment but u can try this :
    CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
    GRANT READ ON DIRECTORY text_file TO fah;
    GRANT WRITE ON DIRECTORY text_file TO fah;
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    CREATE TABLE A AS select * from load_a;
    SELECT * FROM A
    Regards
    Faheem Latif

Maybe you are looking for

  • How do I send bookmarks from one phone to another?

    I have a razr maxx hd with my bookmarks and home page all set up. I do not use firefox on a computer. How can I copy bookmarks from my current phone to my new Note 3 firefox browser?

  • Safari won't launch after security update. ATSServer issue?

    I installed Security Update 2008-007, restarted my machine and went to launch Safari. The icon bounced but the menu bar at the top didn't change to Safari and after a few minutes I got a window appear telling me Safari had quit unexpectedly. I went t

  • Help!  Question, how do I move an image along with the text

    New to InDesign and I'm creating a how-to brochure of sorts for my business and as I'm making edits/updates I realize I need to insert another picture at the beginning of the document.  I already have a bunch of other images throughout the document i

  • Database connection page will not display

    Hi I created a feed back database page in my site but when i upload it i don't how to get the database to go with it and when i attempt to open the page it gives me an error. thanks for help

  • PowerBook Alu-The painting flaked - Has anyone been in a similar situation

    NOTICE : English version follow Je recherche toute personne qui connait une situation similaire et/ou si une solution a été trouvé ou résolu entre Apple et vous ? Moins de 6 mois après l'achat de mon PowerBook, il est survenu un défaut dans le pannea