Talk:User-defined function: Difference between revisions

Content deleted Content added
Slamb (talk | contribs)
No edit summary
Implementing WP:PIQA (Task 26)
 
(9 intermediate revisions by 9 users not shown)
Line 1:
{{WikiProject banner shell|class=Start|
{{WikiProject Computing|importance=Low}}
{{WikiProject Computer science|importance=Low}}
{{WikiProject Software|importance=Mid}}
}}
 
==Expand for other uses?==
[[SQL]] is not the only [[programming language]] that uses user defined functions. For example [[ColdFusion]] also uses them. I’m not sure how many other languages use this term however. Should this article be expanded to include other uses of user defined functions? <small>—The preceding [[Wikipedia:Sign your posts on talk pages|unsigned]] comment was added by [[User:Rwblackburn|Rwblackburn]] ([[User talk:Rwblackburn|talk]] • [[Special:Contributions/Rwblackburn|contribs]]) 13:50, April 15, 2005 UTC.</small><!-- [Template:Unsigned] -->
:Yes... it should :) Unfortunately I don't know enough to do it without some research. &mdash;[[User:Seqsea|Seqsea]] ([[User talk:Seqsea|talk]]) 00:44, 16 April 2006 (UTC)
::Obviously, almost any useful programming language lets you re-use your own code. I don't think that is the point of UDF. (Note: I am an Electrical Engineer who can program, not a Computer Science major, so I may be wrong here!) I believe the point is that SQL - Q is QUERY. So if you can get the SERVER to do something for you that is not a query, that's a big deal. The computation is offloaded from the client. I think that [http://en.wikipedia.org/w/index.php?title=User_Defined_Function&curid=1712665&diff=58964483&oldid=57450699 this diff] should be reverted because if not it is going to explode into a [[List_of_hello_world_programs|Hello World]] page showing how to define a function in every possible language, drowning out the uniqueness of the SQL implementation... -- <span style="text-decoration: none;">[[User:Revragnarok|<fontspan colorstyle="color:#696969;">RevRagnarok</fontspan>]] <sup>[[User_talk:Revragnarok |Talk]] [[Special:Contributions/Revragnarok|Contrib]] [[User:Revragnarok/VandalismLog|Reverts]]</sup></span> 17:26, 16 June 2006 (UTC)
 
The term "User Defined Function" is rare in modern programming, because it describes almost all code that is written, so there's no need to turn this into an enormous list. I mentioned BASIC because there's a language feature that is generally referred to as "user defined function". You don't talk about UDF in C or Lisp or any modern language, it's assumed.
Line 11 ⟶ 18:
 
How about this: move the BASIC section below the SQL section, and rename it as "other uses of the term" with something along the lines of "'User defined function' in some older programming languages was used to describe a function written by the programmer rather than included with the language - such usage has become obsolete since in structured programming virtually all program code consists of user defined functions" - would that be better? [[User:Amcguinn|Amcguinn]] 19:30, 16 June 2006 (UTC)
:I think that's a great suggestion. Maybe even massage what I wrote above a little as to why it's a big deal in these two cases...? I'd work on it, but I am out of town for a week starting in the morn... -- <span style="text-decoration: none;">[[User:Revragnarok|<fontspan colorstyle="color:#696969;">RevRagnarok</fontspan>]] <sup>[[User_talk:Revragnarok |Talk]] [[Special:Contributions/Revragnarok|Contrib]] [[User:Revragnarok/VandalismLog|Reverts]]</sup></span> 03:43, 17 June 2006 (UTC)
 
== [[Stored procedure]] ==
Line 24 ⟶ 31:
- [[User:Amcguinn|Amcguinn]] 10:18, 17 June 2006 (UTC)
 
* My [[Talk:Stored_procedure#Merge_from_.5B.5BUser_Defined_Function.5D.5D | response]]. ;) Then redirect. -- <span style="text-decoration: none;">[[User:Revragnarok|<fontspan colorstyle="color:#696969;">RevRagnarok</fontspan>]] <sup>[[User_talk:Revragnarok |Talk]] [[Special:Contributions/Revragnarok|Contrib]] [[User:Revragnarok/VandalismLog|Reverts]]</sup></span> 11:59, 17 June 2006 (UTC)
 
My suggestion: Merge the BASIC portion with the main BASIC article. Merge the database portion into Stored Procedure. Then delete. -- [[User:PabSungenis|PabSungenis]] 14:22, 17 June 2006 (UTC)
Line 37 ⟶ 44:
 
:I agree. I'm not a native English speaker, but it only makes sense to use the tightly coupled wording. --[[User:Stolze|Stolze]] 18:22, 17 August 2006 (UTC)
 
== SQL Server 2000 ==
 
Why is there a section specific to SQL Server 2000, when the concept of a user-defined function isn't specific to the SQL Server database manager? Every database manager I can think of -- Oracle, DB2, Postgres, MYSql, etc -- all have this concept. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/199.246.40.54|199.246.40.54]] ([[User talk:199.246.40.54|talk]]) 19:26, 15 October 2008 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
 
== Minor corrections ==
Line 46 ⟶ 57:
The fact and concepts of table functions should be added.
 
The statement that stored procedures return a "set of rows" is too restrictive. A stored procedure may return result sets (multiple!), but it doesn't have to.{{<small><span class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:141.35.14.130|141.35.14.130}}]] ([[User talk:141.35.14.130|talk]] • [[Special:Contributions/141.35.14.130|contribs]]) </span></small><!-- Template:Unsigned -->
:[[WP:BOLD|Be bold!]] This is not something I know a lot about, feel free to clean it up! &mdash; <span style="text-decoration: none;">[[User:Revragnarok|<fontspan colorstyle="color:#696969;">RevRagnarok</fontspan>]] <sup>[[User_talk:Revragnarok |Talk]] [[Special:Contributions/Revragnarok|Contrib]]</sup></span> 20:11, 28 July 2006 (UTC)
::As far as I can tell, the SQL standard further does not include user defined functions--so variable syntax doesn't seem relevant. You might want to add another example or a description to the article explaining this.
::The point the article is trying to make is that a function is invoked within a statement once per row within the statement. A stored procedure can't be evaluated once per row within a statement -- unless you wrap it in another function. (Note that the body of a triger, declared FOR EACH ROW or not, is semantically equivalent to a function.) If you can find a more accurate way to express that, let us know! -- [[User:Mikeblas|Mikeblas]] 20:24, 28 July 2006 (UTC)
 
:::Hey, I found it -- I forgot that ANSI SQL uses "CALL". The way Melton and Simon explain it (in {{ISBN |1-55860-456-1}}) is that ''procedures are involved exclusive by means of a specific SQL statment: the CALL statement; by contrast, SQL-invoked functions are treated as "values" in an expression of some sort and are invoked exclusively as a means of evaluating that value.'' You can't use CALL for per-row evaluation within DQL. -- [[User:Mikeblas|Mikeblas]] 20:32, 28 July 2006 (UTC)
 
::::Actually, SQL:2003 (the current version of the SQL standard) supports UDFs and stored procedures. It does that since SQL3. See subclause 11.50, "<SQL-invoked routine>". I understand your point regarding "once per row". But I think it is not correctly expressed. Besides, there are table functions (also in the standard) and those have a slightly different behavior when invoked. (I'll try to incorporate my thoughts later on.) -- [[User:stolze|stolze]] 08:30, 31 July 2006 (UTC)