In sqlplus, this query works:
SQL> SELECT DISTINCT
2 CNTPTY_TYPE
3 FROM visn_exp.V_IHCVSN_CERT_DEP
4 WHERE as_of_dt = '08-may-20'
5 ;
CNTPTY_TYPE
----------------------------------------
Retail
PSE
Non-Financial Corporate
FI
BUt this one fails, with the collate clause:
SQL> SELECT DISTINCT
2 CNTPTY_TYPE COLLATE latin1_general_CI_AI AS CNTPTY_TYPE
3 FROM VISN_EXP.V_IHCVSN_CERT_DEP
4 WHERE as_of_dt = '08-may-20'
5 ;
CNTPTY_TYPE COLLATE latin_general_CI_AI AS CNTPTY_TYPE
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
What should I do to fix this?
Update: Tried the suggested query in the answer. Got
SQL*Plus: Release 12.2.0.1.0 Production on Mon May 11 21:03:20 2020
Copyright (c) 1982, 2017, Oracle. All rights reserved.
Enter password: Last Successful login time: Mon May 11 2020 16:51:34 -04:00
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options
SQL> SELECT DISTINCT
2 CNTPTY_TYPE COLLATE LATIN_AI AS CNTPTY_TYPE
3 FROM VISN_EXP.V_IHCVSN_CERT_DEP
4 WHERE as_of_dt = '08-may-20';
CNTPTY_TYPE COLLATE LATIN_AI AS CNTPTY_TYPE
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
latin1_general_CI_AIrather thanlatin_general_CI_AI? - Thorsten Kettnerlatin1_generalis unknown to Oracle. And it must either be_CIor_AI, not both. This works for me:COLLATE latin_AI. Demo: dbfiddle.uk/… - Thorsten Kettner