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

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

                  相关文档推荐

                  How to redirect the output of DBMS_OUTPUT.PUT_LINE to a file?(如何将 DBMS_OUTPUT.PUT_LINE 的输出重定向到文件?)
                  How do I get column datatype in Oracle with PL-SQL with low privileges?(如何使用低权限的 PL-SQL 在 Oracle 中获取列数据类型?)
                  Get a list of all functions and procedures in an Oracle database(获取 Oracle 数据库中所有函数和过程的列表)
                  Why cannot I create triggers on objects owned by SYS?(为什么我不能在 SYS 拥有的对象上创建触发器?)
                  Returning result even for elements in IN list that don#39;t exist in table(即使对于表中不存在的 IN 列表中的元素也返回结果)
                  Reset Sequence in oracle 11g(oracle 11g 中的重置序列)

                    <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>