Home > Software engineering >  ORA-00936: missing expression Solution- Convert function
ORA-00936: missing expression Solution- Convert function

Time:11-06

when doing this query in oracle I get the error

ORA-00936: missing expression
00936. 00000 - "missing expression"

If I run the query to the from of it gives me results, then I deduce that the problem comes from where, however, I cannot identify what it is

SELECT FECHADOC, FECHACONT, CLASEDOC, SOCIEDAD, MONEDA, TIPOCAMBIO, PERIODO, 
       REFERENCIA, TEXTOCAB, ID_REGISTRO 
FROM ESQUEMA.TABLE 
WHERE CONVERT(CHAR(8),20211231,112) <= CONVERT(CHAR(8),DATEADD(DAY,-90,GETDATE()),112)

I already used:

 WHERE CONVERT( TO_CHAR(8),20201231,112) <= 
      (CONVERT(TO_CHAR(8),DATEADD(DAY,-90,GETDATE()),112) )

and it keeps giving me an error

CodePudding user response:

If this really is Oracle, then dateadd and getdate aren't Oracle functions. Look like MS SQL Server ones. Also, table is reserved word for tables, you can't name a table (or any other object) table.

Anyway: looks like this is what you might be looking for:

SELECT FECHADOC, FECHACONT, CLASEDOC, SOCIEDAD, MONEDA, 
       TIPOCAMBIO, PERIODO, REFERENCIA, 
       TEXTOCAB, ID_REGISTRO 
FROM ESQUEMA.TABLE 
where to_date('20211231', 'yyyymmdd') <= trunc(sysdate) - 90;
  • Related