I need to create a MYSQL procedure where the procedure accepts several parameters and works with them. However, in the case where it is not present, the parameter variables pick some 'default' values and continue. Similar to how the pseudo-function-overload is handled in PHP.
This code is what I could come up with.
CREATE PROCEDURE PROC_INS_CONTENT_TEST(IN DATA_VAL LONGTEXT)
BEGIN
IF (DATA_VAL IS NULL) THEN SET DATA_VAL='DEFAULT'; END IF;
INSERT INTO CONTENT_TEST (DATA) VALUES (DATA_VAL);
END
And this code does not work the way I want it to behave. Is there a way to assign the default value to the variable right when the parameter is declared?