aspose file tools
The moose likes JDBC and Relational Databases and the fly likes Create SQL store procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Create SQL store procedure" Watch "Create SQL store procedure" New topic

Create SQL store procedure

Mahendra Darwatkar

Joined: Apr 07, 2000
Posts: 20
Hi All
How can I create Store Proecedure in SQL database
i.e. I am having one file of store procedure xyz.sql. I want to create "xyz" stored procedure in sql database and execure after words.
Can anybody help me in this...
Dave Soto
Ranch Hand

Joined: Sep 15, 2001
Posts: 55
You can CALL a stored procedure with JDBC, but you cannot CREATE one. Each DBMS has its own syntax for creating stored procedures, and the current JDBC spec does not handle this. You have to look into the syntax for the particular DBMS you are running.
Once you've created the stored procedure on the DBMS, calling it from a JDBC statement is pretty simple. (This example is VERY simplified, it assumes the stored procedure has no arguments)

The most important thing to notice is that it uses the {call ...} escape sequence. This instructs the JDBC driver to translate this sequence into the native command for your particular DBMS.
subject: Create SQL store procedure