How to dump a query on a XLS file?

I´m working in a stored procedure on that i can send a dinamic query and it return me the result into a xls file.
I´ve found the way to generate that xls file from Pl/sql, but now I need be able to assing each field of each row into his corresponding cell. For this I need to put each field of each row in a variable and then work on it.
For generate xls file, I´ve created a datatype by following the indications of Jasson Bennet´s blog.
http://radio-weblogs.com/0137094/2006/10/26.html
In the example, values are assigned directly to the cells. But it not is valid for me because I dont know what will be these...
I think that if you want see the blog, you´ll can understand better what I´m refering...
Thanks for your time...

Strange requirement, you don't know the query, the columns and the number of rows you get, but you know that you want the value of the second column of the second row :)
But try this
declare
  t_c integer;
  t_r integer;
  t_v varchar2(100);
begin
  t_c := dbms_sql.open_cursor;
  dbms_sql.parse( t_c, q''select 'Roy' name, 'sales' deptno, 25 age from dual
union all select 'Sara', 'HHRR', 30 from dual
union all select 'Mike', 'finances', 35 from dual'', dbms_sql.native );
  dbms_sql.define_column( t_c, 2, t_v, 100 );
  t_r := dbms_sql.execute( t_c );
  t_r := dbms_sql.fetch_rows( t_c );
  t_r := dbms_sql.fetch_rows( t_c );
  dbms_sql.column_value( t_c, 2, t_v );
  dbms_sql.close_cursor( t_c );
  dbms_output.put_line( t_v );
end;
/

Similar Messages

  • How to repair corrupt MS Excel 2003 (XLS) File?

    I have important MS Excel file data and unfortunately got corrupt due to virus attacks, so my crucial Excel sheet got lost, how to repair corrupt MS Excel 2003 (XLS) File? If have any solution please assist me.

    A corrupt excel spreadsheet can be repaired by using Open and Repair technique. It is a built-in repair function that opens a corrupt excel file forcefully. 
    *Open MS Excel > press Ctrl+O > locate corrupt excel spreadsheet and select it. 
    *Click on the arrow shown beside Open button > select Open and Repair. 
    It will take just a few seconds to be completed and selected file will be opened, if possible. 
    Or if this doesn't work, one may take help of a third-party Excel Recovery software. I would recommend
    Excel Repair Kit software to recover data from corrupt excel spreadsheet. The software is available with free demo version. To read more about this software and to download its free demo version, visit: http://www.excel.repair/

  • How to wrap a cell in a xls file created from SQLplus

    Hi,
    I have the following sql script in Unix which creates a xls file for me -
    set pagesize 9999 lines 130                                                    
    set echo off                                                                   
    set termout off                                                                
    set markup HTML on                                                             
    set enpmap off                                                                 
    spool $test/userxyz/testfile.xls;                                   
    -- BEGIN:  Data exctraction from REFINTEG                             
    ttitle ' REPORT FOR DATABASE x1111y0'                                          
    select ' ' || error_message as ERROR, ' ' || error_type as TYPE, '&nbs
    p;' || data_selection as DATA_SELECTION, ' ' || description as DESCRIPTION,
    ' ' || npp as NPP, ' ' || item as item                    
    from   refinteg;                                                       
    spool off;          
    set markup HTML off;
    EXIT;               
    /                    The xls file I am getting needs to have the DESCRIPTION column as wrapped. i.e the contents will sizing the cell.
    Could you provide any leads as to how to include this formatting in my sql script.
    Thanks.

    I am trying to give a snapshot of how my csv is looking like currently and how I want it to be -
    Error      Type      Data_Selection    Description                      NPP      Item
    AAA         new       nsdancsjjsjqs      abc=123 xy=12 pq=34      john       12345678
    BBB         old         dsiuhfdcndhjd      mno=345 cd=56 ij=89      kate       23456667
    How I want it to look like (pls. note the Description column) -
    Error      Type      Data_Selection    Description                      NPP      Item
    AAA          new       nsdancsjjsjqs      abc=123                          john      12345678
                                                        xy=12
                                                        pq=34
    BBB         old        dsiuhfdcndhjd      mno=345                         kate       23456667
                                                     cd=56
                                                     ij=89
    i.e each of the new values in the description column of my spreadsheet would occupy a newline inside the same cell.I do not know how this can be achieved in the SQLplus. Do we need to add any formatting parameters in the sql file.
    Thanks.

  • How do i open and inout an XLS file?

    How can I open and input info into an XLS file format?

    That is presumably a Microsoft Excel file, for which you need Microsoft Office. If you don't have that (and don't want to buy it) try Googling for OpenOffice, a free substitute.

  • How to write LOGO(SE78 CREATE) TO XLS FILE(USING OLE2 METHOD!

    HI
    FYI!
    i put a logo into sap!
    and i will download this logo into XLS file !
    how to do it!
    please give some demo code!
    thank you very much!

    Hi,
    Do you know the Bapi for qp02 .I am working on uploading changing inspection plan using bdc .I am only updating last screen details like Decimals and measurement and lower value and high value .
    I saw your post in sdn before 3 month .I think you have solution . Can you please give suggestion to me .
    How can we prepare flat file .
    Regards
    Nandan.

  • How to run a query on a external file on sqlplus

    It is too painfull when I have to script a large query on sqlplus.
    How can I do to save a query on a txt file and run it on sqlplus?

    make a file in c:\ say abc.sql
    save the query is it
    the
    SQL>@c:\abc.sql
    So simple

  • CF query save as xls file

    I have a little problem and I hopw anybody could help me.
    I have a normal select statement and I want to run the select
    and have a SAVE AS button directly on the site to save a XLS file?
    Please help me ASAP!

    The code below should get you started. Place it immediately
    after the <BODY> tag on your page. Place <CFOUTPUT>
    before your <TABLE> tag, and </CFOUTPUT>
    after your </TABLE> tag.
    Within your table, each <TR> creates a new spreadsheet
    row and each <TD> creates a spreadsheet cell. You may have to
    do a File > Save As from your browser menu to save it as a Excel
    spreadsheet.

  • How can I change data on my XLS files? I have tried to open them in Adobe reader but they can't be read!!!

    Hi. I have problems changing the data on my XLS files.I tried Adobe reader but it can't open the files.What should I do??

    XLS are Microsoft Excel spreadsheet files.  You can use Microsoft Excel to open them... or any number of compatible applications (OpenOffice, Numbers, etc).

  • How to Export BW Query Report to .csv file

    I try to export BW QueryReport to .csv file using ReportAgent and URL command in WEB Template:
    <SAP_BW_URL DATA_PROVIDER='VIEW1' CMD='EXPORT' FORMAT='CSV'>
    but can't find the result file.
    Is someone have experience in exporting BW Reports to file in automatic way?

    Another way to do it would be to use transaction RSCRM_BAPI.
    Not ideal for large volumes but allows you to extract from a query.
    Regards,
    Mike

  • Need to write query results to .xls file

    Hi All,
    My requirement is ,when i run a query from sqlplus the results should be copied to a excel sheet.But i am not able to generate the file in the correct format.Could some body please help on this..
    Thanks in advance
    Thanks
    [email protected]

    Could some body please help on this..I am sorry to see that GOOGLE, SEARCH & HELP are broken for you.
    Please be patient while repairs are completed.
    Additional information will be posted when it becomes available.

  • Saving Query as xls file (I have searched and havent found this problem)

    I am trying to save a query as a xls file. The user can
    currently save the file to there desktop but excel warns them upon
    opening it that the file is associated with a different type of
    file do you want to continue. if you choose to continue then it
    will open up fine. so it kind of works. How can i get around this?
    i can't output it as a csv because there is comma's in some of the
    data i am outputting, and if i do a tab delimited then it is
    associated with notepad by default. here is my code:
    thanks, Drew

    Try:
    <cfcontent type="application/vnd.ms-excel">
    instead of
    <cfcontent type="application/msexcel">
    Also, for future reference, you CAN create a CSV file whose
    elements contain commas if you qualify the offending fields with
    quotation marks:
    Field 1, Field 2, "Field 3, and a comma", Field 4
    Excel will be able to open those up just fine.

  • How to create a query view in sap bw?

    can any one please tell me how to create a query view in sap bw 3.5?

    Hi,
    you can do this by using Bex analyzer and WAD ..
    gop through this link ..
    http://help.sap.com/saphelp_nw70/helpdata/en/0e/1339427f82b26be10000000a155106/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0d/af12403dbedd5fe10000000a155106/frameset.htm
    hope this helps you ..
    Reagrds,
    shikha

  • How to get the query values from the url in a servlet and pass them to jsp

    ok..this is the situation...
    all applications are routed through a login page...
    so if we have a url like www.abc.com/appA/login?param1=A&param2=B , the query string must be passed onto a servlet(which is invoked before the login page is displayed)..the servlet must process the query string and then should pass all those values(as hidden values) to the login jsp..then user enters username and pswd, then there should be another servlet which takes all the hidden values of jsp and also username and pswd, authenticates the user and sends the control back to that particular application along with the hidden values...
    so i need help on how to parse the query string from the original url in the servlet, pass it out to jsp, and then pass it back to the servlet and back to the original application...damnn...any help would be greatly appreciated...thanks

    ok..this is the situation...Sounds like you have a bad design on your hands.
    You're going to send passwords in a GET request as clear text? Nice security there.
    Why not start with basic security and work your way up?
    %

  • How do I copy my old xl files from my XP machine to operate on xl for Mac on my new iMac.  When I copy them onto a stick and transfer them it automatically makes them xls files which are then corrupted when I try to open them in xl for mac

    How do I copy my old xl files from my XP machine to operate on xl for Mac on my new iMac.  When I copy them onto a stick and transfer them it automatically makes them xls files which are then corrupted when I try to open them in xl for mac

    Sorry, yes this is Microsoft Excel.  The Microsoft XP has Excel files denoted as xl, the later versions of Microsoft Excel are denoted as xls files.  The later verions of Microsoft Excel open the xl files OK, does Excel for Mac not able to do this?

  • How to create a query to see Opening stock and closing stock as on particul

    Hi All,
    How to create a query to see Opening stock and closing stock as on particul.
    Regards
    Albaik

    Hi,
    In BI 0IC_C03 will provide u the  required information and also having standard queries provided by the SAP.
    Plz find the list of Queries provided by the SAP.
    =======================================================================================================
    Inventory turnover      0IC_C01_Q0001
    Range of coverage - quantity      0IC_C01_Q0002
    Range of Coverage - Value      0IC_C01_Q0003
    Range of coverage of finished goods - quantity      0IC_C01_Q0004
    Range of Coverage of Finished Goods - Value      0IC_C01_Q0005
    Range of coverage of raw materials - quantity      0IC_C01_Q0006
    Range of Coverage of Raw Materials - Value      0IC_C01_Q0007
    Obsolete Stock on Hand      0IC_C01_Q0008
    Period-dependent requirement coverage      0IC_C01_Q0009
    Value of stock on hand      0IC_C01_Q0010
    Quantity of stock on hand      0IC_C01_Q0011
    Material consumption      0IC_C01_Q0012
    Material Movements      0IC_C01_Q0013
    Consignment stock: receipts and issues      0IC_C01_Q0014
    Valuated stock: receipts and issues      0IC_C01_Q0015
    Material stock and movements      0IC_C01_Q0016
    Material Movements (Healthcare)      0IC_C01_Q0020
    Material Consumption (Healthcare)      0IC_C01_Q0021
    Material Availability      0IC_C01_Q0022
    Inventory Turnover Frequency (Value)      0IC_C01_Q0023
    Consignment Stock Received and Issued per Unit      0IC_C01_Q0024
    Material Consumption (Quantity)      0IC_C02_Q0001
    Valuated Stock Receipts and Issues (Quantity)      0IC_C02_Q0002
    Range of Valuated Stock (Quantity)      0IC_C02_Q0003
    Inventory Turnover      0IC_C02_Q0004
    Receipt and Issue Consignment Stock at Customer      0IC_C03_Q0001
    Receipt and Issue Quality Inspection Stock      0IC_C03_Q0002
    Vendor Consignment Stock Receipt and Issue      0IC_C03_Q0003
    Receipt and Issue Stock in Transit      0IC_C03_Q0004
    Receipt and Issue of Blocked Stock      0IC_C03_Q0005
    Valuated Stock      0IC_C03_Q0006
    Stock in Quality Inspection      0IC_C03_Q0007
    Stock in Transit      0IC_C03_Q0008
    Blocked Stock      0IC_C03_Q0009
    Vendor Consignment Stock      0IC_C03_Q0010
    Consignment Stock at Customer      0IC_C03_Q0011
    Stock Overview      0IC_C03_Q0012
    Stock Overview (as of 3.1 Content)      0IC_C03_Q0013
    Quantities of Valuated Project Stock (as of 3.1 Content)      0IC_C03_Q0014
    Valuated Stock (as of 3.1 Content)      0IC_C03_Q0015
    Quantities of Valuated Sales Order Stock (as of 2.1 Cont.)      0IC_C03_Q0016
    Inventory Turnover      0IC_C03_Q0017
    Days' Supply      0IC_C03_Q0018
    SUS: Vendor Consignment Stock      0IC_C03_Q0019
    Scrap      0IC_C03_Q0020
    Inventory Aging      0IC_C03_Q0021
    Stock Overview - extended      0IC_C03_Q0022
    Demand Supply Match      0IC_C03_Q0023
    Warehouse Stock Analytics – Inventory Turnover      0IC_C03_Q0024
    Warehouse Analytics - Obsolescence and Variance      0IC_C03_Q0025
    Stock Overview: Materials      0IC_C03_Q0030
    Average Stock Value Over Time      0IC_C03_Q0031
    Stock Overview Over Time      0IC_C03_Q0032
    Range of Coverage Over Time      0IC_C03_Q0033
    ==================================================================================================
    Regards
    Ram.
    Edited by: Ramakanth Deepak Gandepalli on Jan 18, 2010 8:06 AM

Maybe you are looking for

  • Confirmation of Benefits letter as SMARTFORM

    Hi All,      I have created a smartform for the confirmation of benefits form letter and would like to use this instead of the standard SAPScript(TCODE = HRBEN0015). Is there a way to redirect it to the smartform? Please advise. Kind Regards, Daniel

  • HT4623 I have just activated voice command then i can't scrool down . It is letting me in trouble. Need Help.

    Whenever I open any game the game automatically closes. Then I open setting and saw that there is a voice command then I activated the voice command after that I can't scroll down the page so I want to OF this thing. Help Me Please. This is letting m

  • Adding scientific terms to spell check

    Hi. In terms of Maverick's Spell Check, is there a way to import a medical dictionary? Thanks

  • Entity dimension

    By what tools I can dynamically build the Entity dimension in the Planning application, except ODI, DIM and EPMA? Thanks.

  • Documents Linked to SAP Notification

    Hi All, On an SAP Notification I have configured a tab for the screen area 092 DMS LInks. Is there any way to make the All Versions button the default when you are creating, changing, or viewing a notification. Currently it is always coming up in the