1
I am creating a Trial, which receives a date string '2015-09-11', checks if it is indeed a Monday, if not, it takes this date and play for Monday of the week itself. But my concept with sql is very weak, my basis is this way.
DROP PROCEDURE IF EXISTS SP_DATA_PARA_SEGUNDA;
DELIMITER //
CREATE PROCEDURE SP_DATA_PARA_SEGUNDA (IN SPA_DATA_CONVERTER DATE,INOUT SPA_DATA_CONVERTIDA INT)
BEGIN
SELECT DATE_FORMAT(SPA_DATA_CONVERTER,'%w');
END//
DELIMITER ;
Now it works, but now I want to return this dateformat na in my argument SPA_DATA_CONVERTIDA, as I do?
I see some functions, but I don’t know if there are restrictions, I can use both mysql and sql functions within the procedures?
– Michel Henriq
WOULD THAT be?
DROP PROCEDURE IF EXISTS SP_DATA_PARA_SEGUNDA;
DELIMITER //
CREATE PROCEDURE SP_DATA_PARA_SEGUNDA (IN SPA_DATA_CONVERTER DATE, OUT SPA_NOME_DIA VARCHAR(20)
 BEGIN 
 SPA_NOME_DIA = SELECT DATENAME(weekday,SPA_DATA_CONVERTER);
 END//
DELIMITER ;

– Michel Henriq
The one I made would work on Sqlserver.. For mysql, From a Look at: [http://stackoverflow.com/questions/23235023/1305-function-datename-does-not-exist]
– PachecoDt
I hope it helps you! (http://stackoverflow.com/questions/17975359/sql-group-by-datename)(http://www.suhailkaleem.com/mssql-datename-alternative-for-mysql/)
– PachecoDt
I changed my question, now it’s working, but how do I return qd I give the call?
– Michel Henriq
I changed the Answer.. With some Links. You probably need to use an OUT variable. or save to some table..
– PachecoDt
I created a variable out, but how do I pass the value of the select into this var? I tried so, but it wasn’t..
SET SPA_DATA_CONVERTIDA = SELECT DATE_FORMAT(SPA_DATA_CONVERTER,'%w') as SPA_DATA_CONVERTIDA;
– Michel Henriq
Let’s go continue this discussion in chat.
– PachecoDt