User Tools

Site Tools


kurs:nested_table_als_column_type

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
kurs:nested_table_als_column_type [2011/11/17 14:24]
mh
kurs:nested_table_als_column_type [2014/11/11 14:52]
mh
Line 1: Line 1:
 +<​code>​
 +CREATE OR REPLACE PROCEDURE TEILNEHMER_EDUCATION ​
 +/*
 +  + zusaetzlich zum teilnehmernamen eine zusätzliche
 +    ausbildung (p_add_education) angeben und die an die schon vorhandenen
 +    anhaengen und den Teilnehmer damit updaten
 +
 +*/
 +(p_tln_name teilnehmer.tln_name%type,​
 + ​p_add_education varchar2
 +)
 +AS
 +  t_education education; ​
 +BEGIN
 +  select coalesce(tln_education,​ education() ) into t_education ​
 +    from teilnehmer
 +  where tln_name = p_tln_name; ​       ​
 +  ​
 +  -- dbms_output.put_line(t_education.count);​
 +  ​
 +  t_education.extend;​
 +  t_education(t_education.last) := p_add_education;​
 +  ​
 +  update teilnehmer set tln_education = t_education
 +    where tln_name = p_tln_name;
 +  ​
 +  if t_education.count <> 0 then
 +  for i in 1..t_education.last loop
 +    -- dbms_output.put_line(t_education(1)||'​ '|| t_education.count);​
 +    dbms_output.put_line(t_education(i));​
 +  end loop;
 +  end if;
 +  ​
 +  ​
 +END TEILNEHMER_EDUCATION;​
 +</​code>​
 +
 +
 <​code>​ <​code>​
 CREATE OR REPLACE ​ CREATE OR REPLACE ​
Line 19: Line 57:
 <​code>​ <​code>​
 PROCEDURE teilnehmer_ausbildung ( PROCEDURE teilnehmer_ausbildung (
-  p_name VARCHAR2, ​+  p_name VARCHAR2,
   p_add_ausbildung VARCHAR2)   p_add_ausbildung VARCHAR2)
 IS IS
-    t_ausbildung ​  ​ausbildung;​+    t_ausbildung ​  ​ausbildung ​:= ausbildung();
     c              INTEGER;     c              INTEGER;
     f              BOOLEAN := FALSE;     f              BOOLEAN := FALSE;
Line 41: Line 79:
           FROM   ​kursteilnehmer           FROM   ​kursteilnehmer
          ​WHERE ​  name = p_name;          ​WHERE ​  name = p_name;
-      + 
-        if  t_ausbildung is null then +        FOR i IN 1 .. t_ausbildung.last
-          al := 0; +
-          t_ausbildung := ausbildung();​ +
-        else  +
-          al := t_ausbildung.last;​ +
-        end if; +
-        ​ +
-        FOR i IN 1 .. al+
         LOOP         LOOP
             IF t_ausbildung (i) = p_add_ausbildung             IF t_ausbildung (i) = p_add_ausbildung
Line 59: Line 90:
         IF f = FALSE         IF f = FALSE
         THEN         THEN
-           +
-                        ​+
             t_ausbildung.EXTEND;​             t_ausbildung.EXTEND;​
-            t_ausbildung (al + 1) := p_add_ausbildung;​+            t_ausbildung (t_ausbildung.last) := p_add_ausbildung;​
  
             UPDATE ​  ​kursteilnehmer             UPDATE ​  ​kursteilnehmer
Line 74: Line 104:
         DBMS_OUTPUT.put_line (t_ausbildung (i));         DBMS_OUTPUT.put_line (t_ausbildung (i));
     END LOOP;*/     END LOOP;*/
-END;                                                             +END;                                                              -- Procedure 
- +</​code>​
-END;                                                              ​</​code>​+
kurs/nested_table_als_column_type.txt · Last modified: 2014/11/11 14:52 by mh