Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Dynamic create and execute procedure

RE: Dynamic create and execute procedure

From: Baker, Barbara <bbaker_at_denvernewspaperagency.com>
Date: Fri, 29 Mar 2002 07:43:27 -0800
Message-ID: <F001.00436981.20020329074327@fatcity.com>


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:Gilbert.Bernard_at_caissedesdepots.fr]
> Reply To: ORACLE-L_at_fatcity.com
> 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: nlzanen1_at_EY.NL
>
> 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: ListGuru_at_fatcity.com (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: dgoulet_at_vicr.com
>
> 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: ListGuru_at_fatcity.com (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: Gilbert.Bernard_at_caissedesdepots.fr
>
> 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: ListGuru_at_fatcity.com (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: bbaker_at_denvernewspaperagency.com

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: ListGuru_at_fatcity.com (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).
Received on Fri Mar 29 2002 - 09:43:27 CST

Original text of this message

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