首页 > 其他分享 >difference between store procedures and functions

difference between store procedures and functions

时间:2023-08-02 19:01:37浏览次数:29  
标签:Function functions used return whereas Functions difference procedures SELECT

Functions can't modify anything and must have at least one parameter. They also have to return a result. Stored procedures don't need a parameter, may modify database objects, and don't have to return a result.

Stored procedures are used to connect SQL queries in a transaction and to communicate with the outside world.

 

    1. The function must return a value but in Stored Procedure it is optional. Even a procedure can return zero or n values.

    2. Functions can have only input parameters for it whereas Procedures can have input or output parameters.

    3. Functions can be called from Procedure whereas Procedures cannot be called from a Function.


    The procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it. Procedures cannot be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement. Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be. Functions that return tables can be treated as another rowset. This can be used in JOINs with other tables. Inline Function can be though of as views that take parameters and can be used in JOINs and other Rowset operations. An exception can be handled by try-catch block in a Procedure whereas try-catch block cannot be used in a Function. We can use Transactions in Procedure whereas we can't use Transactions in Function.

      

标签:Function,functions,used,return,whereas,Functions,difference,procedures,SELECT
From: https://www.cnblogs.com/Fred1987/p/17601523.html

相关文章

  • 超级好用的绕过php的disable_functions
    寻思寻思今天就写了吧这里背景是在打同学搭的网站,一句话已经进去了,但是执行不了命令 能够看到能用的函数几乎都被禁了在网上找了挺多方法都用不了,蚁剑的各种插件也绕不过最后找到了这个 哥斯拉的绕过disable中的双链表它的说法是这样的 (来源:http://www.hackdig.com/......
  • Test Commands-Functions下——创建自定义Test Case
    TestCommands-Functions下_哔哩哔哩_bilibili基于上一节所创建的测试实例,编写多个不同车速的TestCase,若仅改变信号EngineSpeed的值,也要重复编写多次,花费时间长且易出错,这时可通过Functions功能自定义一个TestCase模板,并基于该模板添加多个TestCase用例1)选择Functions——Tes......
  • Test Commands-Functions上
    TestCommands-Functions上_哔哩哔哩_bilibili1.对于冗长的测试用例,随着添加的内容越多,同时伴随人员编写时间的增加,后续修改测试用例内容,排查错误的难度也随之上升,这时可以使用vTESTstudio自带的工具"Functions"对测试用例进行优化。2.Functions栏在TestTableEditor左下角;用......
  • P3519 [POI2011]ROZ-Difference
    考虑枚举最大的字母所处的位置\(i\)作为端点和最小的字母\(j\)。然后就有记录一下前缀出现次数\(cnt\),枚举一个区间。\[cnt_{i,ch_i}-cnt_{i,j}-(cnt_{i',ch_i}-cnt_{i',j})\]求这个式子最大值。显然这两个式子相似,记录一下关于\(ch_i\)的\(cnt\)前缀最小值即......
  • 【849】R String Manipulation Functions
    ref:[R字符串]字符串长度、分割、拼接、截取、替代、匹配和大小写替换ref:RStringManipulationFunctions1.nchar()Withthehelpofthisfunction,wecancountthecharacters. Thisfunctionconsistsofacharactervectorasitsargumentwhichthenreturns......
  • Wallys WIFI7 Mainboard /the difference between ipq9574 with ipq9554/DBDC.
    WIFI7MainboardSPECTheIPQ9574andIPQ9554arebothsystem-on-chip(SoC)solutionsdesignedbyQualcommfornetworkingapplications,buttheybelongtodifferentgenerationsandofferdifferentcapabilities.Herearethekeydifferencesbetweenthetwo:G......
  • What are the differences between in vivo and in vitro testing of drugs for toxic
    Intoxicologystudies,therearetwomaintypesoftestsusedtoassessthesafetyandpotentialtoxiceffectsofdrugs:invivotestsandinvitrotests.Weknowthatthetraditionalmethodofdrugtoxicologyresearchistouseanimalmodelsforinvivo......
  • python: pymssql stored procedures insert output
    sqlscript:IFEXISTS(SELECT*FROMsysobjectsWHERE[name]='proc_Insert_BookKindOut')DROPPROCEDUREproc_Insert_BookKindOutGOCREATEPROCEDUREproc_Insert_InsuranceMoneyOut(@InsuranceNameNVarChar(1000),@InsuranceCostfloat,......
  • Differences between SysVinit, Upstart and Systemd
    DifferencesbetweenSysVinit,UpstartandSystemdhttps://www.computernetworkingnotes.com/linux-tutorials/differences-between-sysvinit-upstart-and-systemd.html#:~:text=To%20refer%20to%20the%20initialization%20process%2C%20the%20SysVinit,%27UNIX%20System%2......
  • opcenter camstar designer基础知识-- Functions
     已编写函数来执行各种任务,如简单的算术、搜索复杂的数据结构、数据库查询、报告编写、数据收集、数据验证等等。函数具有零个或更多参数,并且由ActiveX组件实施。包含在CLF中的函数可以执行工作。函数有权访问系统的内部对象设计,它通过操纵该设计来完成工作。以下主题提供有......