Wish I knew where I stole this from.  If I knew, I'd created them . . .
Good luck!
Barb


Generic DBMS_SQL procedure:

/* to execute: EXECUTE exec_ddl ('SET TRANSACTION USE ROLLBACK SEGMENT r05')
*/
CREATE OR REPLACE PROCEDURE exec_ddl
        (p_statement_txt        VARCHAR2)
AS
-- This procedure provides a way to dynamically perform any
-- DDL statements from within your normal PL/SQL processing.
  lv_exec_cursor_num    PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
  lv_rows_processed_num NUMBER      := 0;
  lv_statement_txt      VARCHAR2(30000);
BEGIN
  lv_statement_txt := p_statement_txt;
  DBMS_SQL.PARSE (lv_exec_cursor_num, lv_statement_txt,
  dbms_sql.native);
  lv_rows_processed_num := DBMS_SQL.EXECUTE (lv_exec_cursor_num);
  DBMS_SQL.CLOSE_CURSOR (lv_exec_cursor_num);
EXCEPTION
  WHEN OTHERS THEN
    IF DBMS_SQL.IS_OPEN (lv_exec_cursor_num) THEN
       DBMS_SQL.CLOSE_CURSOR (lv_exec_cursor_num);
    END IF;
  RAISE;
END exec_ddl;
/
show error




> ----------
> From:         Bernard, Gilbert[SMTP:[EMAIL PROTECTED]]
> Reply To:     [EMAIL PROTECTED]
> Sent:         Friday, March 29, 2002 7:54 AM
> To:   Multiple recipients of list ORACLE-L
> Subject:      Dynamic create and execute procedure
> 
> I need to create a generic dynamic procedure to create and execute any
> procedure I wish.
> 
> 
>       ===================================================================
> 
> 
> 
> 
>       -- 
>       Please see the official ORACLE-L FAQ: http://www.orafaq.com
>       -- 
>       Author: Jack van Zanen
>         INET: [EMAIL PROTECTED]
> 
>       Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
>       San Diego, California        -- Public Internet access / Mailing
> Lists
>       --------------------------------------------------------------------
>       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).
> 
>       -- 
>       Please see the official ORACLE-L FAQ: http://www.orafaq.com
>       -- 
>       Author: 
>         INET: [EMAIL PROTECTED]
> 
>       Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
>       San Diego, California        -- Public Internet access / Mailing
> Lists
>       --------------------------------------------------------------------
>       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).
> -- 
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> -- 
> Author: Bernard, Gilbert
>   INET: [EMAIL PROTECTED]
> 
> Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
> San Diego, California        -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> 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).
> 
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Baker, Barbara
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
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