SQL Stored Procedures as Front End?

  • Thread starter Thread starter WWGD
  • Start date Start date
  • Tags Tags
    sql
Click For Summary

Discussion Overview

The discussion revolves around the feasibility and implications of using SQL stored procedures as a front end for applications. Participants explore the potential benefits and drawbacks of this approach compared to other methods, such as Object Relational Mapping (ORM) and Access front ends.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant questions the feasibility of using SQL stored procedures as a front end, suggesting that they could simplify querying based on known application needs.
  • Another participant expresses belief in the possibility of this approach but indicates a need to find an example.
  • A participant mentions a comparison to Access front ends, recalling a similar technique seen in Oracle databases involving views.
  • One contributor outlines several benefits of stored procedures, including performance gains, enhanced security, encapsulation of business logic, and code reuse, while noting that they may not be worth the effort for simple queries.
  • This same participant advocates for ORM as a preferred alternative, highlighting its advantages in rapid development, maintainability, and automatic query generation, while acknowledging potential downsides such as lower performance and overhead.
  • The discussion includes a perspective that the choice between stored procedures and ORM should depend on the specific situation and requirements of the application.

Areas of Agreement / Disagreement

Participants express differing views on the use of stored procedures versus ORM, with no consensus reached on which approach is superior. Some participants advocate for stored procedures in specific scenarios, while others favor ORM for general application development.

Contextual Notes

Participants mention various factors influencing the choice between stored procedures and ORM, including performance, security, and the complexity of queries, but do not resolve the debate over which method is more effective overall.

WWGD
Science Advisor
Homework Helper
Messages
7,806
Reaction score
13,120
Hi,
Just curious: is it possible/feasible to use SQL stored procedures as a front end? I mean, couldn't we
design stored procedures to allow for easier querying if we knew the general type of queries that would be used for the application (of course, the application for which we designed the back-end SQL) ?
 
Technology news on Phys.org
I believe that you can do that but it's been a while since I've done it. I'll have to dig around for an example if you want one.
 
  • Like
Likes   Reactions: WWGD
Borg said:
I believe that you can do that but it's been a while since I've done it. I'll have to dig around for an example if you want one.
Thanks^5000 (for previous) Borg. How does this compare to an Access front end in general?
 
  • Like
Likes   Reactions: Borg
WWGD said:
Thanks^5000 (for previous) Borg. How does this compare to an Access front end in general?
I don't know about Access. I remember seeing a trick like this in an Oracle database about four years ago. If I remember correctly, it's an Oracle View.
 
  • Like
Likes   Reactions: WWGD
You can use stored procedures - I've used them a lot, to talk in my own experience, as they have four crucial benefits: performance - the compilation is done on database server, so subsequent requests have performance gain, security - stored procedures are database objects, so you can take security measures and prevent some nasty things to happen, like SQL injection attacks, encapsulation - talking essentially about business logic in one place and of course last but not least, code reuse. However, stored procedures design and implementation is waste of time if simple queries is the case. That's because code must be written in the application to call the stored procedure, pass the parameters it should, check the result and return data.
A more preferred way is Object Relational Mapping, as ORM essentially creates a representation of the data model. So effectively you can access your database without SQL code or constructs. Especially for CRUD operations that represent a very high percentage of total operations to be executed, ORMs create parameterized queries automatically.
In general, ORMs have more benefits in many cases than stored procedures, like rapid app development, less code to be written, good maintainability, performance and they don't break the N-Tier model - something that stored procedures do.
Of course there are counter - arguments for them too, as lower performance than stored procedures, much overhead, less security and others, which in most cases are of minimum impact.
In my opinion the situation at hand is the best judge about what to use and how. In my experience, after ORM became widespread, I tend to use it more and use stored procedures for more "special" reasons. Such reasons include: big number of records pushed in a single statement, legacy applications (that you can't but use them), some complex query situations and data aggregation.
 
  • Like
Likes   Reactions: WWGD

Similar threads

  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 35 ·
2
Replies
35
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K
Replies
2
Views
2K
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K