Home » Developer & Programmer » Forms » ip address in form (dev 6i)
ip address in form [message #288020] Fri, 14 December 2007 05:52 Go to next message
annu-agi
Messages: 202
Registered: July 2005
Location: Karachi
Senior Member

hi experts
i m finding a way to store ip address of machine in a variable and my coding is below

declare
   string      varchar2(2000);
   temp_label  varchar2(255);
   temp_num    number;
   t_ipadd     varchar2(20);
   t_sid       number(3);
begin
   temp_num := nvl(pick_list.get_picklist_element_count(pick_list.list_out),0);
--   string   := to_char(temp_num) || ' values: ';
	 select SYS_CONTEXT('USERENV', 'IP_ADDRESS', 15) into t_ipadd from dual;
	 select sid  into t_sid from v$session where audsid=(SELECT userenv('sessionid') FROM dual);	 
   for i in 1..temp_num loop
      temp_label := pick_list.get_picklist_element_value(pick_list.list_out, i);
				insert into tmp_data values (t_ipadd,t_sid,temp_label);
      if i > 1 then
				STRING:=STRING||CHR(39)||temp_label||CHR(39);
--         string := string || ', ' || temp_label
      else
				STRING:=STRING||CHR(39)||temp_label||CHR(39);
      end if;
			if I<>TEMP_NUM then
				string:=string||', ';
			end if;
			
   end loop;

   :ctrl_block.m_picklist_values := string;
end;


it give me an error
identifier sys_context must be declare .


what it means, while i m already declare the variable t_ipaddr to store the value to select



any idea .. what is wrong with this coding. while this select is perfectly working n sql plus.

regards

anwer
Re: ip address in form [message #288030 is a reply to message #288020] Fri, 14 December 2007 06:09 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
SYS_CONTEXT doesn't seem to work in Forms.

A workaround is to create a function in the database that returns the IP, and then use that.
Re: ip address in form [message #288565 is a reply to message #288020] Tue, 18 December 2007 00:45 Go to previous messageGo to next message
sirfkashif
Messages: 70
Registered: September 2007
Location: Rawalpindi
Member
salam anwar,
1) first make a database function

CREATE OR REPLACE FUNCTION RETURN_IP_ADDRESS
RETURN VARCHAR2
IS
IP_ADDRESS_V VARCHAR2(15);
BEGIN
SELECT SYS_CONTEXT('USERENV','IP_ADDRESS')
INTO IP_ADDRESS_V
FROM DUAL;
RETURN(IP_ADDRESS_V);
END;
2) then in ur pl code do this

ur_pl_variable := return_ip_address;

where ur_pl_variable is ur pl variable

3) done
Re: ip address in form [message #289141 is a reply to message #288565] Wed, 19 December 2007 19:10 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
If you are using 10g you can use WebUtil_ClientInfo.Get_IP_Address

David
Previous Topic: how to run the form in the Web environment
Next Topic: Does Oracle Forms need to be installed on remote server????
Goto Forum:
  


Current Time: Wed Dec 07 03:09:37 CST 2016

Total time taken to generate the page: 0.12345 seconds