Home:ALL Converter>COALESCE in SQL to Case Statement in Oracle

COALESCE in SQL to Case Statement in Oracle

Ask Time:2017-10-06T01:56:58         Author:joe

Json Formatter

I have this sample temp table. I was using the COALESCE in SQL sever. I do not have access right to create tableS in Oracle. Is there a Case statement in Oracle that works as COALESCE in SQL server?

CREATE TABLE #TEMP
(
    ID INT,
    FIELD1 VARCHAR (5),
    FIELD2 VARCHAR (5),
    FIELD3 VARCHAR (5)
)

INSERT INTO #TEMP VALUES('555','CVS','E','CIA')

SELECT 
ID,
COALESCE(FIELD1 + '_' + FIELD2 + '_' + FIELD3, FIELD2 + '_' + FIELD1) AS STORE
FROM #TEMP

Basically, I want to replace the COALESCE from above my query to Case Statement in Oracle.

edit: I did use this Field1 ||'_' ||Field2||'_'||Field3 AS Store in Oracle but the result gives me the extra underscore _ from Field3 which I don't want to see the underscore.

Author:joe,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/46592014/coalesce-in-sql-to-case-statement-in-oracle
yy