SQL NLS_INITCAP function
INITCAP with an explicit NLS_SORT: title-cases per a language's rules instead of the session default.
- 카테고리
- Strings
- Returns
string- In this category
- 26 of 172
구문
NLS_INITCAP(string [, 'NLS_SORT=sort_name'])
엔진 지원
| 엔진 | Support | 메모 |
|---|---|---|
| SQL Server | Not built in | No built-in equivalent. |
| PostgreSQL | Not built in | No built-in equivalent. |
| MySQL | Not built in | No built-in equivalent. |
| SQLite | Not built in | No built-in equivalent. |
| Oracle | 예 | Supported under this name. |
예시
Oracle
SELECT NLS_INITCAP('istanbul') AS plain FROM dual; -- Istanbul
Oracle
SELECT NLS_INITCAP('istanbul', 'NLS_SORT=XTurkish') AS tr FROM dual;
알아 두면 좋은 정보
- Without the second argument it uses the session's NLS_SORT, which may not match the data's language.
- Linguistic sorts handle special pairs: NLS_INITCAP('istanbul', 'NLS_SORT=XTurkish') starts with a dotted capital I.
- Sisters NLS_UPPER and NLS_LOWER take the same parameter; plain INITCAP ignores locale rules entirely.
- Oracle only. Other engines reach for per-expression COLLATE clauses (PostgreSQL, SQL Server) instead.
Questions about NLS_INITCAP
How is NLS_INITCAP different from INITCAP?
INITCAP uses the session's default sort; NLS_INITCAP lets you name one per call, so mixed-language data can be cased correctly in one query.
What NLS_SORT values can I use?
BINARY plus the linguistic sorts Oracle ships: XTurkish, XGerman, XDanish and dozens more. The X- prefix enables the special uppercase expansions.
Does PostgreSQL need this?
PostgreSQL picks casing rules per expression with COLLATE, e.g. lower('I' COLLATE "tr-TR-x-icu"), so there is no separate function.
Browse every function in the SQL function reference, or see what the SQLly desktop app does for your database.
Related on SQLly
Cheat sheets for the engines that have it: Oracle.
Functions your engine actually has
SQLly's completion lists the built-in functions of the engine you're connected to, whether that's SQL Server, PostgreSQL, MySQL, SQLite or Oracle. Hover a function for help, and signature hints show each argument as you type.