Good morning to everybody.
I have an issue with using MEL Expression in a JDBC ORACLE database query.
In particular the Mule flow accepts a Excel file that is transformed in a Map through a Datamapper and its fields are used to make a query in a database in this form:
<jdbc-ee:query key="Fill Table" value="INSERT INTO BUFF_SBIL_ZONALE (DATA_ORA,MACRO_ZONA,SEGNO_SBIL,PRZ_MSD_VEN,PRZ_MSD_ACQ,ID_BIS,FILE_NAME,DATA_LOAD)
VALUES (TO_DATE(#[map-payload:DATA_ORA], 'DD/MM/YYYY hh:mi:ss'),#[map-payload:MACROZONA],#[map-payload:SEGNO],#[map-payload:P_medioMSD_VEN],#[map-payload:P_medioMSD_ACQ],#[message.inboundProperties['correlationId']],#[message.InvocationProperty['originalFilename']],SYSDATE)"/>
The query seems correct but when I execute the application, I receive an exception that advice me that #[map-payload:P_medioMSD_VEN] is NULL (correctly, because in the Excel file it does not exist) and the MEL Expression cannot read a NULL value.
The problem, so, is not a SQL issue but a MEL issue that does not accept a NULL database field value.
Does anybody know how to bypass the MEL Exception in order to accepts the mullable value?
Thanks in advance to everybody
The exception thrown is: *org.mule.api.expression.RequiredValueException: Expression Evaluator "bean" with expression "xy" returned null but a value was required. *