1
ORA-00932: inconsistent datatypes: expected NUMBER got CHAR
SQL:
SELECT CASE WHEN
(
SELECT COUNT(COMP_CODE) FROM COMPANY_MASTER
)=0 THEN 1
ELSE
(
SELECT LPAD((SELECT MAX(COMP_CODE)+1 FROM COMPANY_MASTER),3, 0) NOS FROM DUAL
)
END AS DOCNO FROM DUAL;