- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is STORED PROCEDURE in a DB2? How will you create a new stored procedure?
The DB2 STORED PROCEDURE are the programs which are directly managed by DBMS. The STORED PROCEDURE generally contains SQLs and they can be called by application programs. The STORED PROCEDURE processes the query and returns the result to the application program. The STORED PROCEDURES can be used for the SQLs which are very often used, so instead of using the same SQL query again and again, we can simply use STORED PROCEDURE.
The other benefit of STORED PROCEDURE is that they are fast and have good performance as compared to static SQLs used in application programs. The STORED PROCEDURE can be written in many languages like COBOL, JAVA, C++, etc. Once we have written a STORED PROCEDURE in any of the languages, we have to register this STORED PROCEDURE in DB2 using below command.
Example
CREATE PROCEDURE ORDERSTAT (IN ORDER_ID CHAR(8), OUT ORDER_STATUS CHAR(3))
A STORED PROCEDURE with the name ORDERSTAT will be created using the above command which will take the input as ORDER_ID and gives ORDER_STATUS in output.
- Related Articles
- What is stored procedure and how can we create MySQL stored procedures?
- How to create MongoDB stored procedure?
- MySQL Stored Procedure to create a table?
- How can a MySQL stored procedure call another MySQL stored procedure inside it?
- Create a stored procedure with delimiter in MySQL
- How can a COBOL-DB2 program call a STORED PROCEDURE? Give an example.
- How to create a Stored procedure in a database using JDBC API?
- Create a table inside a MySQL stored procedure and insert a record on calling the procedure
- Set conditions in a MySQL stored procedure
- How to create a Stored procedure in Oracle database using JDBC API?
- Call Stored Procedures within a Stored Procedure with IF Logic?
- Lazy Stored Procedure in Swift
- Create a MySQL stored procedure that generates five random numbers?
- How can we alter a MySQL stored procedure?
- How can we drop a MySQL stored procedure?
