Use the USER function when you want
to define a restricted view of a table that contains only rows that
include your user ID. For information about how to create views, see
the Informix® Database Design and
Implementation Guide and
the GRANT and CREATE VIEW statements in the Informix Guide to SQL:
Syntax.
The
following query returns the user name (login account name) of the
user who executes the query. It is repeated once for each row in the
table.Figure 1: Query
SELECT * FROM cust_calls
WHERE user_id = USER;
If the user name of the current user is richc,
the query retrieves only those rows in the cust_calls table
where user_id = richc.Figure 2: Query result
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. They found the error and are
sending new bill to customer