Query result format

hello friends
please suggest a sql query that will result the records with sum of the records afterevery 10 records.
eg
salary
100
200
300
400
100
50
700
100
900
20
2870
100
900
400
800
100
500
300
250
100
600
4050
thanks in advance

jowal wrote:
anyway, in pure sql this should work:Well, it is not pure sql solution. It is SQL*Plus solution. BREAK, COMPUTE are SQL*PLus, not SQL commands. Also, your code will group rows 1 - 10, 11 - 100, 101 - 1000 rather than each 10 rows. Just add one row to sample:
SQL> SET PAGES 0
SQL> COL grp NOPRINT
SQL> BREAK ON grp SKIP 1
SQL> COMPUTE SUM OF value ON grp
SQL> WITH t AS (
  2  SELECT 100 value  FROM dual UNION ALL
  3  SELECT 200   FROM dual UNION ALL
  4  SELECT 300   FROM dual UNION ALL
  5  SELECT 400   FROM dual UNION ALL
  6  SELECT 100   FROM dual UNION ALL
  7  SELECT 50    FROM dual UNION ALL
  8  SELECT 700   FROM dual UNION ALL
  9  SELECT 100   FROM dual UNION ALL
10  SELECT 900   FROM dual UNION ALL
11  SELECT 20    FROM dual UNION ALL
12  SELECT 100   FROM dual UNION ALL
13  SELECT 900   FROM dual UNION ALL
14  SELECT 400   FROM dual UNION ALL
15  SELECT 800   FROM dual UNION ALL
16  SELECT 100   FROM dual UNION ALL
17  SELECT 500   FROM dual UNION ALL
18  SELECT 300   FROM dual UNION ALL
19  SELECT 250   FROM dual UNION ALL
20  SELECT 100   FROM dual UNION ALL
21  SELECT 600   FROM dual UNION ALL
22  SELECT 999   FROM dual)
23  SELECT LENGTH(rownum) grp, value
24  FROM t
25  /
       100
       200
       300
       400
       100
        50
       700
       100
       900
      2850
        20
       100
       900
       400
       800
       100
       500
       300
       250
       100
       600
       999
      5069
21 rows selected.
SQL> You need something like:
SQL> SET PAGES 0
SQL> COL grp NOPRINT
SQL> BREAK ON grp SKIP 1
SQL> COMPUTE SUM OF value ON grp
SQL> WITH t AS (
  2  SELECT 100 value  FROM dual UNION ALL
  3  SELECT 200   FROM dual UNION ALL
  4  SELECT 300   FROM dual UNION ALL
  5  SELECT 400   FROM dual UNION ALL
  6  SELECT 100   FROM dual UNION ALL
  7  SELECT 50    FROM dual UNION ALL
  8  SELECT 700   FROM dual UNION ALL
  9  SELECT 100   FROM dual UNION ALL
10  SELECT 900   FROM dual UNION ALL
11  SELECT 20    FROM dual UNION ALL
12  SELECT 100   FROM dual UNION ALL
13  SELECT 900   FROM dual UNION ALL
14  SELECT 400   FROM dual UNION ALL
15  SELECT 800   FROM dual UNION ALL
16  SELECT 100   FROM dual UNION ALL
17  SELECT 500   FROM dual UNION ALL
18  SELECT 300   FROM dual UNION ALL
19  SELECT 250   FROM dual UNION ALL
20  SELECT 100   FROM dual UNION ALL
21  SELECT 600   FROM dual UNION ALL
22  SELECT 999   FROM dual)
23  SELECT TRUNC((rownum - 1) / 10) grp, value
24  FROM t
25  /
       100
       200
       300
       400
       100
        50
       700
       100
       900
        20
      2870
       100
       900
       400
       800
       100
       500
       300
       250
       100
       600
      4050
       999
       999
21 rows selected.
SQL> SY.

Similar Messages

  • Date format in Query Result Window

    In recent versions on OSD (trying with V3.2.20.09 Build MAIN-09.87) I've been unable to change the date format for results shown in the query results window via the NLS settings in Preferences, it's the same for other users on v3 in my area. Can anyone advice on whether anything can be done to resolve this issue or is there a bug in recent additions of OSD
    Frustrating having a result show as 01-DEC-12 and I don't know whether it's 01-DEC-2012 or our default date of 01-DEC-4712 without having to hard code a to_char in my sql which I don't want to be doing all the time to analyse my results
    I have an old version 1.5.4 Build MAIN-5940 and changing the NLS settings in preferences refrects correctly in the query results window
    Any advice appreciated, Thanks

    Thanks, looks like it's permission, tried on a different database supposed to be the same and it works when I update the preferences or run the alter session statement. Call to my admins to get on the case
    Ta
    for anyone else having simular issues, help are the statements I've tried to confirm it's permissions
    alter session set NLS_DATE_FORMAT = 'DD-MON-RR HH24:MI:SS'; -- Original
    alter session set NLS_DATE_FORMAT = 'DD-MON-RRRR HH24:MI:SS';
    commit;
    SELECT *
    FROM nls_session_parameters
    Edited by: lakeuk on 14-Nov-2012 06:37

  • Sending Email with Query Result (Table Format)

    Hi,
    I have a query result from ExecuteSQL task e.g.:
    ID Product
    1     Pencil
    2     Crayon
    3     Eraser
    I want to send an email with the above query result and I want it to be in Table format (such as in Microsoft Word with rows and column lines) to allow better readability to the receiver.
    Is it possible in SSIS?
    cherriesh

    It has to be HTML format . Read Tony's article
    http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/03/28/send-table-or-view-as-embedded-html-lt-table-gt-in-an-email-stored-procedure.aspx
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Output query result in XML format

    folks:
    could anybody provide more information
    about how to generate query result in
    xml format? looks like DBXML is for demo only
    and i have heard that PLSQL XML parser is the way to go; so far i have not found
    a sample yet on how to actually
    do the XML generation; if you know more
    about it, please let me know; thanks in
    advance.
    Bill

    Here are some sample apps that might interest you:
    [list]
    [*][url [URL=http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The]http://technet.oracle.com/tech/xml/xsql_servlet/index2.htm?Code&files/ffhome.html]The XML Flight Finder
    [*][url [URL=http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B]http://technet.oracle.com/sample_code/tech/xml/xmlb2b/doc/xb2bhome.html]B2B with XML
    [list]
    Enjoy,
    -rh

  • Date Format in Visual Studio Query Result Window

    Most vendor tools let you change the date format to show datetime in its query results window.
    But .NET does not have this.
    The ability to change this should be in located in Tools|Options but its not there.
    Can it be added in the next release?
    ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-RR HH:MI:SS' does not work. btw.
    .NET and/or ODT over-rides it.

    Why would you expect Microsoft to write stuff for an Oracle plugin?! Why on earth would you want to see anything other than the actual raw data that YOU requested in the results of a query? Surely formating/displaying a datetime is a presentation layer thing not a database layer thing! If you're really that bothered re-write your SQL till you get what you want.

  • Returning query results in XML format

    Besides using custom tag library, does anyone know any methods or techniques that i can retrive the query results from database in XML format. for example, i have a table named student in database like this:
    StudentNo  Name   Gender  Degree
    123       Tony    male    B.Comp.Sci.
    456       Tom     male    B.Fiance
    343       Mary    female  B.Accountingso, if i have query select * from table student, i would get someting like the following:
    <row>
    <studentNo>123</studentNo>
    <name>Tony</name>
    <Gender>male</Gender>
    <Degree>B.Comp.Sci</Degree>
    </row>
    <row>
    <studentNo>456</studentNo>
    <name>Tom</name>
    <Gender>male</Gender>
    <Degree>B.Finace</Degree>
    </row>
    The reason i am asking for this is i need query results returned in XML format, so i can wrap XSLT tag around, and apply for HTML, WML, and XHTML template resprectively so i can display them on different terminals. any help is appreciated.

    I have this method in a ResultSetMapper class:
         * Return result sets as an XML stream, with root tag named
         * "results", one "result" tag per row, and "result" child tag
         * names equal to the column name
         * @param query result set
         * @param list of column names to include in the result map
         * @throws SQLException if the query fails
         * @throws JDOMException if the XML stream creation fails
        public static final Document toJDOM(ResultSet rs, List wantedColumnNames)
            throws SQLException, JDOMException
            Element rows         = new Element("results");
            int numWantedColumns = wantedColumnNames.size();
            while (rs.next())
                Element row = new Element("result");
                for (int i = 0; i < numWantedColumns; ++i)
                    String columnName   = (String)wantedColumnNames.get(i);
                    Object value = rs.getObject(columnName);
                    row.addContent(new Element(columnName).setText(value.toString()));
                rows.addContent(row);
            return new Document(rows);
        }It uses JDOM from www.jdom.org. - MOD

  • Broadcasting the precalculated query results in web format

    Hi Experts,
    We have a requirement  where we need to broadcast the precalculated query results in web format, we know that we can do this through workbook, but we want to do it in web format to avoid the limitations of the workbook like number of rows in workbook limited to 65000 etc.,
    We are using 3.x environment,
    please suggest that is this functionality can be achievable, if yes how?
    Thanks in advance,
    -Vinay

    Hi All, this problem was resolved.
    Thanks,
    vinay

  • Copy BW query results with formatting

    When copying a query's results to another workbook, the formatting (namely coloring) changes.  Is there any way to copy the query results to a new workbook and keep the exact same formatting as in original query?

    One way to do this would be to copy the worksheet with the results to the other workbook, as follows:
    Edit --> Move or copy sheet... --> change "To book:" to the 2nd workbook --> check "Create a copy" option --> OK
    After doing that, you can cut & paste from the copied worksheet to other worksheets in the workbook, if necessary, and the formatting will be maintained.
    Hope this helps...
    Bob

  • Download BW Query results in HTML format

    On a daily basis, I need to get BW query results exported to an HTML extract file on the BW server.  The HTML file will then be transferred to a Windows server for use in a dashboard view by a third party developed portal.  The query has an input variable for period.
    What is the best/simplest method for scheduling an existing BW query to run on a daily basis to produce an HTML  extract / download file to the BW server file system?
    We are currently on BW 7.01 SP6.  We just completed a technical upgrade from BW3.5, but did not do a functional upgrade.
    I have read through many postings but have been unable to find a solution.  I have reviewed RSCRM_BAPI u2013 no html format.
    Any help would be greatly appreciated.
    Thanks,
    Mark Norton

    Hello Mark...
    Amer is right. You can create a broadcast setting to daily sends your
    query as MHTML format.
    You can send to your e-mail but there is a possibility to save on KM and CM repository.
    There is a little explanation on the link below:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/5c6b686a-0901-0010-8aab-c4d0e5a093a7?quicklink=index&overridelayout=true
    To create a broadcast setting, open the query via Query Designer.
    Click "Query" -> "Publish" -> "BEx Broadcaster"
    While you are creating the broadcast, there is a "Output Format" option.
    There is MHTML.
    I hope you find this information useful.
    Thanks
    Edward

  • Query required for the below result format:

    Table(DATA):
    Bank_id Device_type Status date Station_status               
    1011     N          Y     3/23/2012           DOWN
    1011          N          Y     3/23/2012          up
    1011          N          y     3/23/2012          up
    1011          E          Y     3/23/2012          down
    1011          E          I     3/23/2012          down
    1011          W          Y     3/23/2012          up
    1012     N          Y     3/23/2012           DOWN
    1012          N          Y     3/23/2012          up
    1012          N          y     3/23/2012          up
    1012          E          Y     3/23/2012          down
    1012          E          I     3/23/2012          down
    1012          W          Y     3/23/2012          up
    1013     N          Y     3/23/2012           DOWN
    1013          N          Y     3/23/2012          up
    1013          N          y     3/23/2012          up
    1013          E          Y     3/23/2012          down
    1013          E          I     3/23/2012          down
    1013          W          Y     3/23/2012          up
    (SELECT QUERY RESULT SHOULD BE LIKE THIS):Report result:
    Bank_id----Date-----TOTAL---UP_STATUS--DOWN_STATUS-----DEVICE
    1011 3/23/2012 6 3 3 N<2>N<1>,E<0>E<2>,W<1>W<0>
    1012 3/23/2012 6 3 3 N<2>N<1>,E<0>E<2>,W<1>W<0>
    1013 3/23/2012 6 3 3 N<2>N<1>,E<0>E<2>,W<1>W<0>
    N<2>N<1>,E<0>E<2>,W<1>W<0> this mean(INDICATES)
    In N 2 UP 1 DOWN
    IN E 0 up 2 down
    In W 1 up 0 down
    SCRIPTS:
    CREATE TABLE FIMS_TEST
    BANK_ID VARCHAR2(10 BYTE),
    DEVICE_TYPE VARCHAR2(10 BYTE),
    STATUS VARCHAR2(1 BYTE),
    DATE_TS DATE,
    STATION_STATUS VARCHAR2(10 BYTE)
    INSERT SCRIPT:
    SET DEFINE OFF;
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1011', 'N', 'Y', TO_DATE('03/26/2012 16:30:48', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1011', 'N', 'Y', TO_DATE('03/26/2012 16:32:26', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1011', 'N', 'Y', TO_DATE('03/26/2012 16:32:55', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1011', 'E', 'Y', TO_DATE('03/26/2012 16:33:51', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1011', 'I', 'Y', TO_DATE('03/26/2012 16:34:15', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1011', 'W', 'Y', TO_DATE('03/26/2012 16:34:39', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1012', 'N', 'Y', TO_DATE('03/26/2012 16:35:13', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1012', 'N', 'Y', TO_DATE('03/26/2012 16:35:56', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1012', 'N', 'Y', TO_DATE('03/26/2012 16:36:48', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1012', 'E', 'Y', TO_DATE('03/26/2012 16:37:17', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1012', 'E', 'I', TO_DATE('03/26/2012 16:37:42', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1012', 'W', 'Y', TO_DATE('03/26/2012 16:38:10', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1013', 'N', 'Y', TO_DATE('03/26/2012 16:38:37', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN ');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1013', 'N', 'Y', TO_DATE('03/26/2012 16:39:23', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1013', 'N', 'Y', TO_DATE('03/26/2012 16:39:54', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1013', 'E', 'Y', TO_DATE('03/26/2012 16:40:19', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1013', 'E', 'I', TO_DATE('03/26/2012 16:40:53', 'MM/DD/YYYY HH24:MI:SS'), 'DOWN');
    Insert into TEST.FIMS_TEST
    (BANK_ID, DEVICE_TYPE, STATUS, DATE_TS, STATION_STATUS)
    Values
    ('1013', 'W', 'Y', TO_DATE('03/26/2012 16:41:17', 'MM/DD/YYYY HH24:MI:SS'), 'UP');
    COMMIT;

    thanks in advance
    can any one help me please

  • How to get Query Results based on Analysis Authorization Ranges????

    Hi Experts,
    I have gone through the lot of SDN Links, however not able to find the answer to my question.
    I have an Authorization Issue, “NO Authorization “
    Error : EYE 007 ( Insufficient Authorizations )
    <b>Here is the issue:</b>
    Need to see the complete query result when I gave the range in Analysis Authorization for Controlling Area 001-005. Controlling Area is auth relevant and right now a variable is inserted in the query for it. If I select Controlling Area 001, the result for Controlling Area 001 is displayed in query. If 002 then also displayed. If I do not enter anything, then I get the <b>Eye 007 error message</b>.
    I am not sure how do I display/authorize the entire result in the query for all the Controlling Areas, I have authorized user to see??
    <b>Its really urgent, please help..!</b>
    Here are the logs:
    Authorization Check Log
    Date and Execution Time (Local Server)
    Execution Date: 06.09.2007
    Execution Time: 14:48:41
    Executed Query: 0CCA_C11/GBCCA_MP01_Q0002_AP
    Executed by User ZBI_TEST_001
    Executed with Analysis Authorizations of Another User ZBI_TEST_001
      InfoProvider Check  
    Building the Buffer...
    ...Buffer Built
    Are there authorizations for accessing InfoProvider 0CCA_C11 with activity 03?
    Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03 
      InfoProvider Check  
    Authorization exists for general access to InfoProvider 0CCA_C11 with activity 03 
      Relevant Characteristics for Detailed Authorization Check  
    (Characteristics with Full Authorization Are Not Listed!)
      List of Effective Authorization-Relevant Characteristics for InfoProvider 0CCA_C11:  
    0CO_AREA 
    0TCAACTVT 
      Relevant Characteristics for Detailed Authorization Check  
    (Characteristics with Full Authorization Are Not Listed!)
      List of Effective Authorization-Relevant Characteristics for InfoProvider :  
    List Is Empty:
      There Are No Characteristics That Have to Be Checked in Detail  
      Authorization Check  
      Detail Check for InfoProvider 0CCA_C11  
      Preprocessing:  
    Selection Checked for Consistency, Preprocessed and Supplemented As Needed
    Subselection (Technical SUBNR) 1
    Check Node Definitions and Value Authorizations...
    Node- and Value Authorizations Are OK
    End of Preprocessing
    Filling the Buffer...
    ...Buffer Filled
      Main Check:  
      Subselection (Technical SUBNR) 1  
    Supplementation of Selection for Aggregated Characteristics
      No Check for Aggregation Authorization Required  
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    CO_AREA = '0003'
    AND TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Authorized   
      Subselection (SUBNR) Is Authorized  
      Authorization Check Complete  
      Authorization Check  
      Detail Check for InfoProvider 0CCA_C11  
      Preprocessing:  
    Selection Checked for Consistency, Preprocessed and Supplemented As Needed
    Subselection (Technical SUBNR) 1
    Check Node Definitions and Value Authorizations...
    Node- and Value Authorizations Are OK
    End of Preprocessing
    Filling the Buffer...
    ...Buffer Filled
      Main Check:  
      Subselection (Technical SUBNR) 1  
    Supplementation of Selection for Aggregated Characteristics
      No Check for Aggregation Authorization Required  
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Partially or Fully Authorized (Intersection)   Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    ( CO_AREA < '0001'
    OR CO_AREA > '0005' )
    AND TCAACTVT = '03'
    Value selection partially authorized. Check of remainder at end
    Following Set Is Checked  Comparison with Following Authorized Set  Result  Remaining Set 
    Characteristic  Contents 
    0CO_AREA
    0TCAACTVT
    SQL Format:
    ( CO_AREA < '0001'
    OR CO_AREA > '0005' )
    AND TCAACTVT = '03'
    Characteristic  Contents 
    0CO_AREA  I BT 0001 0005
    0TCAACTVT  I EQ 03
    I EQ 16
    Not Authorized   
    All Authorizations Tested
      Message EYE007: You do not have sufficient authorization  
      No Sufficient Authorization for This Subselection (SUBNR)  
    Following CHANMIDs Are Affected:
    184 ( 0CO_AREA )
      Authorization Check Complete  

    Hi,
        Have you defined the vaule for 0CO_AREA as BT 001-005 in you Authorization for 0CO_AREA.Also how have you defined your Authorization Variable on the query? Have you define as select options or interval? I thing you need to define it as interval or select options.
    Hope it helps,
    Cheers,
    Balaji

  • How to output a query results into a text file

    How to output a query results into a text file instead of outputing it to the screen..
    is there a way for us to write a SQL query which specifies to output the query results to a text file.
    Pls let me know how to do it
    Thanking u in advance
    regards
    Muraly

    Muraly,
    If you are using SQL*Plus 8.1.6 or later, you can also spool output to a file in HTML format, eg
    SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON
    SPOOL c:\temp\report.html
    SELECT DEPARTMENT_NAME, CITY
    FROM EMP_DETAILS_VIEW
    WHERE SALARY>12000;
    SPOOL OFF
    SET MARKUP HTML ENTMAP OFF
    In iSQL*Plus 9.0.1 (the browser-based interface to SQL*Plus) onwards, you can also send the HTML output to a new web browser window, or an html file -- much easier than the command line method.
    Alison

  • How to add different query results in Report designer

    Hi,
    I am creating a report based on 3 queries.  At the end i need to show total of 3 query results.
    How can i add results of queries in report designer??
    thanks in advance

    Hi Siva,
    As u said that u want to show the results of the queries through report designer but i think it is used for formatted reports .
    If u want to see tha results of diffrent query then u can use workbook .
    In workbook u can also analyse reports easily by applying slice and dice techniques .
    from different queries result set will be displayed on workbook with formatting  and good look and feel.
    regards,
    Supriya

  • Export query results into .csv file?

    Hello I have a T-SQL script that gets row counts for a specified date range and then needs to loop (by incrementing +1 day to get the next day's counts) for a large date range.  I'm aiming to output & append each query results day counts
    into a .csv file via a SQL Agent job since this will take quite a while to complete.
    Would using the following as an example template...
    INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Text;Database=D:\;HDR=YES;FMT=Delimited','SELECT * FROM [FileName.csv]')
    SELECT Field1, Field2, Field3
    FROM DatabaseName
    ...be the method or something else?
    If this is good to use I've tried running this but get the following error:
    Msg 7357, Level 16, State 2, Line 76
    Cannot process the object "SELECT * FROM [FileName.csv]". The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions
    on that object.
    Thanks in advance.

    Hi Techresearch7777777,
    The error in your post says that the file FileName.csv has to be created with the column names in the first row. Like:
    Field1,Field2,Field3
    Either you can create a schema.ini file under the same folder:
     [FileName.csv]
     Format=CSVDelimited
     ColNameHeader=False
     Col1=Field1 [DataType]
     Col2=Field2 [DataType]
     Col3=Field3 [DataType]
    For the [DataType],you can reference
    Schema.ini File (Text File Driver)
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to export query results

    How can I export query results from sqlplus on the command line? Are there ways to specify the format such as CSV, TAB, XML, etc?
    I've seen one approach that involves creating a shell script and piping the output to a file:
    #!/bin/sh
    sqlplus user/password <<__EOF__
    set heading off;
    set newpage none;
    select f1, ',', f2, ',', f3 from some_table;
    __EOF__
    Then pipe the output to a file. Is there a simpler solution to this?

    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:235814350980

Maybe you are looking for