【发布时间】:2013-10-16 10:27:46
【问题描述】:
我正在使用 postgresql 过程并尝试从我的 JDBC 程序中调用一个过程。但是,即使我交叉检查并验证了过程名称是否正确,运行时异常也会说过程不存在。 这就是我正在做的事情
CallableStatement cs = connection.prepareCall("{call proc1()}");
cs.executeUpdate();
这是我的 proc1 程序
create or replace procedure proc1()
as
begin
insert into employee_info values(1,'johnny','1111',43);
-----
end
输出是这样的
Connection Failed! ERROR: function proc1() does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
我不明白为什么它不工作即使 proc1() 存在于数据库中。 我应该投射什么?
【问题讨论】:
-
Postgres 中没有
create or replace procedure -
哦。是吗?那我应该如何创建程序。其实我熟悉mysql、oracle等数据库。我是 postgres 的新手。你能给我一个很好的链接来解释 postgresql 过程
-
@a_horse_with_no_name 否。当我在数据库中手动执行该过程时,该过程运行良好。所以过程语法没有错。
-
那你没有使用 Postgres。 Postgres 没有过程,只有函数,因此它只有一个
create or replace function语句。 -
create procedure是 PostgresPlus 接受的语法,这是一个旨在兼容 oracle 的 postgres 分支。
标签: java postgresql jdbc postgresql-9.1