 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ole Guest
|
Posted: Fri Sep 19, 2003 11:13 am Post subject: PL/SQL in Oracle 8i |
|
|
Hallo,
I want execute a procedure from Java but the procedure is very long so it
doesn't goes like this:
...Statement s = c.createStatement();
String sproc = "CREATE OR REPLACE PROCEDURE XYZ......");
The Procedure is known by the Database, but how can I execute it from Java?
Thanks in advance.
Ole
|
|
| Back to top |
|
 |
Ralf Bensmann Guest
|
Posted: Fri Sep 19, 2003 6:57 pm Post subject: Re: PL/SQL in Oracle 8i |
|
|
Ole wrote:
| Quote: | Hallo,
I want execute a procedure from Java but the procedure is very long so it
doesn't goes like this:
..Statement s = c.createStatement();
String sproc = "CREATE OR REPLACE PROCEDURE XYZ......");
The Procedure is known by the Database, but how can I execute it from Java?
Thanks in advance.
Ole
|
Use java.sql.CallableStatement. It is similar to using a prepared
Statement. Example:
// storec proc. xyz with three params
CallableStatement cstmt = conn.prepareCall("{call xyz(?, ?, ?)}");
// set params, like used in a prepared statement
cstmt.setInt(1, 100);
cstmt.setInt(2, 250);
cstmt.setString(3, "hello");
// execute the procedure
cstmt.execute();
Greetings
Ralf.
|
|
| Back to top |
|
 |
Andree Große Guest
|
Posted: Tue Sep 23, 2003 11:39 am Post subject: Re: PL/SQL in Oracle 8i |
|
|
Ralf Bensmann wrote:
| Quote: | Ole wrote:
Hallo,
I want execute a procedure from Java but the procedure is very long so it
doesn't goes like this:
..Statement s = c.createStatement();
String sproc = "CREATE OR REPLACE PROCEDURE XYZ......");
Use java.sql.CallableStatement. It is similar to using a prepared
Statement. Example:
// storec proc. xyz with three params
CallableStatement cstmt = conn.prepareCall("{call xyz(?, ?, ?)}");
|
A stored procedure to cerate a stored procedure?
That's very interesting. He want to perform a
PL/SQL Script.
A.G.
|
|
| Back to top |
|
 |
Andree Große Guest
|
Posted: Tue Sep 23, 2003 11:42 am Post subject: Re: PL/SQL in Oracle 8i |
|
|
Ole wrote:
| Quote: | Hallo,
I want execute a procedure from Java but the procedure is very long so it
doesn't goes like this:
..Statement s = c.createStatement();
String sproc = "CREATE OR REPLACE PROCEDURE XYZ......");
The Procedure is known by the Database, but how can I execute it from Java?
|
Why do you think that does not work?
A.G.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|