Oracle Dynamic Query Execute IMMEDIATE SELECT INTO Use method

Source: Internet
Author: User

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 inside if write select Zyq into L_zyq from ' | | l_table_name| | ' Where Jh=:l_jh ' will complain. The red is the place to pay attention to

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.