• <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 子句的列中获取表名

        fetch table name from a column for from clause(从 from 子句的列中获取表名)

      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 子句的列中获取表名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在文件系统磁盘足够的情况下,这个文件大小是可以无限增长的。 为了避免ibtmp1文件无止境的暴涨导致
                  SQL query to group by day(按天分组的 SQL 查询)
                  What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                  MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                  MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                  Include missing months in Group By query(在 Group By 查询中包含缺失的月份)

                    <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>
                        <tbody id='vGszu'></tbody>

                        <legend id='vGszu'><style id='vGszu'><dir id='vGszu'><q id='vGszu'></q></dir></style></legend>
                        • <small id='vGszu'></small><noframes id='vGszu'>

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