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

Thread: pl\sql functions

  1. #1
    Join Date
    Mar 2003
    Posts
    2

    pl\sql functions

    I am currently taking a database course using oracle. I do not understand the syntax of functions. I basically program in C, Java, and VB and when I look at the example from my teacher it make no logical sense. We have a database for a charter company. We need to calculate the price of the charter.
    The calculation is (Mod_chg_mile * Char_distance + landing_fee) * 1.35

    I realize that you may not want to tell me the answer. I really need an example of what I need to do though.

  2. #2
    Join Date
    Jan 2002
    Location
    Up s**t creek
    Posts
    1,525
    Something similar to this...

    Code:
    SQL> create or replace function charter_price
      2    (mod_chg_mile  IN number,
      3     char_distance IN number,
      4     landing_fee   IN number)
      5  return number
      6  is
      7  begin
      8    return (mod_chg_mile * char_distance + landing_fee) * 1.35;
      9  end;
     10  /
    
    Function created.
    
    SQL> select charter_price(10,10,10) from dual;
    
    CHARTER_PRICE(10,10,10)
    -----------------------
                      148.5
    HTH
    Jim
    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  3. #3
    Join Date
    Mar 2003
    Posts
    2
    Thank You very much! It is a very good example and clears things up for me.

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