This content has been marked as final. Show 2 replies
999939 wrote: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.
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 :)
PLEASE READ :
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.this is simple example.. you can modified in simplified manner. Just try i dont have any sql available.
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.
function get_distance(y1 number, x1 number,y2 number, x2 number) return number isdistance := sqrt(power(y1-x1,2) + power(y2-x2,2)); try this also
first_cor := (y1-x1);
second_cor := (y2-x2);
distance := sqrt(power(first_cor,2) + power(second_cor,2));
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 datePlease 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