Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Create SQL store procedure

 
Mahendra Darwatkar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
rgds,
Mahendra
 
Dave Soto
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic