Skip to content
  • Categories
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse

Odoo 中文社区

  1. Home
  2. Categories
  3. Odoo 新手求助
  4. odoo12调用存储过程(procedure)

odoo12调用存储过程(procedure)

Scheduled Pinned Locked Moved Odoo 新手求助
2 Posts 1 Posters 1.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zhihao.ding
    wrote on last edited by
    #1

    数据库中有存储过程如下:
    CREATE OR REPLACE PROCEDURE "public"."triple"(INOUT "x" int4)
    AS $BODY$
    BEGIN
    x := x * 3;
    UPDATE hr_employee set
    COMMIT;
    END;
    $BODY$
    LANGUAGE plpgsql

    在navicat中执行此存储过程:
    985d75b0-f05c-4864-bfcb-5a1012ca7b6c-image.png

    但是在python代码中使用psycopg2包进行调用的时候,就无法成功。
    报错截图如下:
    d87f3b50-316e-4500-8dce-8a8363b5eb97-image.png

    90421b88-0d8b-4f06-be98-45e362aa248c-image.png

    如果在存储过程中将commit注释掉,cursor.execute("CALL triple(3)") 可以执行成功

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      zhihao.ding
      wrote on last edited by
      #2

      @zhihao-ding 在 odoo12调用存储过程(procedure) 中说:

      UPDATE hr_employee set

      UPDATE hr_employee set 这行是想测东西加的 执行的时候没有这行 就当这行不存在 em...

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Tags
      • Popular
      • Users
      • Groups