Summary
You use Oracle Forms Developer 2000 or Oracle Forms Developer 6.0.8 and you try to compile the Sys_Context function. For example you try to compile:
select SYS_CONTEXT('USERENV', 'OS_USER') osuser from dual;
But you get the error:
error 201: the identifier 'SYS_CONTEXT' must be declared
The cause is the SYS_CONTEXT is a new feature in Oracle 8i and is not included in Forms 6i which uses Oracle 8.0.6 required support files, but you can bypass the problem with the following workaround.
Workaround
Create a database stored function, for example with name
OSUSER. This function can be referenced from a program unit or trigger in Forms.
CREATE OR REPLACE FUNCTION OSUSER
RETURN VARCHAR2
IS
lv_osuser VARCHAR2(30);
BEGIN
SELECT SYS_CONTEXT('USERENV','OS_USER')
INTO lv_osuser
FROM DUAL;
RETURN lv_osuser;
END;
/
After that you can use in the Forms the statement:
select OSUSER from dual;