简体   繁体   中英

How do I call a user defined sql function from springboot?

I'm trying to call a user defined function from PLSQL database, it takes several variables and return a single float.

I've tried code like this:

@Query(nativeQuery = true, value = "SELECT package.function("variables: 
value")
float getFuction(@Param("value") String value);

This shows an error saying "FROM keyword was not found where expected.

I think that it should be like that (i do not have chance to check):

@Query(nativeQuery = true, value = "SELECT package.function(:value) FROM dual")
float getFuction(@Param("value") String value);

It is based on this answer

The solution:

@Query(nativeQuery = true, value = "SELECT package.function("variables: value") FROM dual")
float getFuction(@Param("value") String value);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM