User Tools

Site Tools


kurs:plsql_tables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
kurs:plsql_tables [2015/04/09 15:37]
mh
kurs:plsql_tables [2015/04/09 15:38]
mh
Line 165: Line 165:
 </​code>​ </​code>​
  
 +<​code>​
 +CREATE OR REPLACE PROCEDURE DELETE_EDUCATION ​
 +(
 +  P_PER_NAME IN VARCHAR2  ​
 +, P_DEL_EDUCATION IN VARCHAR2  ​
 +) AS 
 +  v_edu education := education();​
 +  v_index number;
 +  v_del_edu education := education(P_DEL_EDUCATION);​
 +BEGIN
 +  select coalesce(per_education,​ education()) into v_edu
 +    from persons where per_name = p_per_name;
 +  ​
 +  /* v_index := v_edu.first;​
 +  loop
 +    dbms_output.put_line(v_index||'​ '|| v_edu(v_index));​
 +    if  v_edu(v_index) = P_DEL_EDUCATION then
 +      v_edu.delete(v_index);​
 +    end if;
 +    v_index := v_edu.next(v_index);​
 +    exit when v_index is null;
 +  end loop;
 +  */
 +  v_edu := v_edu multiset except v_del_edu;
 +  ​
 +   ​update persons set per_education = v_edu
 +    where per_name = p_per_name;
 +  ​
 +END DELETE_EDUCATION;​
 +</​code>​
  
kurs/plsql_tables.txt ยท Last modified: 2015/04/09 15:38 by mh