• <i id='2FZhW'><tr id='2FZhW'><dt id='2FZhW'><q id='2FZhW'><span id='2FZhW'><b id='2FZhW'><form id='2FZhW'><ins id='2FZhW'></ins><ul id='2FZhW'></ul><sub id='2FZhW'></sub></form><legend id='2FZhW'></legend><bdo id='2FZhW'><pre id='2FZhW'><center id='2FZhW'></center></pre></bdo></b><th id='2FZhW'></th></span></q></dt></tr></i><div id='2FZhW'><tfoot id='2FZhW'></tfoot><dl id='2FZhW'><fieldset id='2FZhW'></fieldset></dl></div>

    <small id='2FZhW'></small><noframes id='2FZhW'>

      <bdo id='2FZhW'></bdo><ul id='2FZhW'></ul>

    1. <legend id='2FZhW'><style id='2FZhW'><dir id='2FZhW'><q id='2FZhW'></q></dir></style></legend>
        <tfoot id='2FZhW'></tfoot>

        从 from 子句的列中获取表名

        时间:2023-11-02

      1. <small id='DgD2u'></small><noframes id='DgD2u'>

          <tbody id='DgD2u'></tbody>

          <i id='DgD2u'><tr id='DgD2u'><dt id='DgD2u'><q id='DgD2u'><span id='DgD2u'><b id='DgD2u'><form id='DgD2u'><ins id='DgD2u'></ins><ul id='DgD2u'></ul><sub id='DgD2u'></sub></form><legend id='DgD2u'></legend><bdo id='DgD2u'><pre id='DgD2u'><center id='DgD2u'></center></pre></bdo></b><th id='DgD2u'></th></span></q></dt></tr></i><div id='DgD2u'><tfoot id='DgD2u'></tfoot><dl id='DgD2u'><fieldset id='DgD2u'></fieldset></dl></div>

                • <bdo id='DgD2u'></bdo><ul id='DgD2u'></ul>
                  <tfoot id='DgD2u'></tfoot>
                • <legend id='DgD2u'><style id='DgD2u'><dir id='DgD2u'><q id='DgD2u'></q></dir></style></legend>
                  本文介绍了从 from 子句的列中获取表名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个视图 t,其中有一列用于表名,另一列具有 where 子句条件.

                  I have a view t with me which has a column for table name and another column which has where clause condition.

                      id| name|table_in| where_clause
                  
                      1 | Sam | t1 | age = 22
                  
                      2 | John| t2 | age = 23 and sex = 'male'
                  

                  等等...

                  现在,我已将记录放入游标中,并且我想运行每个查询.

                  Now, I have put the records in a cursor and I want to run each query.

                      create or replace procedure create_cursor 
                      is
                  
                      CURSOR v_records is
                      select * from t ;
                  
                      begin
                  
                      FOR temp IN v_records LOOP
                          INSERT INTO myTable (id, name)
                          select temp.id, temp.name 
                          from temp.table where temp.where_clause;
                  
                          END LOOP;
                  
                  
                      end;
                      /
                  

                  myTable 是另一个表,我想在其中放置记录以备下次使用.

                  myTable is another table in which I want to put the records for next purpose.

                  推荐答案

                  @Akshay,

                  请在下面找到代码以供参考.

                  Please find the code below for your reference.

                  Create or replace procedure create_cursor is
                  l_statement varchar2(32767);
                  cursor v_records is
                    select * from t;
                  begin
                  for temp in v_records
                  loop
                    l_statement := 'INSERT INTO myTable (id, name) select '||temp.id||','
                     ||temp.name|| ' from ' || temp.table1 
                     || ' where ' || temp.where_clause;
                  
                    execute immediate l_statement;
                    end loop;
                  end;
                  /
                  

                  这篇关于从 from 子句的列中获取表名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:从 oracle 获取函数列表和过程签名 下一篇:Oracle 中 varchar2 PL/SQL 子程序参数的大小限制是多少?

                  相关文章

                    <i id='vGszu'><tr id='vGszu'><dt id='vGszu'><q id='vGszu'><span id='vGszu'><b id='vGszu'><form id='vGszu'><ins id='vGszu'></ins><ul id='vGszu'></ul><sub id='vGszu'></sub></form><legend id='vGszu'></legend><bdo id='vGszu'><pre id='vGszu'><center id='vGszu'></center></pre></bdo></b><th id='vGszu'></th></span></q></dt></tr></i><div id='vGszu'><tfoot id='vGszu'></tfoot><dl id='vGszu'><fieldset id='vGszu'></fieldset></dl></div>
                    <tfoot id='vGszu'></tfoot>

                    1. <legend id='vGszu'><style id='vGszu'><dir id='vGszu'><q id='vGszu'></q></dir></style></legend>
                    2. <small id='vGszu'></small><noframes id='vGszu'>

                      • <bdo id='vGszu'></bdo><ul id='vGszu'></ul>