Saturday, March 21, 2009

Basic Function

I'm training for a half-marathon, but have to run a certain number of miles per hour to be able to qualify. Can I do it?

Two values get passed to the function in the order in which they are presented. The function returns one value to the program.

The Function:

Create Or Replace
Function My_Speed
(My_Mileage Number
,My_Time Number
)
Return Number
Is
Begin
Return My_Mileage/My_Time;
End;
/

Calling the Function:

Begin
DBMS_Output.Put_Line ('MPH: '
|| My_Speed(&Miles,&Hours)
);
End;
/

No comments:

Post a Comment