100%(1)1 out of 1 people found this document helpful
This preview shows page 2 - 5 out of 7 pages.
P a g e
Ramoi Hammond Database Development II 3 | P a g eAssignment 3-10: Adding a Project Create a PL/SQL block to handle adding a new project. Create and use a sequence named DD_PROJID_SEQ to handle generating and populating the project ID. The first number issued by this sequence should be 530, and no caching should be used. Use a record variable to handle the data to be added. Data for the new row should be the following: project name = HK Animal Shelter Extension, start = 1/1/2013, end = 5/31/2013, and fundraising goal = $65,000. Any columns not addressed in the data list are currently unknown. DECLARE TYPE_PROJECT DD_PROJECT%ROWTYPE; BEGIN TYPE_PROJECT.IDPROJ := DD_PROJID_SEQ.NEXTVAL; TYPE_PROJECT.PROJNAME := 'HK Animal Shelter Extension'; TYPE_PROJECT.PROJSTARTDATE := '01-JAN-2013'; TYPE_PROJECT.PROJENDDATE := '31-MAY-2013'; TYPE_PROJECT.PROJFUNDGOAL := 65000; TYPE_PROJECT.PROJCOORD := 'TBD'; INSERT INTO DD_PROJECT VALUES TYPE_PROJECT; END;
Ramoi Hammond Database Development II 4 | P a g eAssignment 3-12: Retrieving a Specific Pledge Create a PL/SQL block to retrieve and display information for a specific pledge. Display the pledge 10, donor 10, pledge amount, total paid so far, and the difference between the pledged amount and total paid amount. DECLARE ID_PLEDGE NUMBER(3); ID_DONOR NUMBER(3); PLEDGE_AMOUNT NUMBER(10); TOTAL NUMBER(10); DIFFERENCE NUMBER(10); BEGIN SELECT IDPLEDGE, IDDONOR, PLEDGEAMT INTO ID_PLEDGE, ID_DONOR, PLEDGE_AMOUNT FROM DD_PLEDGE WHERE IDPLEDGE = 100;