SQL is a good (if dated) language for relational access and manipulation, but awful for procedural scripting.