Concatenate the address lines (some fields will be empty)

Hi people,

I need to format an address with transport flows properly and no blank lines between the two. I tried to look for a similar thread but did not find anything (I'm sure that). I leave the names in this exercise that my main problem is with formatting the address correctly.

Assumptions:

1. city, State and ZIP Code on a single line

2. Add 2 and Add3 should be on the same line

My exits address should be the following:

Student ID 1001

2070

The University Avenue

Berkeley, CA 94704 (city, State and ZIP Code on a single line)

Student ID 1002

Department of physics

2111 Bancroft way Berkeley UC (add 2 and Add3 should be on the same line)

Berkeley, CA 94720

Student ID 1003

100 market Street

San Francisco, CA 94114

Student ID 1004

342 happy Valley Road

Fremont, CA 94212

Table scripts and data:

create table STUDENT_ADDRESS_TB (student_id   
VARCHAR2 (4).
street_numberVARCHAR2 (20).
ADD2VARCHAR2 (50).
Add3VARCHAR2 (50).
CityVARCHAR2 (30),
StateVARCHAR2 (2),
Zip_codeVARCHAR2 (10));

insert into student_address_tb (student_id,street_number,add2,add3,city,state,postal_code) values ('1001','2070','University Avenue',null,'Berkeley','CA','94704');
insert into student_address_tb (student_id,street_number,add2,add3,city,state,postal_code) values ('1002','Physics Department','2111 Bancroft Way','UC Berkeley','Berkeley','CA','94720');
insert into student_address_tb (student_id,street_number,add2,add3,city,state,postal_code) values ('1003',null,'100 Market Street',null,'San Francisco','CA','94114');
insert into student_address_tb (student_id,street_number,add2,add3,city,state,postal_code) values ('1004',null,null,'342 Happy Valley Road','Fremont','CA','94212');

Any help in this regard would be great!

Here's what I came up with but it does not work as I want it.

SELECT street_numberLigne_adresse_1,
decode (add2, null, add3, add2 |) » '|| Add3)Ligne_adresse_2,
decode (city, null, null, city | ',' |) State | » '|| Zip_code)address_line_3
OF student_address_tb;

Thanks in advance.

Post edited by: Roxyrollers

Hello

Roxyrollers wrote:

Hi Frank,.

I'll leave the separate name and include any in my exercises:

Looks like his work for the first two, but I get the distribution additional return for 1003 and 1004 students. This is of course due to the first CHR (10) as student 1003 and 1004 have no street number. I tried to change x, but I still land by getting the return transport.

NVL2 (street_number, NULL, street_number | 10 |)

Remember how NVL2 works.  The 2nd argument is what you want to return if the 1st argument is not NULL, and the 3rd argument is what you want, if it is NULL.  So you say, ' if street_number is not NULL, then return NULL; otherwise return newline. »

Reverse 2nd and 3rd arguments, like this:

NVL2 (street_number

street_number | CHR (10)

NULL

)

Notice how, in response to #2 above, the 2nd argument of NVL2 was never NULL; It was the 3rd argument which was NULL,

Tags: Database

Similar Questions

  • How to open a new tab from the address line?

    How to open a new tab from the address line?

    You will need to hold down the ALT key and press ENTER to open the link in a new tab without the use of an extension cord.
    By default the links always open in the same tab.

    You can search the Addons site for an extension if you want to change this default behavior.

  • Why most of the tabs open empty with the label "New tab" and "topic: vacuum ' in the address line to the restart of Firefox since installing Firefox 28?"

    I have a system dual-bootable Windows Vista SP2 and Firefox updated to 28 on both systems. Since the update of the tabs more reopen empty with the label "New tab" and "topic: vacuum" in the address line of Firefox is restarted. The tabs that open correctly seem to be those who in fact, I was at the session of prefious. I can recover the missing tabs using the Session Manager to pick up a previous session, but of course it does not pick up the tabs open in future sessions. It seems that the tabs that I go to the session recovered are saved correctly, as indicated above, but which are not revisited in the context of the use of the session retrieved will drop the URL next time that I open Firefox it again.

    jdgale:

    I don't have the time to do it. However, 29 is just around the corner and we will put in the channel of exit 29, then hope that the issue is not you.

    P.S. I had originally chosen your last answer as the solution that you have migrated more to 29 but it seems that you have taken off. I'll be marking your last answer as the solution so that we can get out of the queue.

  • After VO extension update the page for some fields on a page does not work

    After VO extension update the page for some fields on a page does not work. The message arrives the data are saved, but the values is the same as that of the former. And this happens with only a few fields, other fields are working well.

    Any pointer to solve problems will be of great help.

    Thank you in advance.

    Check if the standard VO has a RowImpl and it overrides the methods getter and setter for fields that is affected. If so, you will need to call super() in your custom extended RowImpl to call this logic.

    See the link below for how to call great from the extended RowImpl.

    Johny tips: OAF: transient attributes not getting filled extended vo

    Example Code:

    public String getAttribute1() {
       //return (String) getAttributeInternal("Attribute1");
      return super.getAttribute1();
     }
    

    If the above did not help, attach standard and custom VO files. We can have a look.

    See you soon

    AJ

  • Cannot write to the address line

    There is an address written on the address line (google.com) and he accepts not to delete it or to write another address. The same phenomenon occurs on the search engine on the right.
    I just uninstalled and reinstalled the program, but nothing has changed.

    Try to start FIrefox in Mode safe mode, the problem is maybe an add-on:

    Also try the scann your PC:

  • Toolbar above the address line has disappeared (File, Edit, View, etc.)

    Notice that the toolbar above the address line on my Firefox home page is missing... the line with "File, Edit, View, history, etc.

    Can not find a way to recover... without it, I'll just go back to IE.

    In Firefox 3.6 and later Windows, you can hide the "menu bar" by "view > toolbars" or through the context menu on a toolbar.

    Press F10 or press and hold the Alt key to bring up the 'Menu Bar' temporarily.

    Go on "view > toolbars" or right-click the 'menu bar', or press Alt + V T to select the toolbars to show or hide (click on an entry to switch from the State).

    See also what happened to the file, edit and view menus? and http://kb.mozillazine.org/Toolbar_customization

  • The access key to set the text in the address line cursor (and other quick access keys)

    The access key which defines the text cursor to the line of the Web address (in some versions (3.0, 4.0) of MS Internet Explorer IE < Ctrl + F4 >)? Or how to assign a?
    And where is the list of all the hotkeys using FireFox?

    (Mozilla/5.0 (X 11; U; Linux i686; en-US; RV:1.9.2.11) Gecko/20101026 Hat/3.6-2.el5 red Firefox/3.6.11)

    Hello

    Please try Alt + D. Firefox keyboard shortcuts.

  • What is the meaning of "some elements will also be deleted 2 albums".

    I am about to delete some pictures of my iPad because I transferred to my computer and do not need copies of the photos.  When I select the photos on my iPad and then click on delete, I get the message "some items will also be deleted in 2 albums."  What does that mean?

    The albums that you create on the device do not really contain copies of the photos. These albums just contain pointers to pictures that allow them to appear in the albums you have created. The message means exactly what he says. If you delete photos from the film, they will be deleted albums form the two that you 'placed' in.

  • WHERE CAN I FIND THE ADDRESS BOOK. YOU WILL NEED TO CREATE AN ADDRESS BOOK WHICH CAN EXPORT ADDRESSES TO PRINT ADDRESS LABELS.

    HAVE A NEW MACBOOK PRO AND I AM LOOKING FOR THE ADDRESS BOOK THAT I SEE WHEN I GOOGLE BUT CAN'T FIND HOW THE LAUNCH OR IF IT IS AN APP.  I WANT TO BE ABLE TO EXPORT PAGES, ETC., TO PRINT A GROUP OF LABELS. ANY HELP OUT THERE LIKE CHRISTMAS IS COMING AND YOU WANT TO PRINT LABELS FOR CHRISTMAS.  I KNOW IM LAZY, DON'T LIKE THE HAND OF LABELLING.

    GERRY

    Read http://www.macworld.com/article/1157749/business-software/pageslabels.html

    Please stop typing in upper case. In addition to being hard to read, too rude, because it is considered as shouting on the web.

  • How can I insert a CSV file that has empty fields? (Some fields must be empty) CS4

    Hey, it's the first time I did a data merge in InDesign. I'm trying to insert a list of addresses that often has blank fields in it. The fields are empty because some fields are not relevant for some people (i.e. some of the people do not have cell phones have no other email addresses) so these people would obviously leave these empty. The problem is when I make a data merge that I thought that the CSV file will not import because some fields are empty. I don't know why InDesign tells me this, or some fields are empty they are not relevant for this person. Is someone can you please tell me how I can work around this problem?

    Sounds more like you have an empty cell in the column header line, but there is data that columns somewhere below...

  • Button refresh does not appear in the address bar and Favorites bar is empty when I first start FF30

    When I launch Firefox 30, my favorite bar is empty. I have to deselect in view > toolbars, and select new it and they appear.
    Also, my refresh button at the far right of the address bar has disappeared and all I see is a magnifying glass.
    Another question, I now have is that when I copy and paste the URL of any page in the location bar, this then triggers a Google search and go directly to the page associated with the URL.
    I tried to rename the profile FF and uninstalling/reinstalling FF, but this has not resolved.
    Pointers as my next step should be would be appreciated.
    IM using Windows 7 Professional 32-bit SP1

    Hi Tora Bisu,
    Thanks for the reply, but that did not help me because you didn't tell me where to find the ' Stop/reload button Hide URL' parameter, and I couldn't find myself.
    However I have addressed myself in addons successively disabling and re-enabling them until I discovered the culprit.
    The culprit that I discovered was the classic theme restaurateur, who has now been duly disabled and will not be used again.

  • Deletion of commas on the address line.

    I need to remove the comma an address field:

    substr (s_claim_periods.latest_prop_addr (claims.cla_refno), 1, 255) AS D,.

    I tried my usual method

    translate (CONTACT_ADDRESS, ', ' ' ")

    but incorporating im having problems with command substr!

    Hello, try:

    REPLACE(CONTACT_ADDRESS, ',' ,' ')
    
  • Why when I including an email tab I get click.email in the address line of Firefox?

    Most of the time when I click on a tab in an email in Thunderbird, Firefox comes up with "http://click.email" instesd of "http://www." as it should. Some ot the time I get out of the "click.email" and enter "www." and it's going to happen, but most of the time, it goes to "cannot find server".

    Try disabling add-ons in Thunderbird, it may be because of some add-on that adds the click.email.

  • How can I replace the default search (Yahoo...) with Google engine, when I write a word in the address line?

    Recently, I installed FireFox on my new pc. Whenever I type a Word, for example a name of a Web site, I get the resault search yahoo, instead of what I had before - to enter directly on the site, or in some cases - get Google search results.
    I would like to be able to type the name of the site (for example - "filefactory") and are directed to the site itself, as it was with the previous version I had in my old pc.

    Thank you...

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

    You can change the pref keyword. URL on the topic: config page to use Google's "I'm Feeling Lucky" or "Browse by name" Google.

  • Just installed 32.0.2. All the icons on the address line disappeared including the arrow of backup.

    That's about all. I can click when the icons were and they work, but "open menu", favorite icons, history lack. I'll try to reinstall 32.0.2

    So I downloaded and installed it again and the images of the icons are back.

Maybe you are looking for

  • Sam 1400-103: how to find support to repair my laptop

    Hello Could someone tell me how to find support to repair my laptop S1400-103I need to change the motherboard firstI'm in the Netherlands, and I don't know how to fix the process.If anyone has any information I will be happy Today, it does not start

  • Problem of delay time PXI-5105

    Hello I'm running the PXI-5105 (@ 60Msa/s/ch 12 bit 8Ch) using the attached VI. I put it to trigger off channel 0 to 1V.  When I put in a sinusoidal waveform of cycle 5, it seems that the scope triggers too late and I only see 4 of 5 cycles.  I confi

  • 3D photo orthographic view zoom control - camera put in place?

    I try to display two controls 3D image.  A poster of the 3D objects (Auto Projection: Perspective, Camera Controller: spherical).  This 3D image works fine and I have no problem with him.  Other Contol photo is intended to simulate a 2D to 3D, essent

  • Upgrade to XP 7

    I heard the upgrade directly to 7 from XP is going to be super painful.  I see the Microsoft Web site meantions none of this, but seems to be forcing people to buy Vista and get a free upgrade to 7 when it is released.  Is it true that the update of

  • Can not move icons on the desktop

    Can not move icons on the desktop