Searching for "procedure."

Q:

Define stored procedure. What are its advantages and disadvantages?

Answer

A stored procedure is a segment of declarative SQL statements stored inside the database catalog. A stored procedure can be invoked by triggers, other stored procedures or applications such as Java, C#, PHP, etc.


Advantages 



- Typically stored procedures help increase the performance of the applications. Once created, stored procedures are compiled and stored in the database. However MySQL implements the stored procedures slightly different. MySQL stored procedures are compiled on demand. After compiling a stored procedure, MySQL puts it to a cache. And MySQL maintains its own stored procedure cache for every single connection. If an application uses a stored procedure multiple times in a single connection, the compiled version is used, otherwise the stored procedure works like a query.


- Stored procedures helps reduce the traffic between application and database server because instead of sending multiple lengthy SQL statements, the application has to send only name and parameters of the stored procedure.


- Stored procedures are reusable and transparent to any applications. Stored procedures expose the database interface to all applications so that developers don’t have to develop functions that are already supported in stored procedures.


- Stored procedures are secure. Database administrator can grant appropriate permissions to applications that access stored procedures in the database without giving any permission on the underlying database tables.


Disadvantages


- If you use a lot of stored procedures, the memory usage of every connection that is using those stored procedures will increase substantially. In addition, if you overuse a large number of logical operations inside store procedures, the CPU usage will also increase because database server is not well-designed for logical operations.


- A constructs of stored procedures make it more difficult to develop stored procedures that have complicated business logic.


- It is difficult to debug stored procedures. Only few database management systems allow you to debug stored procedures. Unfortunately, MySQL does not provide facilities for debugging stored procedures.


-It is not easy to develop and maintain stored procedures. Developing and maintaining stored procedures are often required specialized skill set that not all application developers possess. This may lead to problems in both application development and maintenance phases.

Report Error

View answer Workspace Report Error Discuss

Q:

Explain the difference between trigger and stored procedure.

Answer

-  A stored procedure can accept parameters while a trigger cannot.
-  A trigger can’t return any value while stored procedures can.
-  A trigger is executed automatically on some event while a stored procedure needs to be explicitly called.
-  Triggers are used for insertions, update and deletions on tables while stored procedures are often using independently in the database.
-  A trigger cannot be written in a stored procedure. However, the reverse is not possible.

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

Q:

Explain electronic payment procedure.

Answer

- The merchant submits a credit card transaction to the Payment Gateway on behalf of a customer via secure connection from a Web site, at retail, from a MOTO center or a wireless device. 


- Payment Gateway receives the secure transaction information and passes it via a secure connection to the Merchant Bank’s Processor. 


- The Merchant Bank’s Processor submits the transaction to the Credit Card Interchange (a network of financial entities that communicate to manage the processing, clearing, and settlement of credit card transactions). 


- The Credit Card Interchange routes the transaction to the customer’s Credit Card Issuer. 


- The Credit Card Issuer approves or declines the transaction based on the customer’s available funds and passes the transaction results, and if approved, the appropriate funds, back through the Credit Card Interchange. 


- The Credit Card Interchange relays the transaction results to the Merchant Bank’s Processor. 


- The Merchant Bank’s Processor relays the transaction results to Payment Gateway. 


- Payment Gateway stores the transaction results and sends them to the customer and/or the merchant. This communication process averages three seconds or less. 


- The Credit Card Interchange passes the appropriate funds for the transaction to the Merchant’s Bank, which then deposits funds into the merchant’s bank account. The funds are typically deposited into your primary bank account within two to four business days.

Report Error

View answer Workspace Report Error Discuss

Subject: Web Technology