Update DBMS/SQL/Week6/writeup.md
This commit is contained in:
		
							parent
							
								
									8f1a41fd6c
								
							
						
					
					
						commit
						7fea142b7a
					
				
					 1 changed files with 21 additions and 1 deletions
				
			
		| 
						 | 
					@ -77,4 +77,24 @@ SQL> execute tot_damage('1236',2024);
 | 
				
			||||||
Total damage: 150
 | 
					Total damage: 150
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PL/SQL procedure successfully completed.
 | 
					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…
	
	Add table
		Add a link
		
	
		Reference in a new issue