Question: Please create a PL / SQL procedure which creates a new trip. The input includes a ride request ID , a driver ID , and

Please create a PL/SQL procedure which creates a new trip. The input includes a ride request ID, a driver ID, and a car ID
1) it first checks whether there is a ride request with the input ID. If there is no such request, print a message 'Invalid request ID' and stop.
2) it then checks whether there is a row in driver_car that matches the input driver ID and car ID.
If there is no such a row, print a message 'Invalid car ID or driver ID' and stop.
3) if all input IDs are valid, insert a new row into the trip table, with a newly generated trip ID, input rider request ID, input driver ID, input car ID, and start_time as current time (systimestamp). End_time, fare, and rating are null.
Print out the newly generated trip ID.
Hint: create a sequence to generate a new trip ID.
Please call this procedure with an invalid input and a valid input.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!