Questions tagged as 'procedure'

0
answers

INSERT IF NOT SQL (PROCEDURE)

I need to create a SQL procedure that does what's down here! -- procura cadastro SELECT id_cadastro FROM c1datasource.tb_cadastro where cpf_cnpj = '12344'; -- se não achou, insere INSERT INTO 'c1datasource'.'tb_cadastro' ('nome', 'cep', 'cpf_...
asked by 01.02.2018 / 15:26
0
answers

How do I while with mysql to autogenerate scripts to populate the database

People, my problem is this, I have to populate a database based on an excel table, and for each entry in the variable quantity a new row should be added in the table, so I developed this logic where I am going to populate the data using =CONC...
asked by 30.01.2018 / 19:43
1
answer

How to run PROCEDURE and FUNCTION at the same time?

I have this plsql code and I must run at the same time: /*Testar se o codigo é valido*/ CREATE OR REPLACE FUNCTION TESTE1(cod number) RETURN BOOLEAN IS begin if(cod>0)then return true; end if; return false; end; /*varrer o b...
asked by 23.01.2018 / 17:08
1
answer

Error in procedure

I created this procedure to test if there is a field in a database, if it does not exist, the procedure would create. DELIMITER || CREATE PROCEDURE sp_verificarLinhas(IN colunas VARCHAR(50)) BEGIN IF NOT EXIST...
asked by 01.08.2017 / 21:00
0
answers

turn procedure into function

I'm trying to turn this procedure into function , so I can use it inside another procedure , but I can not evolve: CREATE PROCEDURE bancodados.sp_calculo(param_id_cnpj varchar(14)) BEGIN SELECT id_cnpj, AVG(v...
asked by 13.11.2016 / 13:41
0
answers

Multiply procedure

I need help solving a problem, Code: DELIMITER $$ create procedure sp_ptopedido( TPOMEDIOREPOS int, DEMANDA int, ESTOQUEMINIMO int), begin PONTOPEDIDOTOPEDIDO = ((TPOMEDIOREPOS / 30) * DEMANDA) + ESTOQUEMINIMO FROM produto; END $$ DEL...
asked by 23.10.2016 / 17:56
1
answer

Stored procedure loop

I put this procedure, it makes the query inside the cursor right, but when I give select in SPA_VALOR_ACOMODACAO , it returns 0, which was set before loop_duracao . It looks like it's not entering loop_duracao . What would it b...
asked by 14.09.2015 / 21:08
1
answer

Syntax error in MySQL procedure

I am trying to create a Procedure in MySQL and it is returning Syntax error. Here is my code for review: DELIMITER $$ CREATE PROCEDURE CalculaIdadeCP (IN cpcaminhaoid INT) BEGIN DECLARE DataEnsaio,DataMoldagem DATETIME; /*CORPO DO PROCEDIM...
asked by 08.07.2015 / 16:28
1
answer

Extract value, procedure

Initially I needed to create a procedure that read an xml file and put the data into an oracle table, create the table, the directory, I have the following structure: create or replace package body PACK_GUSTAVO1 as v_id INFO_XML.ID...
asked by 08.12.2014 / 00:34
1
answer

Procedure to increase return date

I have the following table: CREATE TABLE Emprestimo ( id int PRIMARY KEY, dataRetirada date DEFAULT current_date, dataPrevistaDevolucao date DEFAULT current_date + 7, dataDevolucao date, codigoUsuario int, codigoExemplar int, FOREIGN K...
asked by 23.04.2018 / 05:41