Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-29 · container image gvenzl/oracle-free:23-slim
When the value is a NUMBER, TO_CHAR and TO_NUMBER expect a number format model (9, 0, ,, ., G, D, FM and so on). ORA-01481 means the format contains something else: a date element, a unit or symbol, or separators in an order Oracle does not accept.
The * in SQL*Plus points at the format argument. Check the data type of the value first: a NUMBER with a date format is a common source.
01Date format on a date stored as NUMBER (20261130)
sale_ymd holds dates like 20261130, but its type is NUMBER (the check shows it). TO_CHAR(sale_ymd, 'YYYY-MM-DD') therefore treats YYYY-MM-DD as a number format, which it is not.
Setup
CREATE TABLE sales (id NUMBER PRIMARY KEY, sale_ymd NUMBER(8), amount NUMBER);
INSERT INTO sales VALUES (1, 20261130, 15000);
COMMIT;Table created.
1 row created.
Commit complete.SELECT id, TO_CHAR(sale_ymd, 'YYYY-MM-DD') AS sale_date FROM sales;SELECT id, TO_CHAR(sale_ymd, 'YYYY-MM-DD') AS sale_date FROM sales
*
ERROR at line 1:
ORA-01481: invalid number format model
Help: https://docs.oracle.com/error-help/db/ora-01481/SELECT data_type FROM user_tab_columns WHERE table_name = 'SALES' AND column_name = 'SALE_YMD';DATA_TYPE
--------------------------------------------------------------------------------------------------------------------------------
NUMBER
1 row selected.Turn the number into a date first, then format it: TO_CHAR(TO_DATE(TO_CHAR(sale_ymd), 'YYYYMMDD'), 'YYYY-MM-DD') returns 2026-11-30.
SELECT id, TO_CHAR(TO_DATE(TO_CHAR(sale_ymd), 'YYYYMMDD'), 'YYYY-MM-DD') AS sale_date FROM sales; ID SALE_DATE
---------- ----------
1 2026-11-30
1 row selected.02Unit text or % inside the number format
'99,999원' and '99%' put a currency word and a percent sign into the format model. Neither is a number format element, so the first one already fails.
Setup
CREATE TABLE items (id NUMBER PRIMARY KEY, price NUMBER, rate NUMBER);
INSERT INTO items VALUES (1, 12500, 12);
COMMIT;Table created.
1 row created.
Commit complete.SELECT TO_CHAR(price, '99,999원') AS price_txt, TO_CHAR(rate, '99%') AS rate_txt FROM items;SELECT TO_CHAR(price, '99,999원') AS price_txt, TO_CHAR(rate, '99%') AS rate_txt FROM items
*
ERROR at line 1:
ORA-01481: invalid number format model
Help: https://docs.oracle.com/error-help/db/ora-01481/SELECT TO_CHAR(price, '99,999') AS price_only FROM items;PRICE_O
-------
12,500
1 row selected.Without the text the same format works: TO_CHAR(price, '99,999') gives 12,500. So format the number and concatenate the text: TO_CHAR(price, 'FM99,999') || '원' and TO_CHAR(rate) || '%' return 12,500원 and 12%. FM removes the leading space seen in the check.
SELECT TO_CHAR(price, 'FM99,999') || '원' AS price_txt, TO_CHAR(rate) || '%' AS rate_txt FROM items;PRICE_TXT RATE_TXT
---------- -----------------------------------------
12,500원 12%
1 row selected.03European-style separators written literally: '9.999,99'
To read 1.234,50 (dot for thousands, comma for decimals), the format '9.999,99' was written the same way. In a format model . is the decimal point, and here the comma comes after it, so Oracle rejects the format.
SELECT TO_NUMBER('1.234,50', '9.999,99') AS amount FROM dual;SELECT TO_NUMBER('1.234,50', '9.999,99') AS amount FROM dual
*
ERROR at line 1:
ORA-01481: invalid number format model
Help: https://docs.oracle.com/error-help/db/ora-01481/SELECT value FROM nls_session_parameters WHERE parameter = 'NLS_NUMERIC_CHARACTERS';VALUE
----------------------------------------------------------------
.,
1 row selected.The session setting NLS_NUMERIC_CHARACTERS is ., (dot = decimal, comma = group). Use G (group) and D (decimal) and pass the characters you need: TO_NUMBER('1.234,50', '9G999D99', 'NLS_NUMERIC_CHARACTERS='',.''') returns 1234.5.
SELECT TO_NUMBER('1.234,50', '9G999D99', 'NLS_NUMERIC_CHARACTERS='',.''') AS amount FROM dual; AMOUNT
----------
1234.5
1 row selected.FAQ
How do I fix ORA-01481 invalid number format model?
Check that the value is really a number and that the format only uses number elements (9, 0, ,, ., G, D, FM). Add text such as units with || instead of inside the format.
Why does TO_CHAR(col, 'YYYY-MM-DD') give ORA-01481?
The column is a NUMBER, not a DATE. Convert it with TO_DATE(TO_CHAR(col), 'YYYYMMDD') before applying a date format.
How do I add a % sign or currency text with TO_CHAR?
Concatenate it: TO_CHAR(rate) || '%'. Putting % or other text inside the format model gives ORA-01481.
How we verify
Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.
lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0