Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: sql Query problem

Re: sql Query problem

From: Pascal BRENNER <pbrenner_at_lgs.ca>
Date: 1997/04/30
Message-ID: <01bc5536$538d5ee0$8d0402c2@pbrenner>#1/1

> Title GivenNames FamilyName
> ----- ---------- ---------
> Mr Kim Gary Jones
>
> what i need returned is
>
> Mr K. Jones
>
> I need only the first initial and there to be only 1 space between the
> MR the K. and Jones
>

I'm not sure I understand correctly what you want to explain but if your problem is to extract only the first letter or a column just use "substr" ORACLE function and concatenate by a double pipe a dot after this function. "lpad" ORACLE function just remove trailer spaces.

And the SQL select will be :

        SELECT LPAD(title)||' '||substr(givennames,1,1)||'. '||familyname FROM <your table>

And you will obtain "Mr K. Jones" as the result

feel free to send me a email for further explanation.

Pascal BRENNER
LGS Europe / Paris / France



Pascal BRENNER / LGS Europe / Paris
Australia, as soon as possible . . .

Phone Number : 33 1 46 12 64 97
EMail : pbrenner @ lgs-europe.fr


Received on Wed Apr 30 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US