This article shows some tips for Oracle SQL.
π COALESCE
COALESCE
returns the first non-null value in the expression list.
COALESCE (expr1, expr2) |
is equivalent to:
CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE expr2 END |
Example is as follows:
SELECT COALESCE(column1, 'A') FROM test1s; |
π No Type Boolean
Unfortunately, There is not Boolean
type in Oracle Database(in 2017 Dec).
So, we usually use NUMBER(1)
or CHAR(1)
type for such kind use-case.
-- 0 for false and 1 for true in type of NUMBER |
π CREATE/RENAME/DROP Synonym
βSynonymβ is an alias name for a table or view in Oracle Database. As not to write a schema name or etc, we usually use it.
-- Create synonym |
π» Special Thanks
- https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions023.htm#SQLRF00617
- https://stackoverflow.com/questions/30062/boolean-field-in-oracle
- http://oracle-chokotto.com/ora_synonym.html
π₯ Recommended VPS Service
VULTR provides high performance cloud compute environment for you.
Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour).
In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!