Add blank lines to select

Hi, I have the select statement
select bz.type_id, bz.year, bz.amount_cars
      from  my_table bz
        order by bz.type_id, bz.year
the output looks like this:
type_id, year, amount_cars
581     2013     3
581     2014     3
581     2015     3
581     2016     3
581     2017     3
641     2013     59
641     2014     60
My problem: I need to always show the next five years. If the table is not for the type_id then it must be generated some how:
type_id, year, amount_cars
581     2013     3
581     2014     3
581     2015     3
581     2016     3
581     2017     3
641     2013     59
641     2014     60
641     2015     0
641     2016     0
641     2017     0
Hope you can help.

See you soon

Tobias

A way

select *
from my_table;

TYPE_ID YEAR AMOUNT_CARS
------- ---- -----------
    581 2013           3
    641 2013          59 

with t as
(select type_id,yr
 from
  (select distinct type_id
   from my_table),
  (select extract(year from sysdate)+level yr
   from dual
   connect by level <= 5)
)
select type_id,year,sum(amount_cars) amount_cars
from(
    select bz.type_id, bz.year, bz.amount_cars
    from  my_table bz
    union all
    select type_id,yr,0
    from t)
group by type_id,year
order by type_id, year;

TYPE_ID YEAR AMOUNT_CARS
------- ---- -----------
    581 2013           3
    581 2014           0
    581 2015           0
    581 2016           0
    581 2017           0
    641 2013          59
    641 2014           0
    641 2015           0
    641 2016           0
    641 2017           0 

 10 rows selected 

Published by: JAC on November 6, 2012 14:32

Tags: Database

Similar Questions

  • &lt; xsl: attribute name = "break-before" &gt; page &lt; / xsl: attribute &gt;-add blank lines

    Hello.
    < xsl: attribute name = "break-before" > page < / xsl: attribute >-add blank lines.
    When to transfer the lines to the next page with the command
    < xsl: attribute name = "break-before" > page < / xsl: attribute >, a new page at the beginning of a blank line, then the data. And so on all pages. If < xsl: attribute name = "break-before" > page < / xsl: attribute > removed, the XML Editor displays all the lines correctly.

    I can send RTF and XML files.

    Does anyone know how can I solve this problem?
    Thank you

    Send me the xml files and the [email protected] model. I'll take a look. Also, can you clarify your needs and deliver a little clearer in your email?

    Thank you!

  • Add blank lines to the report

    I create a report that lists a training topic and current employees who must complete the course. I would like to add a number any white lines (part of the page) to the bottom of the report to accommodate non-registered participants. This report will be printed, signed and then used as input to record the training.

    I know I can do a UNION at the bottom of the report, but I would like to than the number of lines to set using a hard rather than coded page element. Someone at - it an idea?

    I tried
    ...
     union
    select NULL, NULL, NULL, NULL, NULL
      from EMPLOYEES
     where rownum <= :P1727_BLANKS
    but this gives me a line no matter what.
    ...
    union all
    select null, null, null, null, null
    from dual
    connect by rownum <= :P1727_BLANKS
    
  • Adding blank lines to collections is displayed in an area of report

    How can I add blank lines to a collection that appears in a report from the region? I am viewing a collection area of report and have created a button 'Add as many lines' in the context of this region. I would like to add blank lines to the collection and displays the region again when the user clicks this button. Is this possible in Apex 4.0?

    Thank you

    Salome

    Hi Marc,

    Of course, this is possible.

    Pretend I'm a before the process of header on my page that creates my collection like this:

    BEGIN
       IF NOT APEX_COLLECTION.COLLECTION_EXISTS('EMP') THEN
          APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B (
               p_collection_name => 'EMP',
               p_query => 'SELECT EMPNO, ENAME FROM EMP');
       END IF;
    END;
    

    And I have a report like this region source:

    SELECT APEX_ITEM.TEXT(1, c001) empno,  -- be sure to define column as Standard Report Column
           APEX_ITEM.TEXT(2, c002) ename   -- be sure to define column as Standard Report Column
      FROM apex_collections
     WHERE collection_name = 'EMP'
    

    Then I can set a button called Add Row and made it to trigger a process of PL/SQL like this:

    APEX_COLLECTION.ADD_MEMBER(p_collection_name => 'EMP');
    

    You can improve this option to add a set number of lines by calling add_member in a loop, or go further and have an element of the list with values of 1, 2, 5 etc., so that the user can select the number of lines to add before clicking on a button to add lines.

    Hope this helps,
    John

    If you find this information useful, please do not forget to mark the 'useful' or 'correct' post so that others benefit as well.

  • Add new line of vacuum for ePub Using Adobe InDesign CS5.5

    Hello

    I am new to ePub, I test ePub to see the possubilities and made a lot of success.

    I am facing a problem I don't know how to do.

    I need to creat empty new line betwwn the title and the body of the text, I know that the more difficult is to make an image for the title and other chassis for the body, it will take a lot of time to complete the book.

    I tried to add blank lines with the button Enter on my keyboard, but does not work.

    Thanks in advance

    Less familiar with CSS than Bob does, I managed by defining a paragraph style for the title that has a large amount of the space below.

    While white space (returns, etc.) is ignored when InDesign generates the CSS, styles of paragraph with space before and after are converted into equivalent CSS settings.

  • SQL add a blank line will cause

    Hello

    Currently, I use a temporary table to add a blank line to the top / the beginning of my results of the query. I'm moving to stored procedures in MS SQL and wanted to know if it is possible to add a blank line directly in my SQL, so I can remove the solution in the temporary table.

    Any thoughts on this is appreciated!

    cfwild

    Hello

    Thanks for the idea. It worked perfectly! For those seeking just a line insert empty 'above' the results of the query, here was the final code:

    SELECT the category
    SYNDICATION
    UNION
    SELECT "
    ORDER BY category

    Once again, thank you for the help!

  • I'm taking a vector object, say a flower, compensate for a path, then get a vector path around the outside edge of the offset.  I take my flower, add a line, compensate for this trait, then select Add to Pathfinder, which gives me visually the exact offse

    I am taking a vector object, say a flower, compensate a path then get a path independent vector around the outside edge of the offset.

    I take my flower, add a line, compensate for this trait, then select Add to Pathfinder, which gives me visually the exact shape of offbeat perimeter I'm looking for.  The problem is that this isn't a vector path in its own right.  Is there a way to get Illustrator to recognize the lag shot as it is vector own way

    Please forgive me if my terminology is off that I am not a formally trained graphic designer.

    MP,

    If I (put) understand it, object > decaying appearance.

    There is a difference between effect > Pathfinder and window > Pathfinder.

  • Add a line of empty in a table when the checkbox enabled

    Hi all

    I have a custom page with 2 check boxes and a few fields, I do the operation of research by entering a check mark and a few other fields and display data in the table region.

    My requirement is when I select the second check box and click a button, such as add new line it must create an empty row in the table, means table should available with an empty line so that the user can insert data.

    Please help me on this

    Thnaks

    Hello

    If you work with the advance table so you have a default option to create a blank line, please through the topic "add another line."

    Jdev Guide.

    If you work the ordinary table area, then you can follow the below proposed code.

    Create a new item of type button (no submit button) and handle the event in your controller class PFR

    String addRow = pageContext.getParameter (EVENT_PARAM);   "addRow" is an event attached to table

    If ("addAnotherRow". Equals (AddRow))

    {

    am.invokeMethod ("AddRow");

    }

    In the AMimplementation class:

    Public Sub::AddRow()

    {

    OAViewObject headerVO = (OAViewObject) getsdaPacelineWorkupHeaderUpdateVO1 ();

    rowh = (sdaPacelineWorkupHeaderUpdateVORowImpl) headerVO.getCurrentRow () sdaPacelineWorkupHeaderUpdateVORowImpl;

    rowh.getPacelineHeaderId ();

    OAViewObject lineVO = (OAViewObject) getsdaPacelineWorkupLineUpdateVO1 ();

    Line lineRow = lineVO.createRow ();

    LineRo row = lineVO.last ();

    lineRow.setAttribute ("PacelineHeaderId", rowh.getPacelineHeaderId ());

    lineRow.setNewRowState (Row.STATUS_INITIALIZED);

    lineVO.last ();

    lineVO.next ();

    lineVO.insertRow (lineRow);

    lineVO.setCurrentRow (lineRow);

    lineVO.setCurrentRow (lineVO.last ());

    }

    Note : replace your name instead of sdaPacelineWorkupHeaderUpdateVO1() vo

    Please let me know if you have any questions.

    Kind regards

    Had

  • Multiple add possible lines?

    Hello

    I created a form simular in tabular form several example Dennis Kubicek.

    If you add a row in the first table form and do not save the record, it will be deleted if you add a row in the second table form.
    I was wondering if there is a way to back up the folder of the first form when you add a line in the second form?

    Rgds,

    Astrid

    Published by: Astrid on November 18, 2008 23:44

    Hi Astrid,.

    There are several possibilities, you can try (I don't have necessary to several tabular forms so have not tried these myself):

    1. make sure that the SQL statements include a line empty. For example:

    SELECT NULL EMPNO, NULL EMPNO_DISPLAY, NULL ENAME FROM DUAL
    UNION ALL
    SELECT EMPNO, EMPNO EMPNO_DISPLAY, ENAME FROM EMP
    

    The first line of the form will be empty and still appear. If the user fills in a row for a form and submits the page (or click the add a line), a blank line will still create again for both forms.

    2 - Turn the button, add a line to trigger the creation of a line for BOTH forms

    3 - using javascript to create the line (I've seen examples of people who are trying to do, do not know if there are however examples of work)

    4 - put something in a field that creates a real record - probably can cause more problems than it solves, although

    Andy

  • question about wordpad, because the lines are separated by a blank line

    When I type in WordPad, the lines are separated by a blank line, that is, the 1st line climbs to the 3rd line, with the 2nd empty line, it takes double up typing something.  It's the same thing with the types of different fonts.

    I tried to use 1.0 spacing of lines in the tab "paragraph" Section; but this tab doesn't seem to work properly.  The lines are always separated by a blank line.

    Looking forward to your reply and thank you.

    Wu Carlotta

    Set the line spacing to 1.0 and uncheck the ' Add 10pt space after paragraphs... :-)

  • How to add a line empty

    Hello

    I know this is very basic, I ask, but I'm going crazy trying to find it.

    I want to draw a blank line between to LabelFieds.

    Something like:

    Label1

    Label2.

    I know there is a function that does this, but I can't remember it and I am not able to find it in google.

    Thank you!

    VFM. Add (new SeparatorField (Field.NON_FOCUSABLE));

  • How to add two lines when the second row is not visible, but also gets the first data line too?

    Mr President

    Jdev worm is 12.2.1

    How to add two lines when the second row is not visible, but also gets the first data line too?

    I want to add two lines like below picture, but want the second to remain invisible.

    tworows.png

    I asked this question but my way of asking was wrong, that's why for me once again.

    Concerning

    Try to follow these steps:

    1. in the database table to add the new column "JOIN_COLUMN" and add the new sequence "JOIN_SEQ".

    2. Add this new column in the entity object. (You can add this in entity object by right clicking on the entity object and then select "Synchronize with database" then the new column and press on sync)

    3. in your bookmark create button to create only one line NOT 2 rows.

    4 - Open the object entity--> java--> java class--> on the entity object class generate and Tick tick on the accessors and methods of data manipulation

    5 - Open the generated class to EntityImpl and go to the doDML method and write this code

      protected void doDML(int operation, TransactionEvent e)
      {
        if(operation == DML_INSERT)
        {
          SequenceImpl seq = new SequenceImpl("JOIN_SEQ", getDBTransaction());
          oracle.jbo.domain.Number seqValue = seq.getSequenceNumber();
          setJoinColumn(seqValue);
          insertSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        if(operation == DML_UPDATE)
        {
          updateSecondRowInDatabase(getAttribute1(), getAttribute2(), getAttribute3(), getJoinColumn());
        }
    
        super.doDML(operation, e);
      }
    
      private void insertSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "Insert into table_name (COLUMN_1,COLUMN_2,COLUMN_3,JOIN_COLUMN, HIDDEN_COLUMN) values ('" + value1 + "','" + value2 + "','" + value3 + "','" + joinColumn + "', 1)";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
      private void updateSecondRowInDatabase(Object value1, Object value2, Object value3, Object joinColumn)
      {
        PreparedStatement stat = null;
        try
        {
          String sql = "update table_name set column_1='" + value1 + "', column_2='" + value2 + "', column_3='" + value3 + "' where JOIN_COLUMN='" + joinColumn + "'";
          stat = getDBTransaction().createPreparedStatement(sql, 1);
          stat.executeUpdate();
        }
        catch (Exception e)
        {
          e.printStackTrace();
        }
        finally
        {
          try
          {
            stat.close();
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }
      }
    
  • How to remove the numbers on blank lines without fully justify above the text?

    Hello everyone.

    I have a problem with my numbering.  I would like to delete the line numbers where there is no text.  But when I back off the line of text without deleting the number, then shift + return to add a paragraph break 'justifies all lines'.  He said that it's always "justify the last line aligned to the left", but is not, and I can't change it back. I tried to manually change the justification, but it is so hard to do with all the paragraphs, and it looks like not equal. I have attached a few screenshots to illustrate my problem.

    Anyone know how I can remove the numbers of the lines without text without manually clicking the line line, ranging from 'bullets and numbers' and clicking on 'none' for each line?

    Or if I can't do that, do you know how I can stop the above paragraph that justify completely once I deleted the number of rollback?


    Thank you very much in advance, I really appreciate all the help you can give.  It's great that forums like this are there to help.


    justification issue.jpg

    Above is the screenshot where you can see that there are a number (25) on the empty text line.
    This is when I removed by backspacing of the line and then shift + return to add a new line, but her line above is fully justified, and not justified with the last line aligned to the left.

    justification issue2.jpg

    Thanks for your help!  Natasha, a user of InDesign beginner.

    Return shift is a forced line break, so you now a last blank line, and is the one who remains aligned. ID does exactly what it's supposed to.

    Instead of trying to use blank lines to separate paragraphs you should use space after or front of the space.

  • 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

  • Add several lines in tabular form which object to list different shows to all rows

    Hello

    Apex 4.2, oracle 11 g 2

    I have a table on the emp table where when I click on Add button line

    then I get no lines that are stored in the string.

    for this element of the page creation PX_job that return the value of separate employment with two points separate values by the

    for example seller: Analyst: Clerk: Manager: President

    to add several lines to add lines.

    by using the dynamic action

    event: click on

    selection type: button

    Action: run javascript code

    as follows

    var a = $v("PX_job").split(":") // Delimiter is a string
    for (var i = 0; i < a.length; i++)
    {
    
    apex.widget.tabular.addRow();
    
    }
    
    

    This work that well it adds the number ranks equal to 5

    now I'm post job as select list

    now I want to display the list of work in form of tables as row 1 poster list entry, second row entry list second poster... last line shows last entry from list

    but working this column in all the rows by first writing list of projects in the work list

    How to solve this problem.

    Leave.

    Hi, go,

    Yes, you need to replace "myvalue" with the return value of the select list. But even in this case it would be a problem because it would change all the lines.

    In any case, I changed the code to do this:

    apex.widget.tabular.addRow (); Add the line

    var checkboxIndex is apex.jQuery('input[name=f01][value=0]').eq (i) .parent () .parent () .index ();. get the number of the line that was added

    var SelectItem = apex.jQuery('select[name=f04]').eq (checkboxIndex); Use this number to get the selection list

    iOption var = apex.jQuery (SelectItem) .children () .eq (i) .val (); Get the i option value

    apex.jQuery (SelectItem) .val (iOption); Set the value of the option

    I hope it's clear.

    Kind regards

    Joni

Maybe you are looking for