CASE .. WHEN expression in Oracle SQL

You could use an IN clause Something like SELECT status, CASE WHEN STATUS IN(‘a1′,’a2′,’a3’) THEN ‘Active’ WHEN STATUS = ‘i’ THEN ‘Inactive’ WHEN STATUS = ‘t’ THEN ‘Terminated’ END AS STATUSTEXT FROM STATUS Have a look at this demo SQL Fiddle DEMO

How do I use CREATE OR REPLACE?

This works on functions, procedures, packages, types, synonyms, trigger and views. Update: After updating the post for the third time, I’ll reformulate this: This does not work on tables 🙂 And yes, there is documentation on this syntax, and there are no REPLACE option for CREATE TABLE.

How can I diff two Oracle 10g Schemas?

The free and open-source SchemaCrawler tool that I wrote will do what you need. SchemaCrawler outputs details of your schema (tables, views, procedures, and more) in a diff-able plain-text format (text, CSV, or XHTML). SchemaCrawler can also output data (including CLOBs and BLOBs) in the same plain-text formats. You can use a standard diff program … Read more

Why are Oracle table/column/index names limited to 30 characters?

I believe it’s the ANSI standard. EDIT: Actually, I think it’s the SQL-92 standard. A later version of the standard appears to optionally allow for 128 character names, but Oracle doesn’t yet support this (or has partial support for it, insofar as it allows 30 characters. Hmmm.) Search for “F391, Long identifiers” on this page… … Read more