Home » Developer & Programmer » Forms » displaying the details of a particular employee
displaying the details of a particular employee [message #168562] Thu, 20 April 2006 23:58 Go to next message
jagannadh_99
Messages: 4
Registered: March 2006
Junior Member
hi,
i am new to this field and learning oracle right now. i have tried my best but i could not get it. so any one kindly help me

i have created a push button and when i entered the empno and pressed the button it should display the employee information of that paticular empno

if i enter the last empno it is displaying the last record other than the last empno it is dispalying as invalid empno

i have written the code as follows.
DECLARE
v_empno employee.empno%type;
cursor emp_cursor is select empno,ename,deptno,sal,comm from employee;
 emp_record  emp_cursor%rowtype;
BEGIN
	open emp_cursor;
	loop
		fetch emp_cursor into emp_record ;
		exit when emp_cursor%notfound;
	end loop; 
	
             message('enter empno');
	     go_block('employee');
	     v_empno:=:employee.empno;
	    		
	for i in 1..emp_cursor%rowcount  
	loop 
		if(emp_record.empno=v_empno) then
		
		         go_block('employee');
			:employee.empno:=emp_record.empno;
			:employee.ename:=emp_record.ename;
			:employee.deptno:=emp_record.deptno;
			:employee.sal:=emp_record.sal;
			:employee.comm:=emp_record.comm;
		else
		         message('invalid empno');
			end if;
			
	end loop;
	close emp_cursor;
	
END;

[Updated on: Fri, 21 April 2006 00:22] by Moderator

Report message to a moderator

Re: displaying the details of a particular employee [message #168569 is a reply to message #168562] Fri, 21 April 2006 00:27 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please do me and all other Oracle Forms Developers a BIG, BIG favour. Read the sticky at the beginning of this forum. Find the Oracle Forms reference site. Download the documentation. Read it. Learn how Oracle designed this application's behaviour.

Okay, that said, here are some links.
Populate block using cursor
http://www.orafaq.com/forum/m/605/67467/?srch=populate+block+cursor+create_record#msg_605
and my feelings about it.
http://www.orafaq.com/forum/m/134237/67467/?srch=populate+block+cursor+create_record#msg_134237

Loading data into a block MANUALLY
http://www.orafaq.com/forum/m/111031/67693/#msg_111031
MANUAL previous and next master key record retrieval
http://www.orafaq.com/forum/m/111031/67693/#msg_111031
Sample MANUAL get employees form
http://www.orafaq.com/forum/t/52330/67467/

David
Re: displaying the details of a particular employee [message #168602 is a reply to message #168562] Fri, 21 April 2006 02:26 Go to previous messageGo to next message
jagannadh_99
Messages: 4
Registered: March 2006
Junior Member
hi,

first of all thanks David. i have understood the concepts very well. Thanks once again for tolerating me with silly doubts.


Regards
jagannadh
Re: displaying the details of a particular employee [message #168604 is a reply to message #168602] Fri, 21 April 2006 02:30 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
No problem, just try and work with Forms the way it was designed and you will find that you can create simple applications that work easily and quickly with very little programming effort on your part.

David
Previous Topic: How to run the application using "host" command ?
Next Topic: Problem in my menu
Goto Forum:
  


Current Time: Fri Sep 20 07:30:23 CDT 2024