Use stored-functions for questions related to database specific user-defined functions which can perform queries, accept parameters, and return a computed value.
SQL Server 2005 has great sys.XXX views on the system catalog which I use frequently.
What stumbles me is this: why is there a sys.procedures view to see info about your stored procedures, but there is no sys.functions view to see the same for your…
What is the MySQL command to view the definition of a stored procedure or function, similar to sp_helptext in Microsoft SQL Server?
I know that SHOW PROCEDURE STATUS will display the list of the procedures available. I need to see a single…
What is the main difference between functions and procedures in Oracle?
Why must I use procedures if I can do everything with functions?
If I cannot call procedure in sql statement, ok, I'll write a function to do the same work.
Procedures don't…
Version: SQLServer 8
I would like to view the contents of a stored function in sqlserver, i.e. what exactly the function is doing.
None of the options listed here work for me. There doesn't appear to be any database/table called sys.objects. I was…
Our database has a function to generate an order number. It reads a value from a Settings table, increments it, then returns the new value. For example:
CREATE FUNCTION NextOrderNumber() RETURNS INTEGER UNSIGNED NOT DETERMINISTIC
BEGIN
DECLARE…
I've been looking for the last hour or so and haven't found a conclusive answer to this seemingly simple problem:
How do you call a stored MYSQL function/procedure and use its output in further SELECT queries?
Although this obviously doesn't work,…
I'm slowly moving from MSSQL to PostgreSQL.
In MSSQL I could call editing of already saved procedure or function, and the administration shell (SQL Server Management Studio) showed me procedure's text, so I did not have to store its source code…
When refactoring PostgreSql functions (and more specific: while searching for 'unused' functions) it would be handy to have a function available to search for a specific string within the function definitions.
Does anyone know if this is the best…
I want to write a stored proc in SQL (MySQL) to compute the average of second and third quartiles.
In other words I have records for measurements for how long it takes for an URL to load. Records are (id,url,time) and they are many measurements for…
OK so I have read a whole bunch of articles suggesting table-value functions and cross apply give better performance than a scalar udf. I wanted to write my function in both ways and then test to see which one is better - but I cannot figure out…
I am trying to create a mysql stored procedure . I have successfully created a procedure using the following code :
delimiter $$
CREATE PROCEDURE `myprocedure` (IN
var1 DATE)
BEGIN
<---code-->
END
And
SHOW CREATE PROCEDURE myprocedure
shows…
What is the mechanism to force the MySQL to throw an error within the stored procedure?
I have a procedure which call s another function:
PREPARE my_cmd FROM @jobcommand;
EXECUTE my_cmd;
DEALLOCATE PREPARE my_cmd;
the job command…
I'm quite new to subject of writting stored function for mySQL database, hence i'm not sure if what i'm trying to do here is possible at all.
I need a function that will return a column from random row from a table. I don't want to use ORDER BY…
Everywhere I look it seems MySQL stored procedures can do transactions. Yet when I declare my stored function
create function test( a int )
returns int
MODIFIES SQL DATA
BEGIN
START TRANSACTION ;
update t set col='some value' where id=a ;
…