可以使用 CREATE VIEW 语句来创建视图。
示例:创建视图 stock_item,该视图内容取自 stock 和 item 两张表,两张表做表连接就得到这个视图。
CREATE VIEW stock_item
AS
SELECT /*+ leading(s) use_merge(i) */
i_price, i_name, i_data, s_i_id, s_w_id, s_order_cnt, s_ytd, s_remote_cnt, s_quantity, s_data, s_dist_01, s_dist_02, s_dist_03, s_dist_04, s_dist_05, s_dist_06, s_dist_07, s_dist_08, s_dist_09, s_dist_10
FROM stok s, item i
WHERE s.s_i_id = i.i_id;
Query OK, 0 rows affected (0.03 sec)
请参考《OceanBase SQL参考(Oracle模式)》查看更多创建视图的选项。