简体   繁体   English

获取无效数字异常:ORA-01722:在金额字段中使用十进制值执行查询时无效数字

[英]getting Invalid Number exception : ORA-01722: invalid number while executing query with decimal value in the amount field

I am getting below invalid Number exception while executing query.我在执行查询时遇到无效数字异常。 please help me on this.请帮我解决这个问题。 Same query executed properly in DB.在数据库中正确执行相同的查询。

Note: While passing amount with decimal (12.87) I am getting error and With out decimal it works well.注意:使用十进制 (12.87) 传递金额时出现错误,如果没有十进制,它运行良好。

Code:代码:

@PersistenceContext private EntityManager em; @PersistenceContext 私有 EntityManager em;

Query = query =em.createNativeQuery(sql, class.forName(search.getDBEntityClassName()));查询 = 查询 =em.createNativeQuery(sql, class.forName(search.getDBEntityClassName())); List result = query.getResultList();列表结果 = query.getResultList();

Table Defination:表定义:

View: VW_SEARCH_TMP视图:VW_SEARCH_TMP

AMOUNT : NUMBER (11,2);数量:数量(11,2); // when search with numeric (10) works well. // 当使用数字 (10) 进行搜索时效果很好。 But with decimal (10.12) getting error ID: NUMBER(11);但是十进制(10.12)得到错误ID:NUMBER(11);

Query: ReadAllQuery(referenceClass=VwSearchCheque sql="SELECT * FROM (SELECT * FROM VW_SEARCH_TMP WHERE ID = ? AND CHEQUE_NO LIKE ? ESCAPE '' AND AMOUNT = ? ORDER BY ISSUE_DATE ASC) WHERE ROWNUM<=501 ")查询:ReadAllQuery(referenceClass=VwSearchCheque sql="SELECT * FROM (SELECT * FROM VW_SEARCH_TMP WHERE ID = ? AND CHEQUE_NO LIKE ? ESCAPE '' AND AMOUNT = ? ORDER BY ISSUE_DATE ASC) WHERE ROWNUM<=501 ")

O [EL Warning]: 2020-10-29 16:26:05.799--UnitOfWork(1908522008)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number O [EL 警告]: 2020-10-29 16:26:05.799--UnitOfWork(1908522008)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): ence org.eclipse.persist exceptions.DatabaseException 内部异常:java.sql.SQLSyntaxErrorException:ORA-01722:无效数字

Error Code: 1722错误代码:1722

at org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:378) at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260) at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:469) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:375) at com.sun.proxy.$Proxy161.getResultList(Unknown Source) at ca.on.jus.tms.searchEngine.service.SearchServiceImpl.search(SearchServiceImpl.java:179) at ca.on.jus.tms.web.controller.search.SearchController.searchEntity(SearchController.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect在 org.eclipse.persistence.internal.jpa.QueryImpl.getDetailedException(QueryImpl.java:378) 在 org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:260) 在 org.eclipse.persistence.internal .jpa.QueryImpl.getResultList(QueryImpl.java:469) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImplating.inAccessvoke(Native Method) .java:56) 在 java.lang.reflect.Method.invoke(Method.java:620) 在 org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:375) 在 com.sun.proxy。 $Proxy161.getResultList(Unknown Source) at ca.on.jus.tms.searchEngine.service.SearchServiceImpl.search(SearchServiceImpl.java:179) at ca.on.jus.tms.web.controller.search.SearchController.searchEntity( SearchController.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) Caused by: org.eclipse. .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56) at java.lang.reflect.Method.invoke(Method.java:620) at org.springframework.web。 method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation。 ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) 在 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) 在 org.springframework.web.servlet.mvc.method.annotation。 RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) 引起:org.eclipse。 persistence.exceptions.DatabaseException: Internal Exception: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number persistence.exceptions.DatabaseException: 内部异常: java.sql.SQLSyntaxErrorException: ORA-01722: 无效数字

While passing amount with decimal (12.87) I am getting error and With out decimal it works well在使用十进制 (12.87) 传递金额时,我收到错误并且没有十进制它运行良好

It looks like decimal point character isn't dot, but comma.看起来小数点字符不是点,而是逗号。

Try 12,87 instead.改为尝试12,87

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在准备语句中执行 IN 子句时出现无效数字异常(ORA-01722) - invalid number exception(ORA-01722) while executing IN clause in preparedstatement ORA-01722:更新中的数字无效 - ORA-01722: invalid number exception in update 获取ORA-01722:Spring数据查询中的数字无效 - Getting ORA-01722: invalid number in Spring Data query 从网页插入表单数据时获取ORA-01722:无效数字错误 - getting ORA-01722: invalid number error while inserting form data from webpage 错误 --&gt; java.sql.SQLSyntaxErrorException: ORA-01722: 无效号码 - ERROR --> java.sql.SQLSyntaxErrorException: ORA-01722: invalid number ORA-01722:使用Hibernate时号码无效 - ORA-01722: invalid number when using Hibernate Hibernate Map抛出 - ORA-01722:无效的数字错误 - Hibernate Map throws - ORA-01722: invalid number error 错误 java.sql.SQLException: ORA-01722: 运行准备好的语句以更改序列时数字无效 - ERROR java.sql.SQLException: ORA-01722: invalid number while running a Prepared Statement to alter a Sequence java.sql.SQLSyntaxErrorException:ORA-01722:refcursor上的resultSet.next()时数字无效,我不明白为什么? - java.sql.SQLSyntaxErrorException: ORA-01722: invalid number while resultSet.next() on refcursor and I don't understand why? java.sql.SQLSyntaxErrorException:ORA-01722:number_where IN无效 - java.sql.SQLSyntaxErrorException: ORA-01722: invalid number_where IN
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM