【问题标题】:how to send a json object as a parameter to a native query calling a procedure?如何将 json 对象作为参数发送到调用过程的本机查询?
【发布时间】:2017-01-27 06:06:49
【问题描述】:

大家好,我的问题是我有一个 jsonobject,并且我将此对象作为参数发送到 nativeQuery:

Query query = entityManager
            .createNativeQuery("{call myprocedure(?)} ");
    query.setParameter(1, myjson);

我收到以下错误:

10:54:06,362 WARN  [JDBCExceptionReporter] SQL Error: 907, SQLState: 42000
10:54:06,362 ERROR [JDBCExceptionReporter] ORA-00907 missing right parenthesis

我的 json 对象:

{"phone":4834378165,"observation":"","colaborator_open":"S","reason":"asdf","location_description":"","residence_number":"","colaborator_registration":901546,"amount":0,"street_id":"0","colaborator_type":"T","name":"client","solicitation_type":"I","is_printed":"N","subsidiary_type":5,"service_code":5930,"amount_informed":0,"staff_visit":"N"}

【问题讨论】:

  • 通过函数更改过程并调用来解决:

标签: java json oracle procedure nativequery


【解决方案1】:

解决了更改函数的过程并像这样调用:

 select  myFunction(?) from dual

【讨论】:

    猜你喜欢
    • 2020-09-23
    • 2017-10-01
    • 1970-01-01
    • 2020-04-25
    • 2013-02-09
    • 1970-01-01
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    相关资源
    最近更新 更多