Insert a blank line in the query output

Is it possible to insert a blank line between two rows of the query output?

In the EMP table, the column LINES is as follows:

LINES
1
2
3
4
1
2
3
1
2
3
4
5

I want to insert a blank line after every 1

Please suggest.

Sanjay

I'm quite puzzled why you need rows in the dataset returned by a select statement that is empty.
If you are using Oracle reports to the release date, you define the presentation of the report to have spaces between the rows returned by the select and have do not need to have the select statement returns a blank line after each line of data. If the output should be obtained by using another client, I think that the customer will have facilities for output formatting.

Admit that you really need "blank lines" between data lines, I see only one way: use a temporary table and do an insert into select temporary_table (...) ... from... where... Then, in this temporary table, you can insert 'empty rows', which is actually not really empty, because they must have some fields that give the order of the rows. And then select in temporary_table, you place your order by the columns that are used to give the order for the release.
Thus

insert into temporary_table (
....
)
select ...
from ...
where ...
;
for r in (
select col1, col2, col3  -- columns used for order by
from temporary_table
order by col1, col2, col3
)
loop
  insert into temporary_table (col1, col2,col3, col4)
  values (r.col1,r.col2,r.col3, null);
end loop;
-- this way, a select * from temporary_tabel order by col1, col2, col3, col4 will return a blank row after each data row

Tags: Database

Similar Questions

  • Insert a blank line in the result set

    Hi friends,

    SELECT * FROM EMPLOYEES ORDER BY DEPARTMENT_ID;

    As a result of the foregoing, I need to INSERT a blank line in the result for each department_id. for example, the result should resemble the following:

    EMP_ID - NAME - SALARY - DEPARTMENT_ID
    101 - Albert - 10 000 - 10
    102 - Benjamin - 8 000 - 10

    103 - Chitra - 10 500 - 20
    104 - David - 4 500-20
    105 - Elango - 6 000 - 20

    106 - faye - 6 000 - 30
    107 - Ganga - 9 000 - 30

    etc.

    I don't want to insert into the table. I need a blank line just on the screen.

    Thanks in advance.

    Published by: James on March 8, 2010 11:37

    Something like this->

    satyaki>
    satyaki>select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>select m.empno,
      2         m.ename,
      3         m.sal,
      4         case
      5           when sal is null
      6           and  empno is null
      7           and  ename is null then
      8             null
      9         else
     10           m.deptno
     11         end deptno
     12  from (
     13        select k.empno,
     14              k.ename,
     15              k.sal,
     16              k.deptno
     17        from (
     18                select empno,
     19                             ename,
     20                             sal,
     21                             deptno
     22                from emp
     23            ) k
     24        union all
     25        select t.*
     26        from (
     27                select distinct null empno, null ename, null sal, deptno
     28                from emp
     29            ) t
     30        order by 4
     31      ) m;
    
         EMPNO ENAME             SAL     DEPTNO
    ---------- ---------- ---------- ----------
          7782 CLARK            2450         10
          7839 KING             5000         10
          7934 MILLER           1300         10
    
          7566 JONES            2975         20
          7369 SMITH             800         20
    
          7902 FORD             3000         20
          7876 ADAMS            1100         20
          7788 SCOTT            3000         20
    
         EMPNO ENAME             SAL     DEPTNO
    ---------- ---------- ---------- ----------
          7900 JAMES             950         30
          7499 ALLEN            1600         30
          7844 TURNER           1500         30
          7654 MARTIN           1250         30
          7521 WARD             1250         30
          7698 BLAKE            2850         30
    
    17 rows selected.
    
    Elapsed: 00:00:00.03
    satyaki>
    satyaki>
    

    Kind regards.

    LOULOU.

  • Word RTF Tem [plate - insert a blank line in the loop

    I'm entering my template like this XML data (this is just an example of dumbed down):

    <? XML version = "1.0"? >

    < LABEL_TEST >

    < LIST_G_TEST >

    < G_LABEL_HEADER >

    < NAME > Parent 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 2 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 3 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > 4 Parent < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 4 < / NAME >

    < / G_LABEL_HEADER >

    < / LIST_G_TEST >

    < / LABEL_TEST >

    In summary, I have a list of Parents, and if they have a child, the name of their children is below. Not all parents have children.

    If the data is a bit like this:

    Name of the parent

    Name of the child

    Name of the parent

    Name of the parent

    Name of the parent

    Name of the child

    When I loop data in my RTF model, I want to be able to insert a blank line before all of the lines 'Parent '. A bit like this:

    Name of the parent

    Name of the child

    Name of the parent

    Name of the parent

    Name of the parent

    Name of the child

    I tried to do this by adding an empty xml tag in the list, like this:

    <? XML version = "1.0"? >

    < LABEL_TEST >

    < LIST_G_TEST >

    < G_LABEL_HEADER >

    < NAME > Parent 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 1 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 2 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Parent 3 < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > 4 Parent < / NAME >

    < / G_LABEL_HEADER >

    < G_LABEL_HEADER >

    < NAME > Kid 4 < / NAME >

    < / G_LABEL_HEADER >

    < / LIST_G_TEST >

    < / LABEL_TEST >

    But that doesn't seem to work.

    Manny

    I found a solution that works very well.

    I added a new XML field to my data called .  In my model, this field is inserted in the line, but in a location where there is no data being printed. And it is formatted as white text, so that it basically just does not appear.

    So essentially, it's what I have now:

    Parent 1

    .

    Child 1

    .

    .

    Parent 2

    .

    .

    Parent 3

    .

    .

    Mother 4

    .

    Child 4

    .

    If the data is a bit like this:

    The name of the parent.

    The name of the child.

    .

    The name of the parent.

    .

    The name of the parent.

    .

    The name of the parent.

    The name of the child.

    When I loop data in my RTF model, the '. ' is a white text, then I get this:

    Name of the parent

    Name of the child

    Name of the parent

    Name of the parent

    Name of the parent

    Name of the child

  • Question: insertion of several lines in the MS Sql Server table using the DB adapter

    Hi all

    I managed to insert a single row in a table of MS SQL Server via the adapter DB to my process BPEL, but when I tried to insert in mutiple lines in the same table of MS SQL server, I encounter the error below.

    I use a DB SQL XA connection to connect to the server.

    Kindly help me to solve the problem. Thanks in advance.

    Error:

    " < bpelFault > < faultType > 0 < / faultType > < remoteFault xmlns =" http://schemas.Oracle.com/BPEL/extension "> < a name ="summary"part > < summary > exemption is is produced when the binding was used." Exception occurred during invocation of the JCA binding: "JCA binding run 'merge' reference operations have to: DBWriteInteractionSpec Execute Failed Exception." the merger failed. The descriptor name: [LoadCmpAggSpendStage.SapTable]. Caused by com.microsoft.sqlserver.jdbc.SQLServerException: incorrect syntax near ')'... Check the logs for the record output full DBAdapter before this exception. This exception is considered as reproducible, probably due to a communication failure. To be classified as not reproducible rather add property nonRetriableErrorCodes with the '102' value in the deployment descriptor (i.e. weblogic - RA.Xml). Auto retry a reproducible fault set composite.xml for this invoke these properties: jca.retry.interval, jca.retry.count and jca.retry.backoff. All properties are integers. ". The called JCA adapter threw an exception of resource. Please examine the error message above carefully to determine a resolution. < /Summary. (> < / piece > < part name = "detail" > < detail syntax > incorrect near ')'. < / details > < / piece > < part name = "code" > < code > 102 < / code > < / piece > < / remoteFault > < / bpelFault >

    Kind regards

    Balaji Rahmani

    It seems that in this case is called merge operation. If existing records (check primary key) are not there then it will be inserted on the other update. Check the syntax of the query that is created. It looks like she may have a supplement "). If you want to only insert then call insert operation and not merge.

  • Insert a blank line after each line grouped

    Oracle 11.2.0.1

    Windows XP

    I need to create a table (who have more to exported to the Excel SQL Developer) something like this:

    The user Scott Table Emp


    create the table temptbl as

    SELECT

    -case when lead (deptno) OVER (ORDER BY deptno) = deptno then empno otherwise null end AS empno.

    -case when lead (deptno) OVER (ORDER BY deptno) = deptno then ename otherwise null end AS ename.

    -case when lead (deptno) OVER (ORDER BY deptno) = deptno then job otherwise null end AS work,

    -case when lead (deptno) OVER (ORDER BY deptno) = deptno then null deptno otherwise end up LIKE deptno

    WCP

    Table created.

    SQL > select * from temptbl;

    EMPNO, ENAME, DEPTNO JOB

    ---------- ---------- --------- ----------

    7782 CLARK MANAGER 10

    PRESIDENT OF 7839 10 KING

    7566 JONES MANAGER 20

    FORD ANALYST 20 7902

    7876 ADAMS CLERK 20

    SMITH CLERK 20 7369

    7521 WARD SALESMAN 30

    7844 TURNER SELLER 30

    7499 ALLEN SALESMAN 30

    EMPNO, ENAME, DEPTNO JOB

    ---------- ---------- --------- ----------

    7900 JAMES CLERK 30

    MANAGER OF 7698 30 BLAKE

    14 selected lines.

    SQL >

    But it is not giving me the last row of deptno.  If I have to display the data on sqlplus then I can use break on jump 1, but since I create my correct query table (around 10 K lines), I just want to insert a blank line after each data grouped.

    Thank you.

    Select empno, ename, job, decode (empno, null, null, deptno) deptno emp

    Group by grouping sets ((empno, ename, job, deptno), deptno)

    /

    EMPNO, ENAME, DEPTNO JOB
    ----- ---------- --------- ----------
    7782 CLARK MANAGER 10
    PRESIDENT OF 7839 10 KING
    7934 MILLER COMMITTED 10

    SMITH CLERK 20 7369
    7566 JONES MANAGER 20
    7782 CLARK MANAGER 20
    SCOTT ANALYST 20 7788
    7876 ADAMS CLERK 20
    FORD ANALYST 20 7902

    7900 JAMES CLERK 30
    7499 ALLEN SALESMAN 30
    7521 WARD SALESMAN 30
    7654 MARTIN SALESMAN 30
    SALESMAN 7698 BLAKE 30
    7782 CLARK MANAGER 30
    7844 TURNER SELLER 30

  • How to remove the newline from the query output?

    Hello

    How to remove the newline from the query output?
    have tried to replace select (column_name, Chr (10), ' ') from table_name.

    Published by: GreenHorn 11 Sep, 2008 12:53 AM

    Please consider, that windows uses a sequence of chr13 | Chr (10) Unix uses only a single character CHR (10).
    The new line characters may depend on the operating system.

    You might consider with:

    Replace (replace (column_name, Chr (13) |)) CHR (10), ' '), CHR (10),' ')

    Hartmut

    Published by: hartmutm on 11.09.2008 01:32

  • Error: «Please insert a blank disc into the CD drive (E :).» Once Windows Media Player detects a new disc, it will start automatically burning"

    Hi, we are currently running Windows XP SP3.  My daughter tries to download a song from Windows Media Player, she needs for her class dance.  It just download the song bad by accident without problem.  Now she's trying to download the song using the same CD (CD - R80) and it gives sound this error: «Please insert a blank disc in the CD drive (E :).» Once Windows Media Player detects a new disc, it will start automatically burning."  Someone please help.  She needs this to practice his senior dance solo.

    As I understand it, the CD was already burned once, and now she's trying to burn on the same CD again? This is not possible, as the CD - Rs can only be burned once. She will need a new blank CD - R, like the error message.

  • We can insert a new line at the end of af: table declaratively?

    Mr President.

    We can insert a new line at the end of af: table declaratively?

    Concerning

    In the t impl class substitution as below, after that, you should be able to insert at the end of the table.

    @Override

    {} public void insertRow (rank)

    Line lastRow = this.last ();

    If (lastRow! = null) {}

    int j = this.getRangeIndexOf (lastRow) + 1;

    this.insertRowAtRangeIndex (j, line);

    this.setCurrentRow (row);

    } else {}

    super.insertRow (row);

    }

    }

  • Avoid blank lines at the top of the column

    So I create posts of all the two weeks and I had a question that would make my job easer.

    I've been messing around with the widow and orphans, but I have a slightly different problem.

    We use returns between paragraphs (a blank line between paragraphs), and I was wondering if there was a way to use GREP or showing something to automatically prevent blank lines at the top of a column.

    Right now, I have remove and re-add returns throughout the editing process, which as you can guess, can become messy and easy to miss.

    I wish I had where I don't have to do it all on my own, so the empty lines would be 'hide' automatically if at the top of a column, but would return if things get moved around.

    Thoughts?

    Thanks for the help.

    kwilly_1572 wrote:

    We use returns between paragraphs.

    .. can get messy and easy to miss.

    It's a reason that should not do this way. Correctly using the space before and/or after the space solves your problem.

  • missing parenthesis in insertion into separate lines select the table from the other table

    Hello

    could you help me with the following question?

    I have the following tables

    CREATE TABLE table1)

    ID varchar (12),

    col2 varchar (10),

    COL3 varchar (10),

    level varchar (10))

    CREATE TABLE table2)

    Id2 varchar (12)

    A varchar (10),

    B number (1)

    CONSTRAINT PRIMARY KEY PK (ID2, is));

    INSERT INTO table2 (ID2, A, B) SELECT ID, col2

    MAX (CASE WHEN level = "level 1" then 1

    level = 'level 2' then 2

    Level = 3 then 'niveau3') as colIN3)

    FROM table1 GROUP BY ID2, a.;

    the first table have duplicates as follows:

    Id2 COL2 COL3 level

    A1 pepe football level1

    A1 pepe football level2

    A1 pepe football level1

    A1 pepe basket level2

    A1 pepe pingpong level3

    the output should be selected with unique key (ID2, col3) lines and the level must be the greatest.

    Id2 COL2 COL3 level

    A1 pepe football level2

    A1 pepe basket level2

    A1 pepe pingpong level3

    The output of the script tells me the following messages:

    -lack of right parenthesis referring to the max function.

    Thanks adavance.

    Kind regards

    Hello

    Remember the ABC's of the GROUP BY:

    When you use a GROUP BY clause or in an aggregate function, then all in the SELECT clause must be:

    (A) a ggregate function,

    (B) one of the expressions "group By."

    (C) adding to C, or

    (D) something that Depends on the foregoing.  (For example, if you "GROUP BY TRUNC (dt)", you can SELECT "TO_CHAR (TRUNC (dt), 'Mon - DD')").

    To ask him, there are 5 columns in the SELECT clause.  The last one is a function MAX (...); It is an aggregate, is not serious.

    The first 2 columns are also named in the GROUP BY clause, so that they are well.

    The other 2 columns, country and internal_Id do not match any of the above categories.  These 2 columns cause the error.

    There are many ways to avoid this error, each producing different results.  You could

    • remove these 2 columns in the SELECT clause
    • Add these 2 columns in the GROUP BY clause
    • use the aggregation such as MIN, 2-column functions
    • remove the country from the SELECT clause and add internal_id to the GROUP BY clause
    • remove the internal_id from the SELECT clause, and add countries to the GROUP BY clause
    • ...

    What are the results you want?

    Whenever you have a question, please post a small example of data (CREATE TABLE and INSERT statements) for all the tables involved, so people who want to help you can recreate the problem and test their ideas.  Also post the results you want from this data, as well as an explanation of how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • How to integrate a mp.3 background without having a blank line above the header?

    Hello

    , I have integrated a Mp3 file that plays very well when loading the home page, however he created this white line above the header of the home page.  You can see it at http://rotorooterhsv.com

    I've embedded the file under page properties / metadata / HTML for < head >: < embed src = "music/Roto - RooterJingleFemaleSinger.mp3" autostart = "true" loop = "false" hidden = "true" > < / embed >. (The header also contains GA and a few other scripts)

    Thanks in advance for any advice!

    rotorooter screen capture.PNG

    HTML code foris not where you need to insert. As the audio player is already hidden, try to place somewhere in the page by using the object-> the option Insert HTML code. And using layers, you can place it in the back.

    Please see the following article on what labels can be added to the head section - http://www.w3schools.com/html/html_head.asp.

    Thank you

    Vinayak

  • How can I get several hyperlinks to display in the query output?

    I uses two tables to list all a school sport teams. The table of sport lists all team data aggregated by gender. The second table uses the sportID of the first table to associate a team calendar.  The problem is not all the teams do not have a calendar.

    I'm trying to post a link to these teams with schedules. I compare the two tables, the sport and the calendar and a CFIF statement allows to compare the 2 sportIDs in the output to determine the teams who have a schedule.  If the two sportIDs corresponds to a hyperlink is displayed.

    Unfortuanetely, only one link will be displayed, even if there should be three links. Here is my code:

    Table to display aggregated by gender teams

    "< name cfquery ="getSports"datasource =" #application.database # "" >

    Choose between the sexes, team, levels, sportID

    sports

    Group sex, team, levels, sportID

    < / cfquery >

    Table used for the sportID of already created calendars

    < name cfquery = "getID" datasource = "#application.database #" >

    Select sportID

    annexes

    SportID group

    < / cfquery >

    I then compare the sportIDs and if they match, I then display a hyperlink

    "< cfoutput query ="getSports"group 'sex' = >"

    < h1 "> teams #gender < / h1 >"

    < ul >

    < cfoutput >

    < li >

    < cfif getID.sportID EQ getSports.sportID > <a href = "teams.cfm? sportID = #sportID #" >< / cfif >

    #team # < cfif levels GT "" >(#levels#) < / cfif > //levels is used to differentiate the J.V. and Varsity. "." Usage levels not all of the teams

    < cfif getID.sportID EQ getSports.sportID > </ a >< / cfif >

    < /li >

    < / cfoutput >

    < /ul >

    < / cfoutput >

    How can I get the other teams to display their links?

    Thank you gentlemen, since everyone was suggesting an outer join, I took out my trusty Manual of ColdFusion and learn about them. I've added the sum() for the query:

    Select sports.gender, sports.team, sports.levels, sports.sportID, sum (schedules.sportID) AS expected

    sports

    opening hours of the outer join left on sports.sportID = schedules.sportID

    Group of sports.gender, sports.team, sports.levels, sports.sportID

    So add the following to the output:

    And everything works perfectly. Once again, life is beautiful!

  • Insert a blank space in the paragraph style?

    Is it possible to integrate a white space inserted (en character) in a paragraph style?

    I created a paragraph to chapter headings style. Chapter and number are centered horizontally on the page with a thick end line (key) on each side - a little like that, except that I use the dashboard to create the line in this example:

    -------------------------------------  Chapter 2  ------------------------------------

    Inserted white spaces before and after 'Chapter 2'.  However, when I try to apply the paragraph style to another title, the spaces are not there.

    (Line thin thickness was created as text underscore and the offset is vertically centered with the text.  It would make a difference if I created the thick end line in the form of a graph?)

    Oh and I also tried to create an object style, but it does not recognize spaces, either.  I know that something will work, but little by little learning has not met yet the solution.

    Thank you.

    Do it like this:

    1 make the high line a paragraph above net. Assign the 'Column' width (full) and set its vertical offset in right position.

    2. Add a paragraph below NET. Together, this upright even shifted, but makes a little (or a lot) more thick. Set its color [Book]. Set the width of 'Text', not 'column '. Then set the negative value of the width approx. white space you want on the left and right - something like 'mm-2' the left indent and right.

    3. you're done!

  • Need help in the design of the structure of the table with the lines of the query

    Hello

    Need to design a page

    ex:

    Select empno, emp wage; is my query and returns two columns and four rows


    the four rows should be my values in the structure of the table.


    EmpNo - salary
    ---------------------
    1 - 1000
    -----------------------
    2 - 2000
    ------------------------
    3 - 3000
    ----------------------
    4 - 4000




    Kind regards

    Krishna

    Hello

    One of the ways is to create 2 RowLayouts dynamically like this

    Row1-> Cell1--> HeaderRegion--> StaticStyleText (EMPNO attribute)
    Row2-> Cell1--> StaticStyleText (EMPNO attribute) Cell2--> StaticStyleText (SALARYattribute)

    and iterate this code for all the lines of the vo.

    Kind regards
    Mukesh Uchaniya

  • Number of lines on the query and export are different?

    Hello

    I'm kinda new to SQL Developer, but so far it has been very well. I came across a problem, but with a certain query I count the lines and get about 11 000 (which is what I expected), and then export the data to a csv file to download on another system, and somehow the number of lines is increased to 30,000? I tried several times and still get the same results, and I know that the extra lines should not be returned to request bythe they fail when uploaded to the other system.

    Does anyone have any idea why this could be? The query is a union query, but it was fine before. Looks like a bug to me, but then again that I am a newbie.

    Thank you

    Steve

    The recordtypeextract r table is not related to any other table. Link with another table and avoid the Cartesian join.

Maybe you are looking for

  • fill in the message on the opening of Thunderbird pane.

    When I open Thunderbird the message pane is empty until I click on one of the messages in the list. It is empty, there is a new message or not. Is it possible that the message pane can be automatically populated whenever I open Thunderbird? I would l

  • I cancel my Microsoft account first, cancel the Hotmail account?

    I want to cancel my account as soon as possible how can I do?

  • Very difficult to turn on computer.

    I'm having a problem when I try to turn on my computer, it lights up or start. I press the button and it flips amber for a second, but not power not on. I was leaving on afraid to stop because its hard to resume. I checked my connections and bought a

  • LogicalDisk scoping

    Hi all I'm rules by scope Services. For example I brought to CPU utilization as:(Host: $object in (((FSMService_:_name_like_'Fogl%').definition_:_$object_instanceof_FSMChildService).definition: $object instanceof FSMDynamicManagedComponent) .componen

  • Reinstalling Windows XP OS

    HY computer was hacked and phished and does not work properly. Maybe I need to reinstall the operating system. I have a set of 12 disc called "Compaq recovery one.» This retrieves only lost programs or is it format the hard drive and reinstall the os