DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Adding Procedures/Functions to an existing Oracle Package

  1. #1
    Join Date
    Nov 2003
    Posts
    31

    Adding Procedures/Functions to an existing Oracle Package

    Hi All,

    I would like to know if I can add a function to an existing package. For example, here is how my package is defined:

    CREATE OR REPLACE PACKAGE BODY cpack AS

    PROCEDURE AddStudent (p_id in students.id%TYPE) IS

    BEGIN
    INSERT INTO students (id) values (p_id);
    COMMIT;
    END AddStudent;

    END cpack;

    The above package has already been created in the database.

    I would like to add another procedure to the above package:

    create or replace procedure DropStudent (p_id IN students.id%TYPE)
    AS
    BEGIN
    DELETE from students WHERE id = p_id;
    COMMIT;
    END DropStudent;

    Questions:

    1. Is it possible to add this procedure to the existing package?
    2. Is it any different when we add functions to an existing package?
    3. Any syntax you can provide in doing so would be greatly appreciated.

    Thanks,
    Sankar.
    Last edited by sankar6254; 03-21-2005 at 07:25 PM.
    Sankar B. Mandalika

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    There is no command to add a procedure or function, you just replace the existing package and body definitions with "create or replace package ..." and "create or replace package body ..."
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Nov 2003
    Posts
    31
    Thanks you very much for the detailed explanation. It worked great.
    Sankar B. Mandalika

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width