Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Help me with this query!
Be careful with the query that you have below. I usually add
a delimiter into the mix to separate the two values.
Consider this problem: t1 has c1='A' and c2='BB', so c1||c2
= 'ABB'. Now t2 has c1='AB' and c2='B'. In that case, c1||c2
also equal 'ABB', even though the respective c1 and c2
values are not equal. I've actually encountered this problem
in real life (why I know about it<g>). So I tend to do
something like this:
delete T1
where C1||'*'||C2 in (select C1||'*'||C2 from T2);
This should work for numeric data, because asterisks are not valid in numbers. For character data, you need to be careful that none of the field values in question contains an asterisk, or whatever character you choose to use.
Best regards,
Jonathan Gennick
mailto:jonathan_at_gennick.com * 906.387.1698
http://Gennick.com * http://MichiganWaterfalls.com * http://MetalDrums.org
Monday, January 15, 2001, 6:16:18 AM, you wrote: BNR> One query that comes to my mind is:
BNR> delete T1
BNR> where C1||C2 in (select C1||C2 from T2);
BNR> Is there any other efficient way of doing this? Received on Mon Jan 15 2001 - 12:37:05 CST
![]() |
![]() |