Every now and then, someone sends me some code that was outputted from some code generation tool. Sure, it's bad, but what can you expect? I mean, I'm not an anti-robotian or anything, but c'mon, machines generating code?

But no less, after seeing that Erich "ammoQ" Kitzmüller sent in from Oracle's SQLDeveloper, I thought I'd make an exception. Following was the PL/SQL code generated when Erich went to add the DATE column "FIREDATE" to the SCOTT.EMP table ...

begin
if 'DATE' = 'NUMBER' and length('DATE')>0 and length('')>0 then
  execute immediate 'alter table "SCOTT"."EMP" add(FIREDATE DATE(, ))';
elsif 'DATE' = 'INTEGER' or 
  ('DATE' = 'NUMBER' and length('DATE')>0 and length('')=0) or
  'DATE' = 'VARCHAR2' then
  execute immediate 'alter table "SCOTT"."EMP" add(FIREDATE DATE())';
else
  execute immediate 'alter table "SCOTT"."EMP" add(FIREDATE DATE)';
end if;
end;
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!