Questions tagged [procedure]
A procedure is a subroutine that does not return a value. Do not use this tag for stored procedures. Use 'stored-procedures' tag instead.
3,023
questions
261
votes
18
answers
392k
views
What is the difference between a "function" and a "procedure"?
Generally speaking, we all hear about the functions or procedures in programming languages. However, I just found out that I use these terms almost interchangeably (which is probably very wrong).
So, ...
104
votes
5
answers
144k
views
Export MySQL database with triggers and procedures?
How to create a MySQL database dump (.sql file) with all its triggers and procedures?
97
votes
11
answers
189k
views
SQL Server - copy stored procedures from one db to another
I am new to SQL, and what I needed to do was to combine 2 .mdf databases into one. I did that using SQL Server 2008 Manager - Tasks > Import/Export tables.The tables and views were copied successfully,...
89
votes
5
answers
55k
views
How to make a Clojure function take a variable number of parameters?
I'm learning Clojure and I'm trying to define a function that take a variable number of parameters (a variadic function) and sum them up (yep, just like the + procedure). However, I don´t know how to ...
63
votes
1
answer
253k
views
How to call a mysql stored procedure, with arguments, from command line?
How can I call a stored procedure from command line?
I have a procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `insertEvent`(IN `dateTimeIN` DATETIME)
NO SQL
BEGIN
SET @eventIDOut = ...
47
votes
3
answers
170k
views
Creating a procedure in mySql with parameters
I am trying to make a stored procedure using mySQL. This procedure will validate a username and a password. I'm currently running mySQL 5.0.32 so it should be possible to create procedures.
Heres ...
35
votes
1
answer
103k
views
How to program a MySQL trigger to insert row into another table?
I'm looking to create a MySQL trigger on a table. Essentially, I'm creating an activity stream and need to log actions by users. When a user makes a comment, I want a database trigger on that table to ...
29
votes
6
answers
25k
views
How To Get the Name of the Current Procedure/Function in Delphi (As a String)
Is it possible to obtain the name of the current procedure/function as a string, within a procedure/function? I suppose there would be some "macro" that is expanded at compile-time.
My scenario is ...
22
votes
3
answers
113k
views
ORA-00900: invalid SQL statement- when run a procedure in oracle 10g
I am using Oracle 10g database and trying to run a procedure using SQL commands.
create or replace procedure "exam" is
begin
DBMS_OUTPUT.PUT_LINE('Test');
end;
Then click on Run button. It shows: "...
21
votes
1
answer
66k
views
PL/SQL Inserting 1 row for each result in a select
I am writing a PL/SQL Procedure that performs a select based on input variables and then inserts a row for each result in the select. I am having trouble debugging what is wrong with my query due my ...
20
votes
4
answers
85k
views
the functions (procedures) in MIPS
I'm new in MIPS language and I don't understand how the functions (procedures) in the MIPS assembly language work. Here are but I will specify my problem :
What does:
jal
jr
$ra
mean in mips ...
20
votes
3
answers
42k
views
Get the name of the calling procedure or function in Oracle PL/SQL
Does anyone know whether it's possible for a PL/SQL procedure (an error-logging one in this case) to get the name of the function/procedure which called it?
Obviously I could pass the name in as a ...
18
votes
1
answer
22k
views
Rename a mysql procedure
Does anyone know what is the syntax for renaming a mysql stored procedure/function? Or is this even supported in MySQL? I've been googling this for several minutes...
16
votes
1
answer
11k
views
How do I remove a Tcl procedure?
How do I remove a tcl procedure?
One can
unset a variable,
override an alias with interp alias {} myproc {} otherproc,
override a proc with one defined inside another namespace with namespace ...
13
votes
3
answers
19k
views
Show the user-defined functions and procedures in the database in PostgreSQL
Trying to find out the stored functions and procedures on PostgreSQL. I found some of the solutions where "join" has been used. I am looking for an optimal solution/command to it.
13
votes
1
answer
24k
views
How to Pass Functions as Parameters in Procedures in Delphi?
Is it possible to pass an object function as a parameter in a procedure rather than passing the whole object?
I have a record definition with a function defined as a public class parameter such as:
...
12
votes
6
answers
223k
views
set serveroutput on in oracle procedure
I've created a simple procedure. In this procedure i want to output some data. However where ever i put
set serveroutput on
it says
Error(26,5): PLS-00103: Encountered the symbol "SERVEROUTPUT"...
12
votes
2
answers
18k
views
Delphi callbacks?
I would like to know if it's possible to implement something like this:
procedure waitandcall(time,@MyProcedureOrFunction)
which execute the function or procedure I've created ?
I'm not sure if ...
12
votes
3
answers
1k
views
Why FreeAndNil implementation doing Nil before Free?
If you will look at the code of FreeAndNil procedure you will see:
procedure FreeAndNil(var Obj);
var
Temp: TObject;
begin
Temp := TObject(Obj);
Pointer(Obj) := nil;
Temp.Free;
end;
What is ...
12
votes
4
answers
54k
views
measure time of an sql statement in a procedure in plsql
I must write a procedure which save the execute time of any sql-statement in a table.
The procedure is calling by exec measuresqltime('sql statement as string');
My idea is like this:
--...
12
votes
3
answers
49k
views
Can an SQL procedure return a table?
Can an Oracle SQL procedure return a table? I'm currently using a dbms_output to print out the outputs of two cursors which are in a loop, although this would look nicer if it was returning two ...
12
votes
2
answers
36k
views
Prolog: Making a procedure to print Hello World
I want to load this simple something into my Editor:
Write:-repeat,write("hi"),nl,fail.
So that it prints "hi".
What should I do?
I'm currently trying to do File->New
and Saving a file named ...
11
votes
2
answers
62k
views
Can I execute a procedure with default null parameters?
I recently created a procedure that is defined like this:
create or replace
PACKAGE
pkg_dml_legal_transactions
AS
PROCEDURE spm_update_court_cost(
p_court_state IN legal_court_cost.state%...
11
votes
2
answers
17k
views
Mysql Create Insert Procedure Statement incomplete
I'm trying to wirte a little log procedure for my database. I create a procedure with this statment:
create procedure prc_wirte_log (
in p_schema varchar(255),
in p_item varchar(255),
in ...
11
votes
5
answers
30k
views
Show procedure/function code in MySql
Is there any options to view stored procedure/function code in MySql same as like "sp_helptext procedurename" in sql?
11
votes
2
answers
44k
views
Problem with execute procedure in PL/SQL Developer
I this is my first attempt to create procedure and execute it.
First I create simple table. DB scheme of table is here:
Table name: Ziaci
Columns:
ZiakId - primary key, number
Surname, varchar2
...
10
votes
3
answers
9k
views
What is a Re-entrant procedure?
What is a re entrant procedure and can you give an example scenario of when it is used?
Edit: Also, can multiple processes access a re entrant procedure in parallel?
Please provide a different way ...
10
votes
2
answers
17k
views
How to run procedure from another unit?
Well this kind of n00b question but I still can't figure it out. I have unit main with procedure Discard() in it. Now I have another unit engine and I want to run from it procedure Discard() of unit ...
10
votes
1
answer
8k
views
PL/pgSQL: PERFORM vs CALL
While fiddling with the performance impact of calling a procedure from another procedure vs. repeating the code in Postgres 13, I found that you can invoke other procedures by using either CALL or ...
10
votes
1
answer
7k
views
Which is the diffeence between an INTERFACE block and a MODULE procedure in fortran?
I'm a bit confused about the use of an interface block inside a module and the use of the CONTAINS statement to create an "explicit interface" for a procedure inside a module.
I usually write a ...
10
votes
1
answer
11k
views
Reasons why PL/SQL Developer's debugger won't enter a procedure?
I am trying to debug a procedure using PL/SQL developer's built-in debugger.
After stepping over the BEGIN, when the debugger is over the actual procedure call, the "step-into" button will just ...
10
votes
9
answers
7k
views
How to get a table of dates between x and y in sql server 2005
I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no ...
9
votes
2
answers
41k
views
Error declaring integer variable inside MySQL stored function
I'm getting an error when trying to declare a new stored function in MySQL (Server version: 5.5.13)
Basically, I have a large table which classifies strings depending on how they start. My function ...
9
votes
2
answers
17k
views
does mongodb have the properties such as trigger and procedure in a relational database?
as the title suggests, include out the map-reduce framework
if i want to trigger an event to run a consistency check or security operations before a record is inserted, how can i do that with MongoDB?
9
votes
4
answers
76k
views
PL/SQL: how do I prompt user input in a procedure?
This is a question about a small part of a large project I'm doing. I tried the following but I just get the two errors below it:
SET SERVEROUTPUT ON
CREATE OR REPLACE PROCEDURE HELLO AS
DECLARE
...
9
votes
2
answers
19k
views
Tricks on how to execute string inside a function in Sql Server
Procedure FunctionX, Line 345
Invalid use of a side-effecting operator 'EXECUTE STRING' within a
function.
I get the above error when I execute a dynamic statement inside a function in SQL ...
9
votes
3
answers
7k
views
How to find the location of TCL procedure?
How can be find the location of procedure (function) in TCL. Under location I mean the source file in which it is declared.
I'm trying to read foreign source-code and can not find the declaration of ...
8
votes
2
answers
10k
views
forward declaration of procedure in delphi
How can I make a forward declaration of a procedure in Delphi and make it's implementation in other place? I want to do something like this C's code but in Delphi:
void FooBar();
void FooBar()
{
...
8
votes
4
answers
33k
views
MySql procedure IF number is odd or even
My learning mysql and my question is to check what i'm doing wrong here:
I'm trying to make a sql procedure to check if the first number of a number user enters is odd or even but im getting syntax ...
8
votes
2
answers
19k
views
How to stop a running procedure in MySQL?
I called a procedure in MySQL, but it is in an endless loop now! How to stop a running procedure in MySQL? The following is my procedure code:
drop procedure if exists my_proc;
DELIMITER $$
CREATE ...
8
votes
1
answer
125k
views
Execute stored procedure with parameters
I have stored procedure and should get its result.
From debugging of Java part:
return getJdbcTemplate().call(newCallableStatementCreator(inParams), getDeclaredParameters());
I've discovered ...
8
votes
4
answers
14k
views
MYSQL, set two variables in stored proc with single select statement
So I'd like it to be something like, or have the effect of:
declare vFN varchar(20);
declare vLN varchar(20);
set vFN, vLN = (select fname, lname from sometable where id = 1);
Obviously, I could do ...
8
votes
2
answers
32k
views
I'm new to Prolog. Trying to run this code but gives - ERROR: Undefined procedure: teaches/2 (DWIM could not correct goal)
These are the facts I have written
instructor(ahmed,mohammed, cs101,01).
instructor(sara,salah,cs101,02).
instructor(maryam,faisal,cs101,03).
instructor(ali,hassan,cs311,01).
enrolled(201110202,...
8
votes
1
answer
486
views
How to fix procedure circular reference?
I'm new in the Delphi programming scene and i have trouble calling a procedure in a procedure in my console application.
My simple application is for a item inventory running through a telnet server ...
8
votes
2
answers
4k
views
Function and procedure behave differently with the same code in Mozart Oz?
I try printing out the Fibonacci sequence in Oz using 2 approach : function and procedure using Emac as editor.
Procedure goes here :
declare
fun {Fibo N}
case N of
1 then 1
[] 2 then ...
8
votes
1
answer
1k
views
MYSQL LAST_INSERT_ID not working as intended. How do I fix?
I wrote MySQL StoredProcedure to create and return new ID for each table value, however, it gets wrong value on last_insert_id() from MySQL WorkBench and Java application.
This procedure will be ...
8
votes
0
answers
5k
views
PHPMyAdmin EDIT and EXECUTE buttons disabled for Stored Procedures
I created a couple of stored procedures in a remote MySql database (web) a week ago... during the session where I created them I was able to edit them, export them, etc...
Now, a week later, I ...
7
votes
1
answer
30k
views
What is the difference between ESP and EIP registers
What is the difference between ESP and EIP registers using the following examples? Explain what the code is doing.
main PROC
0000 0020 call MySub
0000 0025 mov eax, ebx
.
.
...
7
votes
3
answers
1k
views
Removing the prologue of a function written in pure assembly
I am using Delphi 2010. Is it possible to tell Delphi to not generate a prologue for a function? I'm writing some pure assembly functions like this:
procedure SomeAssembly; stdcall;
begin
asm
...
7
votes
4
answers
20k
views
drop procedure if exists in DB Oracle
Can someone tell me how I can drop a PROCEDURE in Oracle, but just if it exists ?
DROP PROCEDURE IF EXISTS XYZ;
The above does not work.