Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Paris
    Posts
    1

    Unanswered: create function..

    Hi,
    I want to create a function (by script) only if it does NOT exists already...

    How do I "know" if a function is already present ?

    Thanx.

  2. #2
    Join Date
    Oct 2003
    Posts
    26

    Re: create function..

    Query user_source or user_objects

    HTH
    Arvind

  3. #3
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    311
    hi,

    or u put an extra begin and end around the code that creates the function. Then declare an extra exception trapping the oracle exception saying the function already exists, and then do null.

    For example

    function x .....
    is
    .....
    function_exists execption;
    pragma exception_init ( function_exists , <-oracle errornumber>);
    begin
    begin
    create function
    exception
    when function_exists
    then
    null;
    end;
    .....
    end;

    Hope this helps
    Edwin van Hattem
    OCP DBA / System analyst

Posting Permissions

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