开发者

Stored procedures in Java [closed]

开发者 https://www.devze.com 2023-02-09 01:16 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

I am new to store p开发者_运维知识库rocedure, I know how to call it, but where do I write the store procedure in my application, in my Java file or somewhere else?


Stored procedures are stored in database. They are integrated with database service. You can find more on Wikipedia: http://en.wikipedia.org/wiki/Stored_procedure

Some vendors offers Java as a language for such procedures, but they can be written in other languages: Oracle uses PL/SQL, PostgreSQL uses PL/pgSQL, PL/Java, PL/Python and others. For PostgreSQL have a look at: http://www.postgresql.org/docs/9.0/interactive/server-programming.html

As for location of sources: to me stored procedures are part of application. I save them with other sources, they are stored in Subversion (or other version control system). But after they are deployed to database server they became part of this service. Upgrading such procedure is database specific. For example Informix has:

execute procedure replace_jar(
  "file:$INFORMIXDIR/extend/jars/mytools.jar",
  "mytools_jar");

While procedure for Oracle in PL/SQL can be replaced with:

create or replace function naznk_errs(p_naznk in varchar)
   ....
0

精彩评论

暂无评论...
验证码 换一张
取 消