Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a MySQL version of Oracle's %TYPE

In Oracle, if I needed to declare something with the same type as another column, I can simply use %type:

Create table foo(
   copiedType OTHER_TABLE.COLUMN_NAME%TYPE
   /* yada yada yada... */

Is there an equivalent operator in MySQL?

like image 715
cwallenpoole Avatar asked Jan 12 '12 18:01

cwallenpoole


1 Answers

Well, the short answer, as it turns out is "no", and while it can be faked if you're willing to create a stored function (or use another language) and create your table by your own custom baked parsing engine, it simply isn't worth it. C'est sera...

like image 127
cwallenpoole Avatar answered Oct 21 '22 20:10

cwallenpoole