Update DBMS/SQL/Week6/writeup.md
This commit is contained in:
parent
8f1a41fd6c
commit
7fea142b7a
@ -78,3 +78,23 @@ 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.
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user