Its not a table. Its a table function, so you need to rewrite the query a
bit. Here it is without the embedded stuff:
select *
from table(qsys2.users()) t1
From: Dave Boettcher <Dave.Boettcher@xxxxxxxxxxxxxxxxx>
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<rpg400-l@xxxxxxxxxxxx>
Date: 10/08/2015 12:37 PM
Subject: RE: AW: Retrieve a user's full name (not the User ID)
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>
I'm trying this out in interactive SQL and can't seem to find the
qsys2/users table. Is it only available for embedded SQL?
Quite often I need to search if an employee has an ID on the IBM i and this
could be handy. Right now we create a file of user profiles each week but
if this file is there it would work too.
Right now I use a statement like this on our file of users:
SELECT * FROM qgpl/userfile WHERE upper(uptext) like '%DAVE%'
Any questions, let me know please.
Thanks,
Dave B
Everybody is ignorant, only on different subjects. - Will Rogers
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
darren@xxxxxxxxx
Sent: Thursday, October 08, 2015 10:27 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
<rpg400-l@xxxxxxxxxxxx>
Subject: Re: AW: Retrieve a user's full name (not the User ID)
I was amazed by this function, but confused because I hadn't seen it
before. I went looking for it in a reference chart I have from IBM online,
and I didn't find this table function, but I did find the QSYS2.USER_INFO
view. This view seems more restrictive by my authority to this data,
possibly because there are a lot of fields in there. This QSYS2.USER()
table function returns more results, possibly because the name of the user
isn't subject to tight profile controls. I find that interesting.
IBM Provided an UDTF (User Defined Function) named USERS(), located
within
the QSYS2 library.
You easily can access this UDTF with (embedded) SQL:
Exec SQL Select ODOBTX into :HostVariable
from Table(Qsys2.Users()) x
Where ODOBNM = :HostUsrPrf;
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.