[memo] Oracle : 把資料用 UTF8 編碼存進 table / NLS_LANG / NCHAR / NVARCHAR / NLS_CHARACTERSET / NLS_NCHAR_CHARACTERSET / SQL plus

UTF8 sample:

螢幕快照 2014-10-28 下午9.21.47

URL : http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=竝

螢幕快照 2014-10-28 下午9.28.02

Oracle : 把資料用16進位印出來 dump(field,16)
螢幕快照 2014-10-28 下午8.30.11

螢幕快照 2014-10-28 下午8.35.36

 

用 locale -a 看 系統支援的 locales

參考 : Oracle® Database Globalization Support Guide : http://docs.oracle.com/cd/E11882_01/server.112/e10729/toc.htm

Read more

SQL 的 union 的作法

The UNION query allows you to combine the result sets of 2 or more “select” queries. It removes duplicate rows between the various “select” statements.

select count(1) from (
      — 賣家
      select ctrl_rowid
      from bidleader.sold_record s
      where s.ctrl_date like ‘200701%’
      group by ctrl_rowid
      union
      — 買家
      select p_ctrl_rowid  ctrl_rowid
      from bidleader.sold_record s
      where s.ctrl_date like ‘200701%’
      group by p_ctrl_rowid
) t