character set mismatch COALESCE

0

Hi, I have a problem with this query, it tells me the error

ORA-00932: inconsistent datatypes: expected NCHAR got NUMBER
00932. 00000 -  "inconsistent datatypes: expected %s got %s"
*Cause:    
*Action:
Error en la línea: 54, columna: 43

I think the problem is because I should cast 10 or something like that, try this post Post 1 adding n '' ahead of 10 but it did not work because the code turns blue. I also tried this Post 2 that says you have to add an N '' || before 10 and the same thing happens ...

SELECT NOMBRE, COALESCE(DIRECCION,CORREO, 10) comm
FROM ESTUDIANTE
WHERE GENERO_A =   
   (SELECT GENERO_A
    FROM ESTUDIANTE
    GROUP BY GENERO_A
    HAVING COUNT(GENERO_A) = 
        (SELECT MAX(COUNT(*)) as CONTAR
        FROM ESTUDIANTE
        GROUP BY GENERO_A))
ORDER BY NOMBRE;
    
asked by RicardoBarros 03.09.2017 в 03:20
source

1 answer

0

I propose 2 possible solutions:

With N ''

You say you are putting N '' in front of 10, but it is not in front ( N''10 ), but with 10 in between, like this: N'10' I do not know if you've tried this, but I'll put it to you just in case, since you in your question make me think you have not fallen into that detail.

Using the Oracle CAST function

Simple example:

SELECT CAST (miles AS INT)
FROM Flights

More info on this feature here .

I hope it serves you.

    
answered by 03.09.2017 / 13:07
source