Database Function
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Database Function

  1. #1
    Join Date
    Jan 2001
    Location
    St. Louis. MO
    Posts
    150

    Smile

    Can anyone tell me how to execute a function within SQL PLus that returns a value.

    Ex.

    create or replace function FN_AREA( P_Radius in number)
    return number as
    Area Number := 0 ;
    begin
    Area := (22/7) * P_radius * P_radius ;
    return Area ;
    end;
    /

    Ed

  2. #2
    Join Date
    Oct 2001
    Location
    Lexington
    Posts
    11
    SQL>declare
    2 nn number;
    3 begin
    4 nn := getmyMoney('hello');
    5 dbms_output.put_line(to_char(nn));
    6 end;

  3. #3
    Join Date
    Oct 2001
    Location
    Lexington
    Posts
    11

    Thumbs up

    Hey...Don't forget to
    SQL> set serveroutput on
    before executing the function.
    You know that :-)
    Good luck

  4. #4
    Join Date
    Aug 2001
    Location
    Waterloo, On
    Posts
    547
    Select FN_AREA(x) from dual;

    where x is your P_Radius.

    Raminder Singh

    Oracle Certified DBA: Oracle 8i, 9i


    Mail me at raminderahluwalia@rediffmail.com.

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