nicomp
nicomp

Reputation: 4647

Why does creating this View cause Error 1350 when the SQL runs properly in an SQL tab?

Using MySQLWorkbench, when I try to create this view:

SELECT myAttribute01, myAttribute02, myAttribute03 INTO @myVar01 , @myVar02, @myVar03 FROM mytable01 WHERE myAttribute01 = 1;

I get a 1350 error. However, I can execute the above SQL from an SQL tab with no problems. I only get the error when I try to make it into a view. See attached screen snip. Error 1350

Upvotes: 0

Views: 196

Answers (1)

Daniel E.
Daniel E.

Reputation: 2480

As written in the error, you can't use a "SELECT ... INTO" statement to create a view.

Futhermore as written in the guide

A view definition is subject to the following restrictions:

The SELECT statement cannot refer to system variables or user-defined variables.

Upvotes: 2

Related Questions