0

I have a DB code:

type T_Sk is record
(
  code Integer,
  dat Date,
  ...
  );
type TBL_Sk is table of T_Sk;
function FN_Sk(ADetId in Integer, ATrudoForFac in Integer, ATrudoForCex in Integer) return TBL_Sk pipelined;

Which is generate table, I think. And select from it looking like

select t.* from table(PK_DISP.FN_Sk(ADetId, ATrudoForFac, ATrudoForCex)) t 

I tried to use native query with parameters

@Query(nativeQuery = true, value = "select * from (PK_DISP.FN_Sk(:detid, :factory, :cexnum))")
List<Spares> findAllByRequest(@Param("detid") int detid, @Param("factory") int factory, @Param("cexnum") int cexnum);

But when I execute with url: http://localhost:8080/api/get?detid=458194&factory=999&cexnum=2

@GetMapping("/get")
    public List<Spares> getAll2(@RequestParam(value = "detid") int detid,
             @RequestParam(value = "factory") int factory, @RequestParam(value = "cexnum") int cexnum){
        return sparesRepository.findAllByRequest(detid, factory, cexnum);
    }

I got empty response. And the DB getting request and exetute function correctly. Sometimes when I try to use another value of :detid, I getting an SQLExeption. What I do wrong? Is the @Param required @ResponseHeader isntead @RequestParam?

Max
  • 29
  • 5
  • Sounds like your function returns an empty result. – Jens Schauder Sep 21 '22 at 11:56
  • Have you tried enabling sql logging? It will show the sql query which spring is sending and help you debug this. https://stackoverflow.com/questions/30118683/how-can-i-log-sql-statements-in-spring-boot – Stomf Sep 21 '22 at 12:02
  • 2
    In this line: ˛ `@Query(nativeQuery = true, value = "select * from (PK_DISP.FN_Sk...` you're missing the `table` keyword (I don't know whether you really miss it, or just "forgot" to put it here, into the question). – Littlefoot Sep 21 '22 at 17:16

0 Answers0