Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dapper Binding failing with Dynamic Parameters #2035

Open
LongJohnBlackbeard opened this issue Jan 29, 2024 · 0 comments
Open

Dapper Binding failing with Dynamic Parameters #2035

LongJohnBlackbeard opened this issue Jan 29, 2024 · 0 comments

Comments

@LongJohnBlackbeard
Copy link

This issue I have also posted here: https://stackoverflow.com/questions/77902278/why-does-oracle-sql-dapper-not-recognize-these-numbers

Writing a custom Oracle SQL query in .NET using Dapper for dynamic parameters. The field that is giving me an issue is a number(6, 0) field that represents a date field in JD Edwards (JDE Julian Date). In my C# application I have a utility function that converts a date time to JDE Julian Date. Here is the Where clause of the query:

WHERE WR.WLOPST IN :OpStatus AND WO.WASRST IN :WoStatus AND TRIM(WL.MCRP01) IN :Plants AND WC.IWMCUW IN :Depts AND WR.WLMCU IN :WorkCenters AND WR.WLDRQJ >= :DateStart AND WR.WLDRQJ <= :DateEnd AND WT.MEY55OHOLD IN :Holds AND LENGTH(REPLACE(WR.WLAPID, ' ', ' ')) >= :AssetAssigned AND WR.WLDOCO >= :WorkOrderLow AND WR.WLDOCO <= :WorkOrderHigh AND WO.WAVR01 >= :PESNumberLow AND WO.WAVR01 <= :PESNumberHigh AND RT.P1Y55OP IN :OpCodes ORDER BY WR.WLDOCO

I've narrowed down the issue in the where clause to WR.WLDRQJ <= :DateEnd. What is weird is when the date is 02/15/2024 (124046) this query runs fine. When I choose any time past that like 02/16/2024 (124047) I get ORA-01722: invalid number. I validate every datetime value to its Julian Value to make sure the conversion is correct. Furthermore, I can run this in SQL Developer just fine which leads me to believe this may be a dapper issue with dynamic parameters. When debugging I can see what is being assigned to the parameter:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant