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:04]
mh
kurs:nested_table_als_column_type [2014/11/11 14:52] (current)
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;
 +    al             ​number;​
 BEGIN BEGIN
     SELECT ​  COUNT (id)     SELECT ​  COUNT (id)
Line 41: Line 80:
          ​WHERE ​  name = p_name;          ​WHERE ​  name = p_name;
  
-        FOR i IN 1 .. t_ausbildung.LAST+        FOR i IN 1 .. t_ausbildung.last
         LOOP         LOOP
             IF t_ausbildung (i) = p_add_ausbildung             IF t_ausbildung (i) = p_add_ausbildung
Line 51: Line 90:
         IF f = FALSE         IF f = FALSE
         THEN         THEN
 +
             t_ausbildung.EXTEND;​             t_ausbildung.EXTEND;​
-            t_ausbildung (t_ausbildung.LAST) := p_add_ausbildung;​+            t_ausbildung (t_ausbildung.last) := p_add_ausbildung;​
  
             UPDATE ​  ​kursteilnehmer             UPDATE ​  ​kursteilnehmer
Line 64: Line 104:
         DBMS_OUTPUT.put_line (t_ausbildung (i));         DBMS_OUTPUT.put_line (t_ausbildung (i));
     END LOOP;*/     END LOOP;*/
-END;                                                              </​code>​+END;                                                              ​-- Procedure 
 +</​code>​
kurs/nested_table_als_column_type.1321535087.txt.gz · Last modified: 2014/09/10 21:22 (external edit)