Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在具有 50 个相同模式的数据库中创建 MVIEW。所以基本的 VIEW 非常简单,但是我需要在视图中添加一列来存储源记录的模式。所有 50 个模式中的表的唯一键都从 0 开始。
无论如何,您必须替换视图的 ddl。
你可以这样做:
create or replace view_name as select col1, col2, 'schema1' as schema_name from schema1.table union all select col1, col2, 'schema2' from schema2.table union all select col1, col2, 'schema3' from schema3.table ...