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: Rebuild implicit index for primary key

Re: Rebuild implicit index for primary key

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 6 Jan 2007 09:19:04 -0800
Message-ID: <1168103944.899809.193390@42g2000cwt.googlegroups.com>

Franz Kruse wrote:
> Jim Smith:
>
> > ...
> > Or you could use an anonymous PL/SQL block
> >
> > declare
> > sqlstmt varchar2(1000);
> > begin
> > SELECT
> > 'ALTER INDEX '||OWNER||'.'||INDEX_NAME||' REBUILD;'
> > into sqlstmt
> > FROM
> > DBA_INDEXES
> > WHERE
> > STATUS='INVALID'
> > AND OWNER='owner_name_here'
> > AND TABLE_NAME='table_name_here';
> >
> > execute immediate sqlstmt;
> >
> > end;
> >
> > (with appropriate error checking of course)
>
> Perfect. That's exactly what I was looking for.
> Thank you very much.
>
> Franz

Franz, both Jim and Charles offered the same solution only Jim used pl/sql where Charles was telling you to use SQL to generate and run SQL but it is a lot easier to spool out a file with the actual SQL being ran and the results of the operation using an SQLPlus script than using execute immediate.

HTH -- Mark D Powell -- Received on Sat Jan 06 2007 - 11:19:04 CST

Original text of this message

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