Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ORA-00936: missing expression Solution- Convert function

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading