• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is an SQL procedure

 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin Vajsar wrote:I'm still not sure what are you asking about. Do you want a more in-depth explanation of how storing SQL queries in properties file works?


I just want to know what SQL Procedures are and why it is used...!!
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you were actually asking two questions, I've split it into a separate topic. Next time please UseOneThreadPerQuestion.

SQL procedures, usually called stored procedures, are a piece of code stored and executed inside the database. Different databases use different languages for stored procedures, for example MS SQL Server uses Transact-SQL, and Oracle uses PL/SQL. Plain SQL commands and queries can usually be easily embedded into the stored procedure. Stored procedures are part of the database schema. A Java application would typically call a stored procedure which was created in the database by a setup script, for example. It is possible to create a new stored procedure from Java, but certainly not usual. JDBC has a special escape sequence for calling a stored procedure, because the exact syntax used to call it may differ among databases.

The most important reason to use a stored procedure is (in my opinion) to move processing to the database, so a to avoid transferring large amounts of data from database to application and back over the network. There are other valid reasons, such as concentrating DB specific features inside stored procedures, so that in case of migration to another database just the stored procedures would have to be ported.

Wikipedia has some more information on stored procedures.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic