Provide the implementation of the following stored procedures and function. include both the PL/SQL code and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Provide the implementation of the following stored procedures and function. include both the PL/SQL code and an execute procedure/SQL statement to demonstrate the functionality. a. Create a function to calculate the distance between 2 points using Euclidean distance formula. dist=√√(Latitude - Latitude₂)² + (Longitude - Longitude₂)² * 111 Km b. A user is located at coordinate (-37.7206,145.0500). Show the distance from the user's current location to all other point objects. Show the result from the nearest objects. c. Using the trajectorypoint table, identify the period of time from the first point in each trajectory using the table below. Create a PL/SQL script to show the TrajID and period of time. Time 4am-12pm 12pm - 5pm 5pm - 10pm 10pm - 4am TRJ0001 10 Morning TRJ0002 : 13: Afternoon TRJ0003 : 10: Morning TRJ0004 : 14: Afternoon TRJ0005 : 13: Afternoon TRJ0006 : 16 : Afternoon TRJ0007 : 11: Morning TRJ0008 : 15: Afternoon TRJ0009 : 13 : Afternoon TRJ0010 : 08: Morning PL/SQL procedure successfully completed. Period of Time Morning Afternoon Evening Night Using the distance function, create a procedure named total_dist that accept objectid as the input parameter. This procedure will calculate the road length for a road type object. Hint: Use coorlist table. The length must be calculated from two consecutive points. SQL> exec total_dist ('OB0021'); Seq 1 (-37.700009, 145.0582327) Length = 0 km Seq 2 (-37.7022254,145.0574304) Seq 3 (-37.7034948, 145.0562599) Seq 4 (-37.7077456,145.0519525) Seq 5 (-37.7117952,145.047455) Length Seq 6 (-37.7128434,145.0459294) Length Length Length = : .2616 km = .4533 km Length = 1.125 km 1.7968 km 2.0023 km = 2.0664 km = 2.5718 km Seq 7 (-37.7131704, 145.0454536) Length Seq 8 (-37.7169925, 145.0429797) Length Seq 9 (-37.7177539, 145.0423095) Length Seq 10 (-37.7226433,145.0302035) Length = 4.1336 km (-37.7245782,145.0270209) 2.6844 km Seq 11 Length 4.547 km Length = 4.9438 km Seq 12 (-37.7254311,145.0235489) Total Length: 4.9438 km PL/SQL procedure successfully completed. = = = Provide the implementation of the following stored procedures and function. include both the PL/SQL code and an execute procedure/SQL statement to demonstrate the functionality. a. Create a function to calculate the distance between 2 points using Euclidean distance formula. dist=√√(Latitude - Latitude₂)² + (Longitude - Longitude₂)² * 111 Km b. A user is located at coordinate (-37.7206,145.0500). Show the distance from the user's current location to all other point objects. Show the result from the nearest objects. c. Using the trajectorypoint table, identify the period of time from the first point in each trajectory using the table below. Create a PL/SQL script to show the TrajID and period of time. Time 4am-12pm 12pm - 5pm 5pm - 10pm 10pm - 4am TRJ0001 10 Morning TRJ0002 : 13: Afternoon TRJ0003 : 10: Morning TRJ0004 : 14: Afternoon TRJ0005 : 13: Afternoon TRJ0006 : 16 : Afternoon TRJ0007 : 11: Morning TRJ0008 : 15: Afternoon TRJ0009 : 13 : Afternoon TRJ0010 : 08: Morning PL/SQL procedure successfully completed. Period of Time Morning Afternoon Evening Night Using the distance function, create a procedure named total_dist that accept objectid as the input parameter. This procedure will calculate the road length for a road type object. Hint: Use coorlist table. The length must be calculated from two consecutive points. SQL> exec total_dist ('OB0021'); Seq 1 (-37.700009, 145.0582327) Length = 0 km Seq 2 (-37.7022254,145.0574304) Seq 3 (-37.7034948, 145.0562599) Seq 4 (-37.7077456,145.0519525) Seq 5 (-37.7117952,145.047455) Length Seq 6 (-37.7128434,145.0459294) Length Length Length = : .2616 km = .4533 km Length = 1.125 km 1.7968 km 2.0023 km = 2.0664 km = 2.5718 km Seq 7 (-37.7131704, 145.0454536) Length Seq 8 (-37.7169925, 145.0429797) Length Seq 9 (-37.7177539, 145.0423095) Length Seq 10 (-37.7226433,145.0302035) Length = 4.1336 km (-37.7245782,145.0270209) 2.6844 km Seq 11 Length 4.547 km Length = 4.9438 km Seq 12 (-37.7254311,145.0235489) Total Length: 4.9438 km PL/SQL procedure successfully completed. = = =
Expert Answer:
Related Book For
Accounting Information Systems
ISBN: 9780132871938
11th Edition
Authors: George H. Bodnar, William S. Hopwood
Posted Date:
Students also viewed these databases questions
-
Apple recently issued a zero coupon bond. The zero coupon bond has a face value of $1 billion and matures in six years. Assume that when the bonds were sold to the public, the annual market rate of...
-
Avocado Company sells guitars to Mexican restaurants. The guitars sell for $800, and the fixed monthly operating costs are as follows: Rent and utilities Wages and benefits to $700 employees Other...
-
Marquis Westbury invested $49,000 in the Trenton and Rainwater partnership for ownership equity of $49,000. Prior to the investment, equipment was revalued to a market value of $358,000 from a book...
-
As mentioned in Section 5.6, Sainte-Venants principle will allow particular boundary conditions to be replaced by their statically equivalent resultant. For problems (b), (c), (d),and (f) in Exercise...
-
Radio waves of frequency 1.427 GHz arrive at two telescopes that are connected by a computer to perform interferometry. One portion of the same wave front travels 1.051 m farther than the other...
-
Two carpenters are hammering at the same time, each at a different hammering frequency. The hammering frequency is the number of hammer blows per second. Every 4.6 s, both carpenters strike at the...
-
Consider the following balance sheet data for Davis Co., Inc., an electronics and major appliance retailer, at February 26, 2019 and February 27, 2018 (amounts in thousands): a. Prepare a comparative...
-
Using the following categories, define the purpose of each of the common controls over cash listed below. You may use multiple categories for each control. Categories of Purposes of Each Common...
-
Appreciative inquiry is often a ( n ) _ _ _ _ _ _ _ _ , which adopts a whole systems perspective. Question 1 4 options: parallel learning structure deconstructionist approach large group intervention...
-
What was the organizational problem in this story? Can someone be responsible for something over which that person does not have authority? How should the new manager have handled Billys request to...
-
(a) Value a call option on this asset assuming a strike price of 120. (b) The option above actually represents a potential investment opportu- nity for XYZ, Inc. XYZ is considering investing in some...
-
Why is business management referred to as a profession rather than a discipline?
-
how data redundancy is handled in the relational database model?
-
Consider the following program: (Note: more about Arrays.toString on the cover page of the exam.) public class Probl ( public static void foo (int[] nums) { } nums [1] 17; nums = new int[6]; nums [2]...
-
The following figure shows a homogeneous cylinder of radius R and mass m that is free to rotate about its axis of rotation and that is connected to the wall through a spring. Assuming that the...
-
What ethical considerations arise in the implementation of stress management programs within organizational contexts, particularly concerning issues of confidentiality, privacy, and the stigma...
-
7. Three polarizing disks whose planes are parallel and centered on common axis. The directions of their transmission axes relative to the vertical are respectively: 0 = 22, 02 = 45, and 83 = 63. A...
-
Refer to the Conservation Ecology (Dec. 2003) study of the causes of forest fragmentation, presented in Exercise 2.166 (p. 97). Recall that the researchers used advanced high-resolution satellite...
-
Discuss factors that should be considered in the organizational location of the internal audit function.
-
Identify each of the following forms: a. Form 941 b. Form W- 2 c. Form W- 3 d. Form 1099- Misc. e. Earnings statement
-
The internal auditing department was told that two employees were terminated for falsifying their time records. The two employees had altered overtime hours on their time cards after their...
-
Lauren Inc. makes three products that can be sold at split-off or processed further and then sold. The joint cost for April is \(\$ 1,080,000\). The number of ounces in a bottle of each product is:...
-
Wear Art produces precut fabrics for three products: dresses, jackets, and blouses. Joint cost is allocated on the basis of relative sales value at split-off. The company can choose to process each...
-
Sell or process further Winn Mills processes cotton in a joint process that yields two joint products: fabric and yarn. May's joint cost is \(\$ 120,000\), and the sales values at split-off are \(\$...
Study smarter with the SolutionInn App