简体   繁体   English

将Oracle查询转换为MySQL查询。 all_indexes

[英]Converting Oracle query to MySQL query. all_indexes

I'm trying to convert Oracle query to MySQL query. 我正在尝试将Oracle查询转换为MySQL查询。

My Oracle query has this: 我的Oracle查询具有以下内容:

CREATE OR REPLACE PROCEDURE myProc() AS
    iname all_indexes.index_name%TYPE;
    oname all_indexes.owner%TYPE;
BEGIN
    // Do something
END;

How can I port this to mySQL, since mySQL doesn't have all_indexes public environment variable? 由于mySQL没有all_indexes公共环境变量,如何将其移植到mySQL?

Just use a varchar datatype 只需使用varchar数据类型

CREATE OR REPLACE PROCEDURE myProc()
BEGIN
  DECLARE iname varchar(50);
  DECLARE oname varchar(50);

    // Do something
END;

You can query an information_schema.statistics to obtain names od indexes 您可以查询information_schema.statistics以获得索引的名称

Select * 
From information_schema.statistics

Demo: http://sqlfiddle.com/#!9/88321/1 演示: http : //sqlfiddle.com/#!9/88321/1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM