如何将变量与字符串连接起来以在存储过程的 FROM 子句中创建 Oracle 表名?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1234792/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:44:47  来源:igfitidea点击:

How do I concatenate variables with a string to create an Oracle table name in a FROM clause in a stored procedure?

oraclesyntaxoracle10gdynamic-sql

提问by geekzspot

e.g.

例如

select * 
  from v_schema || '.tbl_a@' || abc.world

回答by tuinstoel

回答by geekzspot

-- Dynamic SQL

-- 动态 SQL

execute immediate 'select * from ' || v_schema || '[email protected]';

立即执行 'select * from ' || v_schema || '[email protected]';

回答by colithium

You're not really supposed to do this but hereare several ways.

你真的不应该这样做,但这里有几种方法。