create or replace procedure TEST_TABLE is
l_table_name varchar2(50);
query_stat varchar2(100);
l_zyq t_djjcxx.zyq%type;
l_jh varchar2(20);
l_djjcxx t_djjcxx%rowtype;
begin
l_jh :='7874';
select name into l_table_name from TESTA;
DBMS_OUTPUT.put_line(l_table_name);
query_stat := 'select * from '|| l_table_name||' where jh=:l_jh';
EXECUTE IMMEDIATE query_stat into l_djjcxx using l_jh;
DBMS_OUTPUT.put_line(l_djjcxx.zyq);
end TEST_TABLE;
query_stat裡面如果寫成 select zyq into l_zyq from '|| l_table_name||' where jh=:l_jh' 會報錯。標紅的都是要注意的地方