On 18 Feb, 15:10, "Michael Moore" <
michaeljmo...@gmail.com> wrote:
> does it have to be a pure SQL solution or can you create a PL/SQL function?
> What version of Oracle?
>
> On Feb 18, 2008 4:00 AM, robz8701 <
robz8...@hotmail.com> wrote:
>
>
>
>
>
> > I have a varchar column which contains a full address (inc. carriage
> > returns). I wish to create a view which will split this into seperate
> > address lines but I am struggling to write the correct SQL.
>
> > For example the address value is,
>
> > West Midlands Region
> > 112 Colmore ROW
> > Birmingham
> > B3 3AG
>
> > I can return the first line by using the following SQL
>
> > SELECT SUBSTR(address,1,INSTR(address,CHR(13)))
> > FROM address_table
>
> > How do I cater for the 2nd, 3rd and 4th lines automatically? Also
> > address records could be 2,3,4 or even 5 lines, it differs so I need
> > the SQL to automatically cater for this.
>