简体   繁体   中英

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

Here is the function sample:

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

Java code:

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

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. Copy it to a text editor (textpad) to see if you have any.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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