Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to search a string
Stephen,
I think you did not answer his question. He has Tweety,Bird and needs
to parse it.
Alien,
check out the instr() function. Your query will look something like
this:
SELECT substr(fullname,1,instr(fullname,',')) as name1,
substr(fullname,instr(fullname,',')+1) as name2
FROM thistable
WHERE key=my_key;
NOTE: untested, I don't have ORACLE or my manual handy. But if you look
up the substr() and instr() functions, I'm sure you'll get it working.
Drop me a line
if you still need help.
ED
Stephen Ashmore wrote:
>
> select name1||','||name2 from nametable
> where name1 = 'Tweety'
> and name2 = 'Bird';
>
> Should give you Tweety,Bird
>
> Stephen C. Ashmore
> Brainbench MVP for Oracle Administration
> http://www.brainbench.com
>
> <alien_pt_at_clix.pt> wrote in message news:3c3775cc.6346225_at_news.clix.pt...
> > hello
> >
> > i need using only sql to divide a string by the ', ' for example a
> > string like this 'name1,name2' i need to get name1 and name2
> >
> > thanks
-- Edward J. Prochak --- Magic Interface, Ltd. Ofc: 440-498-3700 on the web at --- http://www.magicinterface.com email: ed.prochak_at_magicinterface.comReceived on Mon Jan 07 2002 - 20:21:36 CST
![]() |
![]() |