Foramt shifts positions when the previous column is null

This piece of code is producting of erroneous results
column    RZFIDOC_STATE_CODE      format a2 justify right;
column    RZFIDOC_ZIP                    format a9  justify right;
column    SPACE                            format a10;
column    RZFIDOC_BIRTH_DATE      format a8 justify right;
 
 rpad(nvl(RZFIDOC_ZIP,'           '),9)||
 rpad('           ',10)||
rpad(to_char(RZFIDOC_BIRTH_DATE,'MMDDYYYY'),8)||                                      
results when the postal code is null
 
Chagrin Falls               OH44023              031719872828675182  223526
Singapore 400832                               092819850089012602  223526   
results when the postal code is not null (perfect)
CT06517              072019872948824782  
CT06519              072019872948824782    
When the zip code is null it moves of the RZFIDOC_BIRTH_DATE to the left, where the postcode is not null, it charted in the right column...
I need to have 10 (fill) between RZFIDOC_ZIP and RZFIDOC_BIRTH_DATE
Any help will be very grateful!

Published by: user648177 on April 17, 2009 05:05

Hello

VG2 suggested using NVL (col, ' '), so that you would never of NULL values. It is essential that the second argument of NVL not be NULL.
The string literal "(with nothing between the single quotes) is null.
Then change

rpad(nvl(RZFIDOC_STATE_CODE,''),2,' ')

TO

rpad(nvl(RZFIDOC_STATE_CODE,' '),2,' ')

Tags: Database

Similar Questions

  • find the cumulative sum of the previous columns

    Hello

    How can I get the cumulative sum of a particular column in the preceding lines in the current line.
    e.g. I have a table produced,

    Date | Orders
    __________________
    1 JANUARY 10 | 3
    JANUARY 2, 10. 5
    JANUARY 3, 10. 1

    I want to select the date and orders between the 1st and the 3rd. Something like...
    Select the Date, the orders for products where Date between to_date('1-JAN-10') and to_date('3-JAN-10')

    But I want the output like this...

    Date | Orders
    __________________
    1 JANUARY 10 | 0
    JANUARY 2, 10. 3
    JANUARY 3, 10. 8

    Similarly, when I select it between 2 and 3, I want the output voltage...

    Date | Orders
    _________________
    JANUARY 2, 10. 3
    JANUARY 3, 10. 8

    and so on. In the output, orders here are the cumulative sum of the previous columns.

    Published by: eric clapton, November 8, 2010 20:45

    Hello

    Use the analytical SUM function.
    You want to filter by date after the cumulative SUM is calculated, so calculate the SUM in a subquery, then filter by date no later than:

    WITH     got_cm_orders     AS
    (
         SELECT     dt
         ,     orders
         ,     SUM (orders) OVER (ORDER BY dt) - orders
                   AS cm_orders
         FROM     products
    )
    SELECT     dt
    ,     orders
    WHERE     dt     BETWEEN     DATE '2010-01-02'
              AND     DATE '2010-01-03'
    ;
    
  • using outer joins if the two column is null? Use only (+)

    Hi all

    create the table xxc_tr_num (tl_number number, tr_no number tl_no_id);

    insert into xxc_tr_num values (123,100,222);

    insert into xxc_tr_num values (124,100,333);

    create the table xxc_od_tab (tl_number number, tl_id number);

    insert into xxc_od_tab values (123,001);

    insert into xxc_od_tab values (null, null);

    create table xxc_oth_tab (name varchar2 (10), number of tl_id);

    insert into xxc_oth_tab values('abc',,001);

    insert into xxc_oth_tab values (null, null);

    Wait it out put

    tr_no tl_no_id name

    100 222 abc

    100 333

    using outer joins if the two column is null? use only please of outer joins

    And I tried to use outer joins on both tl_id column but not get values and I use have County (tr_no ) > 1

    Rajesh123 wrote:

    Thank you Kiss it is not possible to use having clause?

    You need to understand the functioning of the group. If you will not be asked this question.

    Check this box

    SQL> select tr_no,
      2         tl_no_id,
      3         count(*)
      4    from xxc_tr_num a,
      5         xxc_od_tab b,
      6         xxc_oth_tab c
      7   where a.tl_number = b.tl_number(+)
      8     and b.tl_id = c.tl_id(+)
      9   group
     10      by tr_no
     11       , tl_no_id;
    
         TR_NO   TL_NO_ID   COUNT(*)
    ---------- ---------- ----------
           100        333          1
           100        222          1
    

    See what returns the count? You have grouped according to TR_NO and TL_NO_ID. You must take into consideration the TL_NO_ID just put COUNT (TR_NO) does not increase the NUMBER of the whole group. To get the NUMBER on the whole group, I used the analytical function and did. Like this, see the number of the analytical function here

    SQL> select tr_no,
      2         tl_no_id,
      3         count(*),
      4         count(*) over(partition by tr_no)
      5    from xxc_tr_num a,
      6         xxc_od_tab b,
      7         xxc_oth_tab c
      8   where a.tl_number = b.tl_number(+)
      9     and b.tl_id = c.tl_id(+)
     10   group
     11      by tr_no
     12       , tl_no_id;
    
         TR_NO   TL_NO_ID   COUNT(*) COUNT(*)OVER(PARTITIONBYTR_NO)
    ---------- ---------- ---------- ------------------------------
           100        222          1                              2
           100        333          1                              2
    

    So to answer your question, yes you can't do in the HAVING clause...

  • Manage the new position of the table column / movement event

    How to catch the event when the table view column are repositioned. Essentially, when the column is repositioned at the 5-position 1 position, I would like to upgrade from the db. I searched the API, but could not find one.

    Thank you.

    		   
  • How to take the new start of table in the same position as the previous and only randomize the newObjec

    So I'm trying to do 5 boxes/ships (3Blue and 2 Greens) appear in a random position (1-Gree, 2nd - blue, blue-3rd, 4th-green, green-5 or some other random way) I have the corner of the stage. Bring down. Make a new 5 boxes and position them on the same position the previous 5 and only get randomized (not with the 5 previous, it does at the moment). And that then they move down.  so far code I have is:

    import flash.events.Event;

    var shipCount:Number;

    var shipCount2:Number;

    var shipArray:Array = new Array();

    var shipArrayPosition:Array = new Array();

    var count: int = 0

    var positionsX:Array = ["50" "100", "150", "200", "250"]

    addEventListener (Event.ENTER_FRAME, everyFrame)

    function everyFrame(ev:Event):void {}

    counter ++

    If (counter % 70 == 0) {}

    doShips()

    }

    positionShips()

    trace (shipArray.length)

    }

    function doShips() {}

    shipCount = 3;

    shipCount2 = 2;

    var distance = 10;

    for (var i: int = 0; i < shipCount; i ++) {}

    var s = new ship;

    shipArray.push (s);

    s.x = s.width/2 + (s.width* i) + gap * I

    addChild (s)

    shipArrayPosition.push (s);

    }

    for (var j: int = 0; j < shipCount2; j ++) {}

    s = new Ship2.

    shipArray.push (s);

    }

    var array: Array = new Array();

    While (shipArray.length > 0) {}

    var: index: uint = Math.floor (Math.random () * shipArray.length);

    Array.push (shipArray [index]);

    shipArray.splice (index 1);

    }

    shipArray = array;

    shipsArray has been randomized

    for (var k: int = shipArray.length - 1; k > = 0; k-) {}

    shipArray [k] .x = positionsX [k]

    addChild (shipArray [k])

    }

    }

    function positionShips() {}

    for (var i: int = shipArray.length - 1; i > = 0; i--) {}

    shipArray [i] .moveDown (//what) code in the class of the ship and Ship2-> only: this.y += 3

    }

    }

    and how to stay in one position. Must not move in any position x when the 5 new are added

    It is even more effective, because it removes the ships that moved out of sight:

    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    
    var numShips:int = 5;
    var shipCount:int = 3;
    var shipArray:Vector. = new Vector.();
    var counter:int = 0
    var positionsX:Array = [];
    
    init();
    
    function init():void
    {
              // populate positions
              for (var i:int = numShips - 1; i >= 0; i--)
                        positionsX.push(50 * i);
    
              addEventListener(Event.ENTER_FRAME, everyFrame);
    }
    
    function everyFrame(e:Event):void
    {
              counter++
              if (counter % 70 == 0)
                        doShips();
              positionShips();
              trace(shipArray.length);
    }
    
    function doShips():void
    {
              var gap = 10;
              var s:MovieClip;
              var shipsLine:Sprite = new Sprite();
              shipsLine.cacheAsBitmap = true;
              addChild(shipsLine);
              shipArray.push(shipsLine);
              shuffle(positionsX);
              for (var i:int = numShips - 1; i >= 0; i--)
              {
                        s = i < shipCount ? new Ship() : new Ship2();
                        s.x = positionsX[i] + gap;
                        shipsLine.addChild(s);
              }
              shipsLine.y = -shipsLine.height;
    }
    
    function shuffle(a:Array):void
    {
              for (var i:int = a.length - 1; i >= 0; i--)
              {
                        var r:int = Math.floor(Math.random() * (i + 1));
                        var t:Object = a[r];
                        a[r] = a[i];
                        a[i] = t;
              }
    }
    
    function positionShips():void
    {
              for each (var shipLine:Sprite in shipArray)
              {
                        shipLine.y += 3;
                        // remove line that moved out of stage
                        if (shipLine.y > stage.stageHeight + shipLine.height)
                        {
                                  removeChild(shipLine);
                                  shipArray.splice(shipArray.indexOf(shipLine), 1);
                        }
              }
    }
    
  • Why can I only position when the recipient signs and not where I signed?

    When I check the "Preview, position the signatures or add form fields" box, then click on 'Next', I am presented with a page where I can adjust the position of the box where the recipient signs.

    Is there a way that I can move the box where do I sign? I've tried everything.

    Thank you

    Hello Riskfreerepair,

    If you as the sender wants also e - sign the document, and then under the sent tab, be sure to check "I have need to sign" as first or last, and then in the page preview, you can set the signature field is assigned by the evolution of the role participating in the top left.

    Kind regards

    -Usman

  • Compare the value of the column with the previous column and Populate values

    Hi all


    Please help me to get the required sql

    I have a table T1 as example below

    Id1 Id2 Column1 Column2
    1 1 name1 null
    1 2 name2 XYZ
    1 3 name3 null
    1 4 name4 abc
    1 5 name5 null



    If the value is null, ishould then fill with the previous value. until he finds a following value.
    The result should be as below

    Id1 Id2 Column1 Column2
    1 1 name1 null
    1 2 name2 XYZ
    1 3 name3 XYZ
    1 4 name4 abc
    1 5 abc name5

    Please help me to get the required sql

    Thanks in advance

    Hello

    Here's one way:

    SELECT    id1
    ,       id2
    ,       column1
    ,       LAST_VALUE (column2  IGNORE NULLS)
                     OVER ( PARTITION BY  id1          -- if needed
                                ORDER BY         id2
                       )        AS column2
    FROM      t1
    ORDER BY  id1, id2                         -- if needed
    ;
    

    I'm guessing only a few things, as what makes a line 'previous' or 'next '.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using. «LAST_VALUE...» IGNORE NULLS"requires that Oracle 10.1 or higher.

  • % of column based on one of the lines in the previous column

    Hello.

    I need to build the report that follows in the responses:
    Column 1 is sales and expenses.
    Column 2 is all lines in column 1 divided by the first row of the column 1 (costs divided by sales) * 100

    ----------------Value---%
    Sales... 1000 100
    Purchase-400 - 40
    Staff costs. -100-10
    Advertising - 50-5
    Result... 450 45

    My problem accessing the sales column line 1 och, use it in a formula in column 2.
    Someone knows a way to solve this in the answers?

    Oracle BI Server is 10.1.3
    Joel

    Published by: joel_s on August 19, 2011 07:35

    Published by: joel_s on August 19, 2011 07:36

    Published by: joel_s on August 19, 2011 07:36

    Published by: joel_s on August 19, 2011 07:37

    Hi Joel,

    If you want it in % of the total, then the formula will be col1_measure/sum(case when dimension = sales then col1_measure else 0 end).

    If you want a percentage of a group (for example account_id) then the formula will be col1_measure/sum(case when dimension = sales then col1_measure else 0 end by account_id).

    Kind regards

    Robert

    Published by: Robert Tooker August 19, 2011 08:37

    Published by: Robert Tooker August 19, 2011 08:40

  • Tween current position after the previous tween movieclip

    I hope someone can give me a hand with a little script I'm trying to drag a movieclip on the stage.   The clip is five times the width of the stage and I am using the Tween class to move on the stage when a key is pressed.   The interaction I want, it's that when the button is pressed the clip moves to a certain amount.   If the key again it moves further.  The script I came up with good that resuming the movieclip in the original position of the movieclip and then moving, as opposed to the displacement of the position, he has reached after clicked on the first button.

    I've tried a few things but nothing works.  The script I use now is:

    var myTween:Tween = new Tween (clouds1_mc, "x", Strong.easeOut, x-400, 5, true);

    myTween.stop ();

    I hope someone can help.

    What your button code looks like - it was just myTween.start ()?-that would be a reason for him to do the same thing again and again.  Your button must include all of the Tween code so that a Tween is again created with new starting points and end every time.

  • Find all the lines from the previous column value difference lines

    I have an interesting requirement. There is a DATE column and a user in one table and I have to find all the lines for all users for which the previous and the current line has lagged in lets say more than 30 minutes. The rows are already sorted in time.

    For example in the following table, we need to ID 4 and 6 for user 1.


    Date of the user ID
    1 1 today 1 hr. 0 Min. 0 sec.
    today 2 1 1 hour 1 min 0 sec
    Today 3 1 1 hour 29 min 0 s
    * 4-1 today 1 hour 59 min 3s *.
    5 1 today 2 hours 10 min 2 sec
    * 6 1 today 2 hours 50 min 7 s *.

    Published by: user733179 on March 5, 2009 12:00

    Hello

    To obtain a separate calculation for each value of the usr, start the analytical clause with "BY usr PARTITION":

    WITH     got_dif     AS
    (
         SELECT     id,     dt,     usr
         ,     (dt - LAG (dt)
                    OVER ( PARTITION BY  usr
                              ORDER BY          dt
                            )
              )             -- difference in days
                  * 24 * 60  AS minutes_dif
         FROM     table_x
    --     WHERE     ...     -- if needed
    )
    SELECT     id,     dt,     usr
    FROM     got_dif
    WHERE     minutes_dif     > 30
    ;
    
  • Light bar will not move from the Park position when the cover flat is in place.

    I need to copy a piece of a book of music, mark it for repetition.  The book is thick enough that I must leave the cover upward.  The first 6 copied pages OK, but now all I get is a page of alll-gray.  The light bar doesn't move; It sounds like it is stuck, but only when the cover is in place.  The cover down (copy of one sheet), it works fine.

    I thought about it!  The diference between copies who worked and those who did not was the size of the paper that I used to hide the unwanted materials.  For those who worked, the sheet lying on the light bar.

    Apparently the light bar requires a white surface facing the flat, or it won't work.

  • Can I use a Windows 7 operating system on another computer when the previous computer works in no condition?

    I bought a Windows 7 operating system and intalled in a laptop computer and active operating system.  Currently, the laptop is crushed and unusable.  I bought a new laptop without OS.  Can I use the OS that I had previously bought and used in my previous laptop in the news using the State the previous laptop is no longer in use?

    Original title: reinstalling the OS

    Yes, you can transfer it to the new computer and restart phone.

    If this is an upgrade license, the computer you transfer must have a license of previous qualification.

    You may need to reactivate by phone:

    How to activate Windows 7 manually (activate by phone)
     
    1) click Start and in the search for box type: slui.exe 4
     
    (2) press the ENTER"" key.
     
    (3) select your "country" in the list.
     
    (4) choose the option "activate phone".
     
    (5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
     
    (6) explain your problem clearly to the support person.
     
    http://support.Microsoft.com/kb/950929/en-us

  • How to make documents in a book to start when the previous document remained

    Hello

    I have a book with a lot of long documents.

    I wish that each document to start where the previous document remained, there is no white space at the end of each document.

    Here's what I have-

    and what I want-

    You have any ideas on how to achieve this? (another as combining all my documents into a single )

    Thank you for your help and the idea!

    Christopher

    You cannot move text between documents in the book, the text block flows have put an end to the last page of a document of a book.

  • How to make a form that includes the column display the product in the previous column and 50.

    Example of column 1 has the value entered 3, the next column will show 150. The column that shows 150 should also not be editable

    Ok... Use this code in the custom calculation of the total field script, then:

    Event.Value = number (this.getField("of_Empty_Ballot_PadsRow1").value) * 50;

  • Close the window when the previous button is clicked on the film

    I have a .swf movie which is accessible via a link on a Web site. At the end of the film are two buttons: one for the 'return' and one for 'Replay '. Thanks to the helpful folks on the forum here, I've got buttons working so the Back button goes to the previous URL and the Replay button, well, replays.

    However, the previous button opens a new window. Is there a piece of the Action Script 3 can I add the following to close the window in my .fla Action Script window to close the window as it jumps to the URL? Here's the script.

    Stop();

    var link: URLRequest = new URLRequest ("urlgoeshere");

    bck_btn.addEventListener (MouseEvent.CLICK, onClick);

    function onClick(event:MouseEvent):void


    {
    navigateToURL (link);
    }

    play_btn.addEventListener (MouseEvent.CLICK, regarderMovie);
    function playMovie(event:MouseEvent)
    {
    Play();
    }

    I don't have full access to the HTML page, so I can't use javascript. I work with a CMS application to add content on the site, so I need to close this window using ActionScript 3 in the .swf file.

    Thank you

    Marilyn

    No matter if you close the window?... How about you just open the page in the same page...

    use

    navigateToURL (link, "_self");

    thelegendaryghost

Maybe you are looking for