Update DBMS/SQL/Week6/writeup.md

This commit is contained in:
Aadit Agrawal 2025-02-11 15:41:37 +05:30
parent f80463ae74
commit 90db880472

View File

@ -28,12 +28,13 @@ TOTAL_ACCD(2024)
```SQL
create or replace procedure tot_damage
(driver in varchar2, year in number) is
damage number := 0; -- initialize damage to 0
damage number := 0;
begin
select sum(damage_amount) into damage
from participated pa
natural join accident ac
where pa."driver_id#" = driver -- use the correct column name with quotes
where pa."driver_id#" = driver
with quotes
and extract(year from ac.accd_date) = year;
dbms_output.put_line('total damage: ' || nvl(damage, 0));