Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-00932: inconsistent datatypes: expected DATE got NUMBER

silvia gJan 26 2024

Hi there, I have two columns Date Type on an interactive report and a form called SOLICITUD_TRASLADO and INGRESO_HSR, (REQUIRED_TRANSPORT_DATE and INCOME_HSR in english, kind of), and another one called DIAS_ESTANCIA (DAYS_BETWEEN). All in the same table called PGENERAL. I need the user to choose a date at the first two columns so I can calculate the difference between those two dates automatically everytime the user chooses both dates. At the report for final result, and at the form while the user is writting the data on it.

So, I'm very new at SQL and the code that makes a little bit of sense is:

SELECT 
PGENERAL.INGRESO_HSR, 
PGENERAL.FECHA_ALTA, 
TRUNC(to_date(PGENERAL.INGRESO_HSR, 'DD')) - TRUNC(to_date(PGENERAL.FECHA_ALTA, 'DD')) AS 
DIAS_ESTANCIA 
FROM PGENERAL;

The code validates alright (I'm inserting it on a colum Plain Text based on List of Values, sql query type, don't know if that's correct), but when I try to refresh report page, it gives this error code back:

report error:
ORA-00932: inconsistent datatypes: expected DATE got NUMBER

I would appreciate any kind of help on my commitment since this is important, either code correction or a different opinion on how to do this. Thanks in advance!

Comments
Post Details
Added on Jan 26 2024
7 comments
12,187 views