2 Replies Latest reply: May 3, 2013 12:16 PM by InoL RSS

    i hate function.

    1002942
      the only thing i hate about programming is function. if any of u got a spare time can u help me resolve this problem so i can study from it :)

      Create a function with the name get_distance. This function receives four parameters of the data type number. These parameters are actually two coordinates describing spatial information. The first coordinates (y1, x1), and the second coordinates (y2, x2), where y-values indicate the distance in meters from the equator, and the x-values indicate the distance in meters from the Greenwich meridian. The function should return the distance in meters between the two points.

      In order to solve the task, you should be familiar with the Pythagorean Theorem. PLSQL Built-in-functions: SQRT(9) = 3, POWER(3,2) = 9.


      .......................................................................................................................................................................................................

      Create a function get_return_date. It is intended to be stored in a variable that is printed on a lease.

      Example: One person goes into a hire firm and rents an item in, say 7 days. If it is the 4th of October at 23:59, the function returns: date + hour + minutes,
        • 1. Re: i hate function.
          ck
          999939 wrote:
          the only thing i hate about programming is function. if any of u got a spare time can u help me resolve this problem so i can study from it :)
          Functions is one of the main part of programming technics. You just want to get answer into your lesson given by your instructor. Please dont hate you just dont know it.

          PLEASE READ :

          https://forums.oracle.com/forums/ann.jspa?annID=432

          Create a function with the name get_distance. This function receives four parameters of the data type number. These parameters are actually two coordinates describing spatial information. The first coordinates (y1, x1), and the second coordinates (y2, x2), where y-values indicate the distance in meters from the equator, and the x-values indicate the distance in meters from the Greenwich meridian. The function should return the distance in meters between the two points.

          In order to solve the task, you should be familiar with the Pythagorean Theorem. PLSQL Built-in-functions: SQRT(9) = 3, POWER(3,2) = 9.
          this is simple example.. you can modified in simplified manner. Just try i dont have any sql available.
          function get_distance(y1 number, x1 number,y2 number, x2 number) return number is
             distance number;
             first_cor number;
             second_cor number;
          begin

             first_cor := (y1-x1);
             second_cor := (y2-x2);  
             distance := sqrt(power(first_cor,2) + power(second_cor,2));  
             return distance;
          end get_distance;
          distance := sqrt(power(y1-x1,2) + power(y2-x2,2));  try this also
          based on this

          The Distance Formula:

          The distance formula is a method of determining the distance of a line segment between two points. It can be derived using the Pythagorean theorem.

          The distance formula follows:
          x and y are the x,y coordinates for the first point
          a and b are the x,y coordinates for the second point
          d is the distance between the two points

          About the date
          Please google it or look at the forms builder help about  DATE FUNCTION, TO_CHAR FUNCTION, SYSDATE

          Edited by: ck on May 1, 2013 12:26 AM
          • 2. Re: i hate function.
            InoL
            the only thing i hate about programming is function.
            Then you must hate programming a lot! Programming is all about creating functions and procedures.