I wrote the code as below. There is no problem when running orderUser
When executing orderDelete, the table is being modified normally, but a query statement error occurs.
public interface BasketRepository extends CrudRepository<Cbasket,Long> {
@Override
List<Cbasket> findAll();
List<Cbasket> findAll(Sort id);
@Query(value = "select * from cbasket where userid= :userid",
nativeQuery = true)
List<Cbasket> orderUser(@Param("userid") String userid);
@Query(value = "update cbasket\n" +
"set price=price-(select price from COFFEES where id= :id)\n" +
"where id= :id and userid= :userid",
nativeQuery = true)
List<Cbasket> orderDelete(@Param("id") Long id,@Param("userid") String userid);
}
There is an error like below, but the table is corrected normally, but it is an error that occurs a lot in typo But I don't know why <
2022-02-08 04:42:13.762 TRACE 16568 --- [nio-8080-exec-6] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [122]
2022-02-08 04:42:13.762 TRACE 16568 --- [nio-8080-exec-6] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [122]
2022-02-08 04:42:13.762 TRACE 16568 --- [nio-8080-exec-6] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [VARCHAR] - [[email protected]]
2022-02-08 04:42:13.764 WARN 16568 --- [nio-8080-exec-6] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 900, SQLState: 42000
2022-02-08 04:42:13.764 ERROR 16568 --- [nio-8080-exec-6] o.h.engine.jdbc.spi.SqlExceptionHelper: ORA-00900: SQL statement invalid
There's an error even if I try without a new line \n crying
I don't know how to modify it, so I add it here. There is no error when you go back to else door!
© 2024 OneMinuteCode. All rights reserved.