0
Good afternoon guys I’m not managing to create this trial and I don’t understand why, if you can help me.
DELIMITER $$
CREATE PROCEDURE SP_INSERT_TB_ASS_TUR_AL(IN sp_id_disciplina INT, IN sp_id_aluno_prof INT, IN sp_id_turma INT, IN sp_id_aluno INT)
BEGIN
INSERT INTO tb_assoc_turma_aluno (id_disciplina, id_aluno_prof, id_turma, id_aluno) VALUES (sp_id_disciplina, sp_id_aluno_prof, sp_id_turma, sp_id_aluno)
END $$
DELIMITER ;
Table creation script generated by mysql
-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 03-Jun-2016 às 19:52
-- Versão do servidor: 10.1.13-MariaDB
-- PHP Version: 5.6.21
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `school_sys`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `tb_assoc_turma_aluno`
--
CREATE TABLE `tb_assoc_turma_aluno` (
`id_disciplina` int(11) NOT NULL,
`id_aluno_prof` int(11) NOT NULL,
`id_turma` int(11) NOT NULL,
`id_aluno` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `tb_assoc_turma_aluno`
--
INSERT INTO `tb_assoc_turma_aluno` (`id_disciplina`, `id_aluno_prof`, `id_turma`, `id_aluno`) VALUES
(5, 17, 5, 12),
(5, 17, 5, 15),
(6, 16, 2, 1),
(6, 16, 2, 2),
(6, 16, 2, 3),
(6, 16, 2, 4);
--
-- Indexes for dumped tables
--
--
-- Indexes for table `tb_assoc_turma_aluno`
--
ALTER TABLE `tb_assoc_turma_aluno`
ADD PRIMARY KEY (`id_disciplina`,`id_aluno_prof`,`id_turma`,`id_aluno`),
ADD KEY `id_disciplina` (`id_disciplina`),
ADD KEY `id_aluno_prof` (`id_aluno_prof`),
ADD KEY `id_turma` (`id_turma`),
ADD KEY `id_aluno` (`id_aluno`);
--
-- Constraints for dumped tables
--
--
-- Limitadores para a tabela `tb_assoc_turma_aluno`
--
ALTER TABLE `tb_assoc_turma_aluno`
ADD CONSTRAINT `fk_assoc_turma_aluno_aluno` FOREIGN KEY (`id_aluno`) REFERENCES `tb_form_aluno` (`id_aluno`),
ADD CONSTRAINT `fk_assoc_turma_aluno_disciplina` FOREIGN KEY (`id_disciplina`) REFERENCES `tb_form_disciplina` (`id_disciplina`),
ADD CONSTRAINT `fk_assoc_turma_aluno_professor` FOREIGN KEY (`id_aluno_prof`) REFERENCES `tb_form_aluno` (`id_aluno`),
ADD CONSTRAINT `fk_assoc_turma_aluno_turma` FOREIGN KEY (`id_turma`) REFERENCES `tb_form_turma` (`id_turma`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Gives END error...
What error? Can you edit your question and put the message please?
– KhaosDoctor