Jan 022013
 
create trigger nuclear_fission 
for update on  uranium compound trigger

  cursor remaining_material is
    select rowid, u.*
    from   uranium u
    where  atomic_mass = 235
    and    rownum <= 
      (select count(*) from neutrons);
  
  fissile_matter remaining_material%rowtype;
  
  after each row is 
  begin
    if :new.atomic_mass = 236 then 
      insert into krypton (atomic_mass) 
      values (92);
      insert into barium  (atomic_mass) 
      values (141);
      insert into neutrons (atomic_mass) 
      values (1);
      insert into neutrons (atomic_mass) 
      values (1);
      insert into neutrons (atomic_mass) 
      values (1);
    end if;
  end after each row;

  after statement is
  begin
    open remaining_material;
    loop 
    
      fetch remaining_material 
      into  fissile_matter; 
      exit when remaining_material%notfound;
      
      update uranium
      set    atomic_mass = atomic_mass + 
        (select atomic_mass 
         from   neutrons 
         where  rownum = 1)
      where  atomic_mass = 235
      and    rowid = fissile_matter.rowid;
      
      delete neutrons;
    
    end loop;
    close remaining_material;
    
    delete uranium 
    where  atomic_mass = 236;
    
  end after statement;
  
end;
/It may not generate your database any extra power, 
but at least you won't have to deal with leftover radioactive material

To start your own nuclear reaction, use this.

Get SQLfail sent to your inbox

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>