Most voted "stored-procedures" questions
Stored Procedure is a set of SQL commands that stores repetitive tasks and accepts input parameters for the task to be performed according to individual needs. This tag should be used when the problem/doubt relates to the construction, performance and/or call stored procedures.
Learn more…169 questions
Sort by count of
-
0
votes1
answer62
viewsStored Procedures parameters
I have a question and I wanted to ask for your help. Next: I have a proc and I want when I don’t pass a parameter it returns to me null and when this happens bring the date of the day -1 and time…
-
0
votes1
answer148
viewsWhat is the Difference between Select and Run in a Procedure?
There is some difference between making a Select to call the Procedure and giving a Execute in the Procedure, for example, in select a Procedure is in Read-Only mode and in execute no?
-
0
votes0
answers30
viewsProblem with stored Procedure
I am trying to create a stored precedent that checks whether the table is empty or not, if it is empty returns -1, if it is not empty return the most recent element of the table. I’m trying this way…
-
0
votes0
answers153
viewsHow to create a temporary table within a stored procedure
greetings! My question is the following: I would like to know how to create a temporary table within a procedure, in which the values of my temporary table will be taken from a permanent table in my…
-
0
votes1
answer37
viewsHow to make a Bulk update with two primary keys in the stored mysql database?
I need to perform an update several times as follows: UPDATE my_table set column1='value1', column2='value2' where primary_key1=1 and primary_key2=2; UPDATE my_table set column1='value3',…
-
0
votes0
answers13
viewsI want to search dates in Mysql
I need to search details of a table creating a precedent and using month and year as variables, but I do not know how I could do it, the column dataPedido is defined as Datetimethought about…
-
0
votes1
answer73
viewsHow do I pass a list of parameters to a precedent?
I want to pass N parameters of N types to a dynamic process. How can I do it? Example: struct = (Here the structure will be mounted with several parameters) struct.id = 123 struct.name='Marisa'…
-
0
votes1
answer19
viewsCreate a precedent that when you enter a date, it returns the day of the week corresponding to the date you entered. MYSQL
People with the following problem, I am treating dates in the format "YYYY-MM-DD", someone has an idea of a possible solution ? I am using SELECT WEEKDAY ('1999-08-06') AS day_day_week; how can I…
-
0
votes0
answers47
viewsEncrypt within the Database
Hello! I’m making a process for entering user data and would like to know how to encrypt the password field within the process. My table: create procedure cadUsuario( @nome varchar(100), @email…
-
0
votes1
answer544
viewsHow to optimize a select within an update?
I created a stored-Procedure which updates the Drive table balances. At first I tried to use From Movimentacao within the update of the drive, only that returned error. I fixed this problem by…
-
0
votes0
answers781
viewsSQLSTATE[HY000]: General error: 2053 when do I call a Stored Procedure?
I’m using Laravel 4.2 and I’m calling one Stored Procedure of a database on the server. Locally everything works fine, but on the server, using the same BD, gives error. The call is as follows:…
-
0
votes1
answer166
viewsSQL UPDATE SUM VALUE NOT NULL
dataTmp referencia nStock 2017-02-18 DC01234567 NULL 2017-02-18 DC01234567 NULL 2017-02-18 DC01234567 NULL 2017-02-19 DC01234567 0 2017-02-19 DC01234567 0 2017-02-19 DC01234567 0 2017-02-20…
-
0
votes1
answer707
viewsBulk insert into a table
I have two proc’s that my VB system already uses. One for Insert and one for Update. I need to use it now, directly in the database. The target table has a composite key, as follows. A field called…
-
0
votes2
answers267
viewsStore Procedure not working properly
Galera created a Storeprocedure called, Cancelarnota, that through the use of cursors, back the products to the stock, pass the status of the item to canceled. This working, however, is not setting…
-
0
votes2
answers61
viewsMake a SQL language design that returns the number of clients who have no business done
I can not solve this issue, I want it to show number of customers without repeating primary key, no realized deals and show a warning if customers have done business. There was this mistake here.…
-
0
votes1
answer3833
viewsConsuming webservice by SQL Server?
I am using sql server 2016 to consume webservice by Procedure store. I have a JSON webservice returning the following:…
-
0
votes2
answers7693
viewsForeach in SQL to put a value in a variable
My problem is that I have a subquery that works perfectly, but for that I have to insert the id I want in the variables. In the variable @mediaKM_mes I select to the table tblAbastecimento by the…
-
0
votes1
answer31
viewsRename part of the parameter names of a precedent
I have some procedures where parameter names start with: "p_". It is possible to change in a unique way and via code all the names of all the procedures that start with this abbreviation by: "abc_"…
-
0
votes1
answer626
viewsHow to update a field from a Database table using a Stored Procedure?
I basically have a database table, which has a field called DESCRIÇÃO and the table is called Tabela123 I have 10 records in this table, and in the DESCRIPTION field I have the sentences: Hello, you…
-
0
votes1
answer468
viewsMore than one cursor in the Mysql database
Do I need to run more than one cursor on the same precedent? This is possible? begin DECLARE done INT DEFAULT 0; declare v_dia, v_rotina int; declare v_hora time; declare v_saldo, v_valor…
-
0
votes1
answer37
viewsProblem in converting a query into Vb.net for a varchar model
Until the function call of the parameters picks all the data correctly, the problem is time to pass to the Procedure via ADO.net, that for example, step the values, @OPE_NROOPERACAO = '34567,32135'…
-
0
votes0
answers276
viewsStored Procedure input parameters with more than one value
I need to do a stored project in the oracle where I have 5 input parameters and 1 output parameter which will be a cursor(recordset). The problem is that each input parameter can receive more than…
-
0
votes1
answer802
viewsSQL Error (1093): You can’t specify target table 'import2016' for update in FROM clause
I am running this PROCEDURE, and it returns this error! BEGIN SET @cont = 0; REPEAT SET @sqlstring = "UPDATE import2016 SET coluna4 = (SELECT coluna4 FROM import2016 AS a WHERE a.coluna2 ='' and…
-
0
votes0
answers127
viewsCompare values of two tables in a Procedure
I have an application that lists in a grid files that are registered in the table Scf_documentprocessocompra However, now I need to list only if this file also exists in the table SCF_ARQUIVO_UPLOAD…
-
0
votes1
answer112
viewsMissing IF in Procedure
I did the following study, but in the END// appears 'missing if', someone knows why? William helped me with this problem, but every time I try to register, the trial only goes to the last else. I…
-
0
votes0
answers85
viewsProblems with Stored Procedures on Laravel 5.6?
I’m making a select in a procedure, but I can’t page because the result returns array: DB::select('EXEC PR_MONITORAMENTO @FUNCAO="S2", @ID_CD_INTERNACAO='.$ID_INTERNACAO.',…
-
0
votes0
answers60
viewsCall PROC MVC to display the list of users who cannot register
Trying to call the PROC sp_UsuariosVariasTentativasCadastro_Result, that brings a list according to the form data. But nothing is happening. Someone can help me ? NOTE: I created all these "layers"…
-
0
votes1
answer232
viewsReturn a Result set from a Mysql storeProcedure
Good afternoon. I have the following storedprocedure in Mysql..: DELIMITER $$ CREATE DEFINER=`ricardo`@`%` PROCEDURE `teste2`() BEGIN Select * from Tabela; END As I call this storedprocedure by…
-
0
votes1
answer319
viewsProblems for invoking/inserting data with Procedure
I created this project in Oracle, but I’m not able to insert data with the EXEC. Way I’m declaring the EXEC: EXECUTE SP_PRODUTO(8,'teste' 1); erro APRESENTADO: ORA-06550: linha 1, coluna 126:…
-
0
votes1
answer29
viewsTanning system with Stored Procedure
I’m trying to make a stored Precedent for a simple likes system, my table is organized like this: Likes id INT(11) - Auto Increment post INT(11) - foreign key (id - post) user INT(11) - foreign key…
-
0
votes1
answer538
viewsHow can I make a trial to update the balance in postgres?
Mine has been giving an error that I can not understand talking q is wrong in $, but when I used another example internet trial almost in the same way as mine worked, then the mistake is being on…
-
0
votes2
answers537
viewsProcedure of Insert in three tables
Good morning everyone I am trying to change a precedent I created to insert a new book in three tables the table has autoencrement in the id_book column, and tables B and C are not null, I am using…
-
0
votes2
answers697
viewsProblem renaming column in Sql Server table
I needed to rename a column from a table in Sql Server and used the stored SP_RENAME system processor. I used it as follows: USE [meu_db] GO EXEC sp_rename '[dbo].[minhaTabela].[minhaColunaAntiga]',…
-
0
votes1
answer625
viewsError converting varchar data type to float
I have a stored precedent to change a field of tables of varied name: CREATE PROCEDURE usp_alterarCrachaCadAce --PARÂMETROS @NomeTabela VARCHAR(20), @CrachaDestino FLOAT, @CrachaOrigem FLOAT AS…
-
0
votes1
answer505
viewsCheck if date is valid in Mysql database
Good afternoon programmers, I have a problem in the trial where I need to print all the dates of the month, I created a loop until the day 31, but there is month that is less days that gives error,…
-
0
votes2
answers143
viewsStored Procedure Doesn’t Deliver Results You Should
-I am very new in SQL, Spring & Java, I am trying to set the results of a list that returns in a Query I created -this query returns a list with the referenced object -the parameters are all…
-
0
votes1
answer146
viewsSELECT GROUP BY AND ORDER BY Sql
I have two tables Tb_process and Tb_costs united by key Numeroprocesso. I need lists of their union information sorted by Urgency and Date status. When urgent, they should be listed at the top of…
-
0
votes1
answer354
viewsDoubt when mounting a Where in a Procedure
On the site, I have a filter that already works. This filter will be maintained, but the table will be another, from another bank including. The rule for the filter is, if the parameter passed is:…
-
0
votes1
answer27
viewsProcedure in oracle
I can not very well create procedures with the output values, how to receive a value, and return it after the call, someone could help me with an exercise that I am doubtful Create a procedure that…
-
0
votes1
answer111
viewsProblem in creating a stored Procedure
I am trying to create a stored database that serves to check if my table is empty, and if it is not returning the value with the higher Id. But I’m not getting it. CREATE PROCEDURE spConsulta…
-
0
votes1
answer113
viewsSql Server Procedure
I have the following description PROCEDURE [dbo].[spAVL_Ignition] @DeviceIMEI VARCHAR(50), @TimeStamp SMALLDATETIME, @Value INT, @Tag VARCHAR(50) AS BEGIN IF NOT EXISTS (SELECT TOP (1) TimeStamp…
-
0
votes0
answers30
viewsIf informed parameter does not bring any data in the Stored Procedure (Oracle)
I’m having a problem in the Stored Procedure below, where it only brings the data if the parameter of EmpresaId come blank. If I inform the parameter EmpresaId, does not bring any data. I am a…
-
0
votes0
answers20
viewsDoubts about Stored Procedures
Good Afternoon, I have a Stored Procedure, the purpose of it is to insert the data from a Mirror table and not bring repeated Id’s, as it has a robot that does data extraction and inserts in the…
-
0
votes0
answers161
viewsIs it possible to execute 2(delete,Insert) commands in a Stored Procedure - MYSQL?
Falling into the condition of if I need to execute these two commands: if(ultima_refeicao!=refeicao) then SELECT refeicao_alimentos.calorias into calorias from refeicao_alimentos where…
-
0
votes0
answers152
viewsValidate record that has comma in the Oracle PL SQL field
I’m creating a procedure in PL SQL and I have an "unregulated" field that may have more than one comma-separated record. That one procedurecarries out the cancellation of sending extracts of a…
-
0
votes2
answers160
viewsStored Procedures in Mysql runs but cannot access to view or edit
When I had an account on a shared server at Hostgator(those very basic plans) I created some Stored Procedures in Mysql via my Navicat, months later I had to format my machine and migrated my plan…
-
0
votes1
answer421
viewsLoop inside SQL loop
I have the following code in a procedure in the mysql: BEGIN declare v_unidade varchar(10); declare v_conta varchar(256); declare v_cnt INT; DECLARE done INT DEFAULT 0; declare c_unidade cursor for…
-
0
votes1
answer38
viewsGuys, I have a question with Mysql about Procedures. Is it possible to save their return in a BD variable?
I have a repetitive process in BD that is validate the user for each request, so I decided to create a process for this and call inside the others when necessary. However I have the need to save the…
-
0
votes1
answer449
viewsHow to run an INSERT Procedure with the GETDATE field? SQL Server
Next, I created a precedent that has two parameters Dt_inclusion and Dt_alteration, I would like to know how to insert(or if it is possible to use) a getdate to pick up the current date, instead of…
-
0
votes1
answer816
viewsCreate SQL SERVER database
Good afternoon to all! :) I’m new to programming and I’m having some difficulties I am trying to create a precedent to update the Cli_totalcompras column, with the total amount already spent by the…