views:

35

answers:

1

MS SQL Server has a TABLE data type which can be used in stored procedures,

Does anybody know if MySQL has an equivalent data type?

I've had a look over the docs but can't seem to find anything, so I presume it doesn't exist, but perhaps somebody has created a workaround

+2  A: 

Neil,

MySQL has no such data type and I believe it is good that it doesn't. To achieve similar results, use CREATE TEMPORARY TABLE construction. Name clashes are avoided by having per connection temporary tables:

A TEMPORARY table is visible only to the current connection, and is dropped automatically when the connection is closed. This means that two different connections can use the same temporary table name without conflicting with each other or with an existing non-TEMPORARY table of the same name. (The existing table is hidden until the temporary table is dropped.)

Hope it helps.

Konrads
Thanks. I'm familiar with temporary tables, and did consider them in this case. I was just checking if there was native type that may have a lower overhead. I will see if they work with what i'm attempting here.
Neil Aitken