在 SELECT 语句中使用函数 / 其它函数 |
当想要定义仅包含包括您的用户标识行的表的受限视图时,使用 USER 函数。有关如何创建视图的信息,请参阅 GBase 8s 数据库设计和实现指南 和 GBase 8s SQL 指南:语法 中的 GRANT 和 CREATE VIEW 语句。
图: 查询
SELECT * FROM cust_calls WHERE user_id = USER;
图: 查询结果
customer_num 110 call_dtime 1998-07-07 10:24 user_id richc call_code L call_descr Order placed one month ago (6/7) not received. res_dtime 1998-07-07 10:30 res_descr Checked with shipping (Ed Smith). Order sent yesterday-we were waiting for goods from ANZ. Next time will call with delay if necessary customer_num 119 call_dtime 1998-07-01 15:00 user_id richc call_code B call_descr Bill does not reflect credit from previous order res_dtime 1998-07-02 08:21 res_descr Spoke with Jane Akant in Finance. She found the error and is sending new bill to customer