7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQLのテーブルをOracleに移すときに調査に使ったSQLだお

7
Last updated at Posted at 2014-01-24

テーブル名が長すぎるテーブルを探すSQL

SELECT TABLE_NAME as Name, CHAR_LENGTH(TABLE_NAME) from information_schema.TABLES
 WHERE TABLE_SCHEMA = DATABASE() ORDER BY 2;

カラム名に予約語を使ってないか調べるSQL

SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() 
AND COLUMN_NAME IN (
"access",
"add",
"all",
"alter",
"and",
"any",
"as",
"asc",
"audit",
"between",
"by",
"char",
"check",
"cluster",
"column",
"comment",
"compress",
"connect",
"create",
"current",
"date",
"decimal",
"default",
"delete",
"desc",
"distinct",
"drop",
"else",
"exclusive",
"exists",
"file",
"float",
"for",
"from",
"grant",
"group",
"having",
"identified",
"immediate",
"in",
"increment",
"index",
"initial",
"insert",
"integer",
"intersect",
"into",
"is",
"level",
"like",
"lock",
"long",
"maxextents",
"minus",
"mlslabel",
"mode",
"modify",
"noaudit",
"nocompress",
"not",
"nowait",
"null",
"number",
"of",
"offline",
"on",
"online",
"option",
"or",
"order",
"pctfree",
"prior",
"privileges",
"public",
"raw",
"rename",
"resource",
"revoke",
"row",
"rowid",
"rownum",
"rows",
"select",
"session",
"set",
"share",
"size",
"smallint",
"start",
"successful",
"synonym",
"sysdate",
"table",
"then",
"to",
"trigger",
"uid",
"union",
"unique",
"update",
"user",
"validate",
"values",
"varchar",
"varchar2",
"view",
"whenever",
"where",
"with"
);

◯◯TEXT型を使ってないか調べるSQL

SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() and DATA_TYPE like "%TEXT";

色々ハードルがありますねー

7
7
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?