Sometimes life is too surreal. Like when somebody says, “How do
you get title case in an Oracle database?” That’s when you know
three things about the individual, while suppressing laughter.
They’re not very experienced with SQL, likely lazy, and don’t
read the documentation.
I had a little fun with somebody today by taking them down a
small rat-hole. “Oh, gosh … ” I said, “… let’s write a function
for that.” Here’s the joke function, like:
CREATE OR REPLACE
FUNCTION title_case
( string VARCHAR2 ) RETURN VARCHAR2 IS
BEGIN
/* Change upper case to title case. */
RETURN UPPER(SUBSTR(string,1,1)) || LOWER(SUBSTR(string,2,LENGTH(string)));
END title_case;
/
Then, we tested it with a query from the pseudo dual table:
SELECT title_case('incredible') AS "Proper Name" FROM dual;
It returned:
Proper Name
----------
Incredible
Then, I said “Oh, that’s not his …
[Read more]