previous_developer
previous_developer

Reputation: 10988

Is there a way to pass a row as argument to a MySQL function?

Roughly what I am trying to achieve:

CREATE FUNCTION(row Table) RETURNS tinyint(1)
BEGIN
    RETURN (row.col1 > 2 OR row.col2 IS NULL)
END;

Upvotes: 3

Views: 1244

Answers (1)

Richard
Richard

Reputation: 1055

In MySQL 5.7, there will be a dynamic column, that could be added to the table itself. It's being used together with the json parsing functions added in MySQL 5.7 as well.

Source: https://dev.mysql.com/doc/refman/5.7/en/create-table.html#create-table-generated-columns

Upvotes: 1

Related Questions