简体   繁体   English

通过jdbc创建的Oracle函数处于无效状态

[英]Oracle's function created via jdbc is in an invalid state

When I create Oracle's function in SQL Developer everything is ok, but when I create the same function via jdbc it is in invalid state 当我在SQL Developer中创建Oracle函数时,一切正常,但是当我通过jdbc创建相同函数时,它处于无效状态

Here is the function sample: 这是函数示例:

create or replace function TEST_FUNC return number is
begin
    return 100;
end;

Java code: Java代码:

Connection con = ...;
Statement stmt = con.createStatement();
stmt.execute(sql);

When I execute function: 当我执行功能时:

select TEST_FUNC() from dual;

I get error: ORA-06575: Package or function TEST_FUNC is in an invalid state 我收到错误消息:ORA-06575:程序包或函数TEST_FUNC处于无效状态

Can you explain what I'm doing wrong? 你能解释我做错了吗?

Function needed to be complied to use them. 需要使用它们的功能。 Not compiled function gives this exception. 未编译的函数会给出此异常。 Also make sure you do not have any terminating CR/LF in your query. 还要确保查询中没有任何终结的CR / LF。 Copy it to a text editor (textpad) to see if you have any. 将其复制到文本编辑器(文本板)以查看是否有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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