在Oracle中解释FOR [英] Explain FOR in oracle

查看:87
本文介绍了在Oracle中解释FOR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试.我将所有测试排成一行,所以我的行看起来像这样;

I am making a test. I have all tests in rows, so my rows looks like this;

ID  |  TEST
----------------------------------
1   |  'select sysdate from dual'
2   |  'select sysdatesss from dual'

现在我逐行阅读它,我需要使用EXPLAIN PLAN FOR

Now I read it row by row and I need to test it with EXPLAIN PLAN FOR

因此第一行的

EXPLAIN PLAN FOR select sysdate from dual

但是我在转换TEST字段时遇到问题.现在我用;

but I have problem converting the TEST field. Right now I use;

EXPLAIN PLAN FOR testing.TEST

但它不起作用.

有什么想法吗?

推荐答案

SQL语句是字符串,但是您必须使用动态SQL来转换存储为字符串的SQL语句.

A SQL statement is a string, but you have to use dynamic SQL to convert a SQL statement that is stored as a string.

FOR i IN (SELECT t.test
            FROM TESTING t) LOOP
   EXECUTE IMMEDIATE 'EXPLAIN PLAN FOR '|| i.test ||'';
END LOOP;

参考:

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆