Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PLSQL and substr problem
Delete from table X
where exists
(select 'x' from table Y
where y.column_name like substr(x.column_name,1,7)||'_'
)
This should be all, no need to use a loop.
Hth,
Sybrand Bakker, Oracle DBA
M.Jord <mjjugs_at_gofree.indigo.ie> wrote in message
news:eNfw3.3884$r4.2249_at_news.indigo.ie...
> I am trying to select the first seven char of a 8 characters column within
a
> large
> table.
> & then compare this with existing seven digit numbers.
> If there is a match then I need to delete the seven digit numbers.
>
> I have used a loop and substr(col.name,1,7) to select the digits into a
> cursor, and tried to compare this to a 2nd cursor which contains the 8
> digits.
> Can anyone help me write the pl/sql script to do this
> task.
> eg
>
> Table X
>
> Herd no
> A1093459
> A109345 >for deletion
> B2062768
> B206276 >for deletion
>
>
>
>
>
>
Received on Mon Aug 23 1999 - 14:38:56 CDT