Update DBMS/SQL/Week6/writeup.md

This commit is contained in:
Aadit Agrawal 2025-02-11 15:28:19 +05:30
parent 8f1a41fd6c
commit 7fea142b7a

View File

@ -77,4 +77,24 @@ SQL> execute tot_damage('1236',2024);
Total damage: 150
PL/SQL procedure successfully completed.
```
```
### 5. Create a procedure to display accident information which took place in a particular location.
```SQL
SQL> create or replace procedure accident_info(location_value in varchar) IS
begin
for accident_rec in
(select * from accident where location = location_value) loop
dbms_output.put_line('Report Number: ' || accident_rec.report_number || ', Date: ' || accident_rec.accd_date || ', Location: ' || accident_rec.location);
end loop;
end;
/
```
```sql
SQL> execute accident_info('Delhi India');
Report Number: 1, Date: 01-JAN-24, Location: Delhi India
PL/SQL procedure successfully completed.
```