Since the creation of an Index is DDL and DDL can not be written directly
into a procedure then you need to use Execute Immediate (or a couple of
other options, but if you have Oracle 8 or later this works fine) to call
the statement.  The trick - don't put the semi-colon at the end within the
string - it will cause an error.  Other than that you should have no real
problems (except perhaps permissions / roles / etc that plague all
procedures).

Regards,
      Mark.

Simplified Example:

BEGIN

EXECUTE IMMEDIATE 'CREATE INDEX BLAH ON'||
   'BLAH'||
   'BLAH';

END;
/



                                                                                       
                                               
                      roland.skoldblom@                                                
                                               
                      ica.se                   To:       Multiple recipients of list 
ORACLE-L <[EMAIL PROTECTED]>                  
                      Sent by:                 cc:                                     
                                               
                      [EMAIL PROTECTED]         Subject:  Create index script in 
pl/sql                                                
                                                                                       
                                               
                                                                                       
                                               
                      05/06/2003 20:54                                                 
                                               
                      Please respond to                                                
                                               
                      ORACLE-L                                                         
                                               
                                                                                       
                                               
                                                                                       
                                               




Hallo all,

anyone whom could help me with this:

I would like to have an example of pl/sql procedur which does the
following:

CREATE INDEX ART_HIERARKI_LOCKEDIX1 ON
  ART_HIERARKI_LOCKED(SELSKAP, SETT_ID, VGRP, ART_GRP, ART_UGRP)
  TABLESPACE PBKIX PCTFREE 10  STORAGE(INITIAL 65536 NEXT  PCTINCREASE  )
;

CREATE UNIQUE INDEX PK_ART_HIERARKI_LOCKED ON
  ART_HIERARKI_LOCKED(SELSKAP, SETT_ID, ARTNR)
  TABLESPACE PBKIX PCTFREE 10  STORAGE(INITIAL 65536 NEXT  PCTINCREASE  )

So the pl/sql procedur should create those 2 indexesd, how can I write the
pl/sql code then?


Thanks in advance


Roland



--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   Privileged/Confidential information may be contained in this message.
          If you are not the addressee indicated in this message
       (or responsible for delivery of the message to such person),
            you may not copy or deliver this message to anyone.
In such case, you should destroy this message and kindly notify the sender
           by reply e-mail or by telephone on (61 3) 9612-6999.
   Please advise immediately if you or your employer does not consent to
                Internet e-mail for messages of this kind.
        Opinions, conclusions and other information in this message
              that do not relate to the official business of
                         Transurban City Link Ltd
         shall be understood as neither given nor endorsed by it.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Mark Richard
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to