Home » Developer & Programmer » Forms » Command not working
Command not working [message #148431] Thu, 24 November 2005 04:01 Go to next message
adil_jahangiri
Messages: 4
Registered: November 2005
Location: Pakistan
Junior Member
This Command
select sys_context('USERENV', 'IP_ADDRESS') from dual;
working in SQL
but not working in developer forms. what i have to do to run this command in developer forms.
Re: Command not working [message #148441 is a reply to message #148431] Thu, 24 November 2005 04:51 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Forms (version?) has an older engine, so I guess you have to create a server-side function returning the sys_context parameter value. Call that from your Form.

MHE
Re: Command not working [message #149364 is a reply to message #148431] Thu, 01 December 2005 06:22 Go to previous messageGo to next message
Atul P
Messages: 61
Registered: June 2003
Location: Mumbai-Jakarta
Member



You can try someotherway round.

Just make one backend function returning varchar2.

CREATE FUNCTION FUNC_GET_IP
RETURN VARCHAR2 IS
V_IP VARCHAR2(50);
BEGIN

SELECT SYS_CONTEXT('USERENV','IP_ADDRESS')
INTO V_IP
FROM DUAL;

RETURN V_IP;

END;


And now in your Form use this to fetch the Value.

Ciao
Atul P

p.s: There could be lot others ways to do it. I thought of this as simplest
Re: Command not working [message #149368 is a reply to message #149364] Thu, 01 December 2005 06:36 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Yep, that's what I said:
Like I stated

so I guess you have to create a server-side function returning the sys_context parameter value. Call that from your Form.


BTW: I'd do it like this (slightly improved:no fetch,no needles variables):
SQL> CREATE OR REPLACE FUNCTION f_sys_context(p_env_param IN VARCHAR2)
  2  RETURN VARCHAR2
  3  IS
  4  BEGIN
  5    RETURN SYS_CONTEXT('USERENV',p_env_param);
  6  END;
  7  /


Nah! Wink

MHE

[Updated on: Thu, 01 December 2005 06:37]

Report message to a moderator

Previous Topic: Oracle forms 10g Demos
Next Topic: Creating a button
Goto Forum:
  


Current Time: Fri Sep 20 03:38:52 CDT 2024