Jump to content
Fórum Script Brasil
  • 0

tabela


failace
 Share

Question

1 answer to this question

Recommended Posts

  • 0

Precisa ser procedure ou pode ser função?

DELIMITER $$;

DROP PROCEDURE IF EXISTS `subancodedados`.`nomedaprocedure`$$

CREATE  PROCEDURE `nomedaprocedure`(Sua lista de parâmetros, se houver)
BEGIN
   DECLARE msg VARCHAR(1000) DEFAULT "sem mensagem";
/* faça seu alculo aqui
retorne para a variavel msg*/
   SELECT msg AS msg;
END$$

DELIMITER ;$$

Função

DELIMITER $$;

DROP FUNCTION IF EXISTS `seubancodedados`.`Nomedafuncao`$$

CREATE FUNCTION `Nomedafuncao`(lista de parametros, se houver)) RETURNS tipo e tamanho da variavel de retorno CHARSET latin1
BEGIN
   DECLARE ret VARCHAR(15);
   /*Seu codigo entra aqui e retorna para a variavel ret*/
   RETURN ret;
END$$

DELIMITER ;$$

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      149.9k
    • Total Posts
      646.8k
×
×
  • Create New...