Need blnak line in query result

In sqlplus query result, i need a blank line between each row. how can I get it? solution please.

There are various ways...
If you actually want generated blank rows...
SQL> ed
Wrote file afiedt.buf
  1  select decode(rn, 1, empno) as empno
  2        ,decode(rn, 1, ename) as ename
  3        ,decode(rn, 1, job) as job
  4        ,decode(rn, 1, mgr) as mgr
  5        ,decode(rn, 1, hiredate) as hiredate
  6        ,decode(rn, 1, sal) as sal
  7        ,decode(rn, 1, comm) as comm
  8        ,decode(rn, 1, deptno) as deptno
  9  from emp, (select rownum as rn from dual connect by rownum <= 2) r
10* order by emp.empno, r.rn
SQL> /
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      1111 WILLIS     CLERK           7902 18-JAN-08        900                    20
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-81        950                    30
      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
30 rows selected.
SQL>

Similar Messages

  • I need to print one query result as a single row

    Hi,
    I need to print one query result as a single row ,which gives more than one value (of subinventories)and also i would like to print the quantity of that particular subinventory at particular place.Please suggest how can i do this in the report builder?

    Actually I need to print inventory report with subinventory break up.For that all subinventories of category code AB are taken as single row.Based on that subinventory value Quantity must be printed at that particular place.
    For ex
    Quantity
    Item no Description Subinventory Code AB_Abc AB_Def AB_ghi
    1 ***** 12 9
    2 ****** 8 5
    like that.I am waiting for the reply.Plz its some how urgent.
    Thank you,

  • Need help on retrieving query result - NPE

    Hi, I could get results with the native query in my TOAD, but I can't get it working in my session EJB. I tried both native query and EJB ql. The query created fine, as soon as I try to retrieve results, it gets stuck.
    My native query looks like this:
    Query query = em.createNativeQuery("select sum(o.amount_reimbursed) from t_expenses o where o.employee_id = '999999911' " +
    "and o.EXPENSE_ID in (select p.expense_id from T_Per_Diem_Xref p where p.expense_Type_Xref_Id=22 " +
    "and p.expense_Id in (select e.expense_Id from T_Expenses e where e.employee_Id='999999911' " +
    "and e.expense_date > to_date('01/01/2011', 'mm/dd/yyyy') and e.expense_date < to_date('12/31/2011', 'mm/dd/yyyy')))") ;
    My EJB query looks like this:
    Query query = em.createQuery("select sum(o.amountReimbursed) from TExpenses o where o.employeeId = ?1 " +
    "and o.expenseId in (select p.expenseId from TPerDiemXref p where p.expenseTypeXrefId=?2 " +
    "and p.expenseId in (select e.expenseId from TExpenses e where e.employeeId=?1 and e.expenseDate>=?3 and e.expenseDate<=?4))");
    query.setParameter(1, employeeId);
    query.setParameter(2, expenseType);
    query.setParameter(3, fDay, TemporalType.TIMESTAMP);
    query.setParameter(4, lDay, TemporalType.TIMESTAMP);
    Either one, I get NPE at the line retrieve result.
    // sumAmt = (Double)query.getSingleResult();
    List list = query.getResultList();
    if (list != null) {
    long longAmt = (Long)list.get(0);
    sumAmt = (Double)list.get(0);
    As you can see, I tried to getSingleResult, or getResultList. also tried to convert the result to Double or Long. None worked.
    Please help and thank you for your time.
    Sophia

    Frank, thank you for your reply. I have this code in my session Facade EJB, and I get the NPE in my backing bean which calls this method. When I debug the code, it appears what really cuases the problem is in this code on the line I try to assign the query result to my variable 'sumAmt = (Double)query.getSingleResult();'. In the debug, when it reaches this line, it starts to give me all kinds of pop-up windows saying couldn't find this file or that file or packages. If I get a stack trace later, I will post it. Right now I am trying to fix something else.
    Thanks, Sophia

  • Need to re-sequence query result rownumber

    I have a query that returns hundres of records and a field called [query].currentrow.  This works great as it displays the row number for the entire recordset from 1 to xxx.
    However, my customer would like this number to reset when a specific field changes.  How does one do that?  I am putting some sample code in for claification:
    Amount     Product      Number
    130           A               001
    155           A               002
    104           A               003
    198           B               004  (Customer wants this to be 001)
    133           B               005  (Should be 002)
    176           C               006  (Should be again 001)
    <cfloop query="[queryname]">
    <cfoutput>
    #Amount#  #Product#  #Number#
    </cfoutput>
    </cfloop>
    Thanks in advance for your help!

    Well, it does help if we increment the counter somewhere.
    <cfoutput query="queryname" group="Product">
         <cfset variables.displayCounter = 1>
         <cfoutput>
              #queryname.amount# #queryname.product# #variables.dsiplayCounter#
         </cfoutput>
         <cfset variable.displayCounter = variable.displayCounter + 1>
    </cfoutput>

  • Export query result on sap directories

    Hi,
    I need to export daily query result on a sap directory.
    I can't use open hub because the file is made of restricted key figures, and calculated key figures.
    Which functionality in  BI7 should i use to manage this issue? Should i use specific code?
    Thanks for your help,

    Hey Arvind,
    I'm working on a how-to guide for this. It's a work in progress, so it's not on SDN yet. Here's a draft...
    https://sapmats-us.sap-ag.de/download/download.cgi?id=VZEDPDRVHQAR055E2PVICKUGO0M54DXI7D8O1X4T3G5EXBSL1J
    As always, and comments are welcome.

  • 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

  • How to Edit Query Result of Simple Search Panel

    Hi Experts,
    I have a question regarding Simple Search Panel.
    I have made a VO that select a table which contained data like this:
    Name | Skill | Status
    Rooney | Shooting | A
    Rooney | Heading | B
    Rooney | Running | B
    Van Persie | Shooting | A
    Van Persie | Heading | C
    Van Persie | Running | B
    I successfully made a Simple Search Panel which showing all the data from that VO.
    But my requirement is I want to make a grouping of that search result, so it should be showing like this:
    Name | Skill | Status
    Rooney | Shooting | A
    - - - - - - | Heading | B
    - - - - - - | Running | B
    Van Persie | Shooting | A
    - - - - - - | Heading | C
    - - - - - - | Running | B
    As long as it is the same person with the row above, it won't print the name of the person.
    Could you please give me a pointer about this?
    Thanks in advance,
    Rheza
    Edited by: 893922 on Feb 19, 2013 3:13 AM

    Hi expert,
    My requirement is I need to override the query result from Simple Search Panel.
    The data that I provided above was just for simplify the example.
    One of my requirement is:
    - when the "status" column value is 0, I need to override this and show an image of image0.jpg
    - when the "status" column value is 1, I need to override this and show an image of image1.jpg
    Any pointers about this will be so much appreciated.
    Thanks,
    Rheza
    Edited by: 893922 on Mar 6, 2013 7:26 PM

  • How to show only the result line of a Query result ?

    Hi Experts,
    I want to show only the result line of the Query. Is this possible in query Designer ?
    In BeX Workbook, I can hide the rows but they grow or shrink dynamically and hence it is unpredictable how many rows to suppress.
    If you have any solutions/workarounds, please reply !
    Rekha

    VBA coding can be used to display just the Result rows.
    Somthing like this - modify as needed.
    This scans the range of query results looking to find the last row, then checks those rows to see if the word Result is found or not, deleting (or you could just hide) the detail rows.  There is also a LEAF option in BEx Boolean options that returns a 1 or 0 depending on whether a row is a detail or result that could also be used to hide rows rather than looking for the presence of "Result" in a particular column
    Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
    For rownum = 17 To 64000 Step 1
    ' col 2 is the Total Result, col 3 is the User Group result
    If Cells(rownum, 2) = "" And Cells(rownum, 3) = "" Then
    lastrow = rownum - 1
    Exit For
    End If
    Next
    For rownum = lastrow To 17 Step -1
    If Cells(rownum, 2) = "Result" Or Cells(rownum, 3) = "Result" Then
    Rows(rownum).Hidden = False
    Else
    ' Rows(rownum).Hidden = True
    Rows(rownum).EntireRow.Delete
    End If
    Next
    End Sub

  • Numbering query results with a line number in SQL*Plus

    Doesn't it stand to reason that in SQL*Plus there would be a way to number each query results sequentially with line numbers starting at 1 to n -- something option like from a SET command? I'm not talking about linesize.

    There's a column rownum the engine adds into the result sets, just add it to the select list. Can use it to limit the result set (with some limitations) i.e.:
    select rownum, ... from ... where rownum <= 100
    Can't use ">=", that condition will never be met but a subset could be used:
    select * from ( select rownum as linenr, tab1.* from ... ) where linenr between 10 and 20

  • Need QUERY result in Graph

    Dear Experts,
    I am having the following requirement.
              Can it be possible to present the QUERY result in Graph ?
    I read many thread in SDN, I found through APD/WAD we can do it . But I am confused.
    But I am not getting any thread , How to proceed step by step ?
    Kindly help..
    Thanks,
    Sethi

    Hi,
    If you are using Bex Query make as work book ,in that you can add charts and save as work book not as a query.
    To insert the chart
    Go to insert tab in the Excel(Work book) choose which chart  you want in that.
    After that go the chart which you have selected, right click and go to select data option, choose series for Entries and choose labels for category.
    Hope it helps.
    Thanks & Regards,
    Ramnaresh.P.

  • Need SQL Query which saves query results to an excel file

    Hi,
    I am looking for a sql query which saves/ export results of an query to a excel file
    Thanks,
    Chetan

    I am looking for a sql query which saves/ export results of an query to a excel file
    Thanks,
    Chetan
    Options:
    1) You can use
    BCP command to export result to excel
    2) Insert into excel by using OPENROWSET
    3) Use Import and Export Wizard and provide SQL query as source and Excel as destination
    Please refer:
    http://stackoverflow.com/questions/87735/how-do-you-transfer-or-export-sql-server-2005-data-to-excel
    http://www.codeproject.com/Questions/617527/Export-sql-query-result-in-excel-file
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • Stepping through a query result set, replacing one string with another.

    I want to write a function that replaces the occurance of a string with another different string.  I need it to be a CF fuction that is callable from another CF function.  I want to "hand" this function an SQL statement (a string) like this:   (Please note, don't bother commenting that "there are eaiser ways to write this SQL..., I've made this simple example to get to the point where I need help.  I have to use a "sub_optimal" SQL syntax just to demonstrate the situation)
    Here is the string I want to pass to the function:
    SELECT
      [VERYLONGTABLENAME].FIRST_NAME,
      [VERYLONGTABLENAME].LAST_NAME,
      [VERYLONGTABLENAME].ADDRESSS
    FROM
      LONGTABLENAME [VERYLONGTABLENAME]
    Here is the contents of the ABRV table:
    TBL_NM,  ABRV    <!--- Header row--->
    VERYLONGTABLENAME, VLTN
    SOMEWHATLONGTALBENAME, SLTN
    MYTABLENAME, MTN
    ATABLENAME, ATN
    The function will return the original string, but with the abreviations in place of the long table names, example:
    SELECT
      VLTN.FIRST_NAME,
      VLTN.LAST_NAME,
      VLTN.ADDRESSS
    FROM
      LONGTABLENAME VLTN
    Notice that only the table names surrounded by brackets and that match a value in the ABRV table have been replaced.  The LONGTABLENAME immediately following the FROM is left as is.
    Now, here is my dum amatuer attempt at writing said function:  Please look at the comment lines for where I need help.
          <cffunction name="AbrvTblNms" output="false" access="remote" returntype="string" >
            <cfargument name="txt" type="string" required="true" />
            <cfset var qAbrvs="">  <!--- variable to hold the query results --->
            <cfset var output_str="#txt#">  <!--- I'm creating a local variable so I can manipulate the data handed in by the TXT parameter.  Is this necessary or can I just use the txt parameter? --->
            <cfquery name="qAbrvs" datasource="cfBAA_odbc" result="rsltAbrvs">
                SELECT TBL_NM, ABRV FROM BAA_TBL_ABRV ORDER BY 1
            </cfquery>
         <!--- I'm assuming that at this point the query has run and there are records in the result set --->
        <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
        <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
        </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
            <!--- The chunck below is a parital listing from my Delphi Object Pascal function that does the same thing
                   I need to know how to write this part in CF9
          while not Eof do
            begin
              s := StringReplace(s, '[' +FieldByName('TBL_NM').AsString + ']', FieldByName('ABRV').AsString, [rfReplaceAll]);
              Next;
            end;
            --->
        <cfreturn output_txt>
        </cffunction>
    I'm mainly struggling with syntax here.  I know what I want to happen, I know how to make it happen in another programming language, just not CF9.  Thanks for any help you can provide.

    RedOctober57 wrote:...
    Thanks for any help you can provide.
    One:
    <cfset var output_str="#txt#">  <!--- I'm creating a local
    variable so I can manipulate the data handed in by the TXT parameter.
    Is this necessary or can I just use the txt parameter? --->
    No you do not need to create a local variable that is a copy of the arguments variable as the arguments scope is already local to the function, but you do not properly reference the arguments scope, so you leave yourself open to using a 'txt' variable in another scope.  Thus the better practice would be to reference "arguments.txt" where you need to.
    Two:
    I know what I want to happen, I know how to make it happen in another programming language, just not CF9.
    Then a better start would be to descirbe what you want to happen and give a simple example in the other programming language.  Most of us are muti-lingual and can parse out clear and clean code in just about any syntax.
    Three:
    <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
    I think you want to be looping over your "qAbrvs" record set returned by your earlier query, maybe.
    <cfloop query="qAbrvs">
    Four:
    <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
    Continuing on that assumption I would guess you want to replace each instance of the long string with the short string form that record set.
    <cfset output_str = Replace(output_str,qAbrs.TBLNM,qAbrs.ABRV,"ALL")>
    Five:
    </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
    If this is true, then you are looping over the record set of tablenames and abreviations that you want to replace in the string.

  • How to use SQL query result in DOS commands

    Hi
    Currently i am runnig below DOS commands manually
    d:\apps\bin>TrueGridsCalc period="Aug 2010"
    Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
    Steps which i am taking are
    1. connect DB from command line (using SQLPLUS)
    2. run query to fetch result
    3.How to use query result in "period" parameter ?
    I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
    Thank you
    Sachin
    Edited by: sachin.mali on Oct 26, 2010 4:39 PM
    Edited by: sachin.mali on Oct 26, 2010 4:43 PM

    sachin.mali wrote:
    Hi
    Currently i am runnig below DOS commands manually
    d:\apps\bin>TrueGridsCalc period="Aug 2010"
    Now I want to write one batch file and schedule job on windows and make value of "period" to be dynamic. So to get that value i need to fetch it from DB
    Steps which i am taking are
    1. connect DB from command line (using SQLPLUS)
    2. run query to fetch result
    3.How to use query result in "period" parameter ?
    I am good at step 1 and 2. Dnt know how to use query result in command to make it dynamic
    Thank you
    Sachin
    Edited by: sachin.mali on Oct 26, 2010 4:39 PM
    Edited by: sachin.mali on Oct 26, 2010 4:43 PMYOu'll have to have sqlplus spool the output to a file, then figure out some way of parsing that file. Too bad you're stuck with Windows. With any *nix you could do the file parsing with one line of code.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 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

  • Bex Query - Specific calculation in query result

    Hi experts!
    I've received a requirement and I cannot find any way to delivery it using the stantard operation or configuration into Bex Query.
    We have a query which have three KF with summarization in result. The new requirement is based in the KF "POND" to change the calculation in the result. Below are the actual result and the expected result.
    The actual query result.
    Line
    OP
    QTD
    TMP
    POND
    A1
    1614073
    702
    19
    13338
    Total A
    702
    19
    13338
    B1
    1587949
    840
    235
    197400
    B2
    1610938
    4.240
    28
    118720
    Total B
    5.080
    263
    316120
    Total A + B
    5.782
    282
    329458
    The expect result based on the new requerment
    Linha
    Ordem de Produção
    QTD
    TMP
    POND
    A1
    1614073
    702
    19
    13338
    Total A
    702
    19
    19
    B1
    1587949
    840
    235
    197400
    B2
    1610938
    4.240
    28
    118720
    Total B
    5.080
    263
    62
    TOTAL A + B
    5.782
    282
    57
    Check out the "Total A" result for KF "POND", the new calculation is the sum of KF "POND" divided by the sum of KF "QTD" (13338 / 702 = 19)
    The same to "Total B" result for KF "POND", the calculation is the sum of "POND" divided by sum of KF "QTD" ( (197400 + 118720) / (840 + 4240) = 62).
    I've been using all recourses into Bex query, but I've haven't found any way to deliver this requirement, though.
    I'd really appreciate if anyone could give me some suggestion to deliver this requirement.
    Thank you.
    César Sevilha.

    Hi Suman!
    Thanks for your replay.
    The collision options wont help me because I have calculation on the same structure.
    I need to keep the division POND by QTD in the result. Check out the table below.
    The Formula Bex Query (POND / QTD) is a simple division between  KF POND by KF QTD, the result
    is a totalization of lines A and B.
    The requirement is to keep this division on the result. Check out the column Requirement, this is the result expected.
      Line
      OP
      QTD
      POND
    Formula
    Bex Query (POND / QTD)
    Requirement
    A1
    1614073
    702 KG
    13.338 KG
    19 KG
    19 KG
    Total A
    Result
    702 KG
    13.338 KG
    19 KG
    19 KG
    result (POND) divided by result (QTD)
    B1
    1587949
    848 KG
    197.400 KG
    233 KG
    233 KG
    B2
    1610938
    4.318 KG
    118.720 KG
    27 KG
    27 KG
    Total B
    Result
    5.167 KG
    316.120 KG
    260 KG
    61 KG
    result (POND) divided by result (QTD)
    Total A + B
    Result
    5.869 KG
    329.458 KG
    279 KG
    56 KG
    result (POND) divided by result (QTD)
    I'd like to know how to keep the division in the result.
    Example:
    The result of Total B should be 61 kg which is the result of division between the result of KF POND (316.120) by the result of QTD (5167).The currently formula has as result the totalization  of B1 and B2.
    Thank you in advance.
    César Sevilha.

Maybe you are looking for