What is the Stored Procedure and Why Stored Procedure ?

Hi,

In this article I will tell about the Stored Procedure which should be used in large projects.

I think it should definitely be used in large-scale projects because the difference of Stored procedures only occurs in projects that require large-scale performance and efficiency.

 

 

Stored procedure in general, we can describe as follows: SQL statements which is not needed to compile after first compilation and keeps in the database server. On the other hand, we can say T-SQL statements stored in Database server instead of Application layer.

Stored procedures, as in other programming languages, can be run without parameters. It is also called SP when using in application development. All database operations can be done with Stored procedures.

 

One of the most beautiful features of using stored procedures is perhaps seperate the programming language codes from the DML (Database manipulation Language) database queries. In addition, once you have written and compiled a SP you can use many times.

In general, I will state the advantages of Stored procedures and why they are used too much as following.

 

  • Stored Procedures are very fast because they are kept in the database server, the reason is that they do not need to compile one more time after compiling one time alone. However, the SQL code that you sent in the Application layer has to be compiled again and again at every transaction. This is a great waste of time for large-scale projects and servers serving more than 1 client.
  • Provides excellent savings in network traffic.
  • It provides automatic parameterization to SQL statements. Instead of replacing all parameters in the place where SQL statements pass, you can only modify the parameters or rules within the SP. This also fixes the complexity of applications that allows your application to be modular.
  • You can use T-SQL commands in addition to programming expressions (if, while, for, etc.) when writing stored procedures.
  • Stored procedures are more reliable because only the input and output parameters appear in the application layer. If we think that access to the database server is usually done with the user ID and password, we can say that using SP is an element of trust for our codes.

 

I have explained the advantages of Stored procedures that came to my mind above. Almost all of the software applications do not use normal sql codes in general.

As I said above, being managed from a single point and using it in more than one place and not being able to see other people easily makes SPs very advantageous.

 

Especially when we think about Network traffic, sending many lines SQL commands sent by the client to the server instead of sending the name of the Stored Procedure to the server one time it means that Network traffic is very relieved.

 

There are Four types of Stored Procedures.

  1. System Stored Procedure :  they are in the master database and sp_ prefix is used for these stored procedures. They are used in system-related administrative jobs on the database.
  2. User based Stored Procedure :  These stored procedures are used for our applications. You can delete or change these SP.
  3. Extended Stored Procedure :  Generally, it is compiled like .dll and a type of stored procedure that compiles the Database Server’s functionality. it is added only to the master database.
  4. CLR Stored Procedure : It is a kind of Stored procedure developed in CLR environment using any language.

 

 

 

Mehmet Salih Deveci

I am Founder of IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress mehmetsalih.deveci@outlook.com.-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  mehmetsalih.deveci@outlook.com a mail atabilirsiniz.

2 thoughts on “What is the Stored Procedure and Why Stored Procedure ?

  • March 24, 2019 at 8:26 pm
    Permalink

    Thanks for the tips you have provided here. Yet another thing I would like to say is that computer memory needs generally rise along with other innovations in the technological innovation. For instance, as soon as new generations of cpus are introduced to the market, there is usually a matching increase in the size and style demands of all computer system memory along with hard drive room. This is because the software program operated by means of these cpus will inevitably increase in power to take advantage of the new technological innovation.

    Reply
  • March 27, 2019 at 9:09 am
    Permalink

    Thanks for the suggestions you have provided here. One more thing I would like to state is that laptop memory needs generally go up along with other innovations in the technology. For instance, when new generations of processors are made in the market, there’s usually an equivalent increase in the type calls for of both the laptop or computer memory along with hard drive room. This is because the software operated through these processor chips will inevitably boost in power to leverage the new technologies.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *