Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a procedure named DDCKPAY_SP that confirms whether a monthly pledge payment is thecorrect amount. The procedure needs to accept two values as input: a

Create a procedure named DDCKPAY_SP that confirms whether a monthly pledge payment is thecorrect amount. The procedure needs to accept two values as input: a payment amount and apledge ID. Based on these inputs, the procedure should confirm that the payment is the correctmonthly increment amount, based on pledge data in the database. If it isnt, a custom Oracle errorusing error number 20050 and the message Incorrect payment amount - planned payment = ??should be raised. The ?? should be replaced by the correct payment amount. The databasequery in the procedure should be formulated so that no rows are returned if the pledge isnt ona monthly payment plan or the pledge isnt found. If the query returns no rows, the procedure shoulddisplay the message No payment information. Test the procedure with the pledge ID 104 and thepayment amount $25 . Then test with the same pledge ID but the payment amount $20 . Finally, testthe procedure with a pledge ID for a pledge that doesnt have monthly payments associated with it. // USING PROCEDURE IN PL/SQL LANGUAGE TABLE CREATE TABLE DD_Donor ( idDonor number(4), Firstname varchar2(15), Lastname varchar2(30), Typecode CHAR(1), Street varchar2(40), City varchar2(20), State char(2), Zip varchar2(9), Phone varchar2(10), Fax varchar2(10), Email varchar2(25), News char(1), dtentered date DEFAULT SYSDATE, CONSTRAINT donor_id_pk PRIMARY KEY(idDonor) ); CREATE TABLE DD_Project ( idProj number(6), Projname varchar2(60), Projstartdate DATE, Projenddate DATE, Projfundgoal number(12,2), ProjCoord varchar2(20), CONSTRAINT project_id_pk PRIMARY KEY(idProj), CONSTRAINT project_name_uk UNIQUE (Projname) ); CREATE TABLE DD_Status ( idStatus number(2), Statusdesc varchar2(15), CONSTRAINT status_id_pk PRIMARY KEY(idStatus) ); CREATE TABLE DD_Pledge ( idPledge number(5), idDonor number(4), Pledgedate DATE, Pledgeamt number(8,2), idProj number(5), idStatus number(2), Writeoff number(8,2), paymonths number(3), Campaign number(4), Firstpledge char(1), CONSTRAINT pledge_id_pk PRIMARY KEY(idPledge), CONSTRAINT pledge_idDonor_fk FOREIGN KEY (idDonor) REFERENCES dd_donor (idDonor), CONSTRAINT pledge_idProj_fk FOREIGN KEY (idProj) REFERENCES dd_project (idProj), CONSTRAINT pledge_idStatus_fk FOREIGN KEY (idStatus) REFERENCES dd_status (idStatus)); CREATE TABLE DD_Payment ( idPay number(6), idPledge number(5), Payamt number(8,2), Paydate DATE, Paymethod char(2), CONSTRAINT payment_id_pk PRIMARY KEY(idPay), CONSTRAINT pay_idpledge_fk FOREIGN KEY (idPledge) REFERENCES dd_pledge (idPledge) );

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

Convert the following finite automata to regular expressions

Answered: 1 week ago