What is the point of the stored procedure?

Are they useful for anything other than a database administrator? If I understand them correctly, these are just queries that can be stored directly in MySQL, so it would be useless to use them for any web development team.

+3
source share
12 answers

Stored procedures are code that runs on the database server.

They have several uses. I think: if I could run the code directly on the database server, what could I use for this?

, .

http://en.wikipedia.org/wiki/Stored_procedure

+11

, :

  • , SQL (Google SQL Injection ). ,
  • - , . 15 . , , proc. , .

. wueries , , , .

, . , SQL Server Database Engine , . :

http://blog.sqlauthority.com/2007/04/13/sql-server-stored-procedures-advantages-and-best-advantage/

http://searchsqlserver.techtarget.com/news/1052737/Why-use-stored-procedures

, , - , - .

4: : /. SQL. GUI . , , , .

+6

. sqrt () , ?

( ) .

+3

. , , , , .

,

? , , .

+2

, . T-SQL. , -, , ..

, . , , - . .

, . ORM (Linq-To-SQL) . , , . Somethings , , .

+1

90- .

. -, , ORM, .

. "", , CRUD, NHibernate Entity Framework.

, SELECT, INSERT, UPDATE DELETE, , , ORM. , , , .., , , .

+1

, , , .. , , .

MySQL, , .

T-SQL ( Microsoft SQL Server) , . , T-SQL, , . , , , . ( , .NET.)

, PL/SQL ( Oracle) - , , ( ), , : -. , SQL. PL/SQL, " ", . http://apex.oracle.com () , PL/SQL.

+1

, , .

$sql = "INSERT INTO t1 (f1,f2...) VALUES (v1, v2...)";
mysql_query($sql, $conn);
$id = mysql_insert_id();
$sql2 = "INSERT INTO t2 (f1,f2,id,f3...) VALUES (v1,v2,$id,v3....);
mysql_query($sql2,$conn)l

, / . INSERT, @id = insert id, INSERT my_proc, .

$sql = "CALL my_proc(arguments)";
mysql_query($sql);
+1

. .

, , . , , . , , .

0

, , MySQL, - .

() , - ? ?

. , - . . .

, webdev?

0

, - .

SQL, , , , SQL- , , , , , ( -). , SQL- ( ).

, , SQL , , sproc, , ( , sproc, , )

0

, , ORM. procs, , , , . , , , . procs , ORM, , SSIS . , , proc, . , , .

I wrote complex procedures that were longer than 1000 lines. Try to get ORM to write this type of SQL. Then try to make it work without a timeout.

0
source

Source: https://habr.com/ru/post/1775882/


All Articles