I am using run query for select
“Select a.* From bajaj_ar_head a, bajaj_plan_master b, bajaj_policy_type c, bajaj_main_type d
WHERE
A.PLAN_NO=B.PLAN_NO and B.PL_TYPE_CD=c.pt_code
and C.MAIN_PT_CODE=D.PT_CODE and d.PT_DESC=‘MOTOR’
and (a.sys_ar_dt>=@FromDate and a.sys_ar_dt<=ToDate)
and (a.status_cd<>‘B’ or a.status_cd is null)
And a.status_cd<>‘A’”
where I’m passing values for date using parameters giving me an error as missing expression but while executing same query like
Select a.* From bajaj_ar_head a, bajaj_plan_master b, bajaj_policy_type c, bajaj_main_type d
WHERE
A.PLAN_NO=B.PLAN_NO and B.PL_TYPE_CD=c.pt_code
and C.MAIN_PT_CODE=D.PT_CODE and d.PT_DESC=‘MOTOR’
and (a.sys_ar_dt>=‘01-APR-2022’ and a.sys_ar_dt<=‘30-APR-2022’)
and (a.status_cd<>‘B’ or a.status_cd is null)
And a.status_cd<>‘A’
it works
So how to resolve this issue any help
what is the DataType of sys_ar_dt?
if it is Date ensure you are passing the parameter of the type Date, and before passing it convert to the standard type for which your query is successfully debugging and then pass it as an argument.
If it is varchar then use single quote.
@Divyashreem the datatype is Date and when we are convert string to date using CDate() the output is with timestamp and when we convert that to required format then it is change to string. So how can I change required format so that it is not change to string and still remain as Date.
Also How can I pass Date type variable into sql query for oracle.
@sushantchanakhekar2299 dd-MMM-yyyy is this the date format stored in db? Can you please share the database row screenshot and uipath workflow screenshot?
@Divyashreem What is To_Date and The expression is used in sql query? or at parameter window and what is Datatype of parameter should pass string or DateTime