Home » Developer & Programmer » Forms » how to fetch values in more than one row
how to fetch values in more than one row [message #198662] Wed, 18 October 2006 02:52 Go to next message
qewani
Messages: 51
Registered: December 2005
Location: uaq
Member

hi
can any one tell me how to post values in the fields of tabular form which displays more than one record for each field??

i have tried the post change with loop but it only return one row.
i have a field where user insert the employee code (here i have a post change trigger)
post change trigger code is
declare 
 
cursor kk is 
 
select EMPD_DOCU_CODE,EMPD_NUMBER,EMPD_ISS_PLACE,
EMPD_ISS_DT,EMPD_EXP_DT,EMPD_INIT_DAYS,EMPD_JS_DATE,EMPD_JS_REMARKS 
from PM_EMP_DOCUMENT 
where EMPD_CODE = :EDH_EMP_CODE ;
 
begin
IF  kk%ISOPEN THEN  
CLOSE kk;
END IF;
 
OPEN kk ;
Loop
FETCH kk INTO  :EDD_DOCU_CODE,:EDD_NUMBER,:EDD_ISS_PLACE,:EDD_ISS_DT,
:EDD_EXP_DT,:EDD_INIT_DAYS,:EDD_JS_DATE,:EDD_JS_REMARKS;
Exit when kk%notfound;
end loop;
close kk;
END;


while user inters the employee code it should shows the employee document details.

and there are more than one document details for each employee.

and my code currently shows only one row of the employee details.

how to make it show all the document details of the employee??
Re: how to fetch values in more than one row [message #198669 is a reply to message #198662] Wed, 18 October 2006 03:46 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
You don't create a record in the PM_EMP_BLOCK. Do so. You keep on fetching in the same record over and over again.

A tip: prefix item names with block names to avoid confusion.

MHE
Re: how to fetch values in more than one row [message #198675 is a reply to message #198662] Wed, 18 October 2006 04:02 Go to previous messageGo to next message
shahidmughal
Messages: 91
Registered: January 2006
Location: Faisalabad Pakistan
Member

hi
to solve your problem

read this trigger i have make an addition

next_record;
----------------------------------------
declare

cursor kk is

select EMPD_DOCU_CODE,EMPD_NUMBER,EMPD_ISS_PLACE,
EMPD_ISS_DT,EMPD_EXP_DT,EMPD_INIT_DAYS,EMPD_JS_DATE,EMPD_JS_REMARKS
from PM_EMP_DOCUMENT
where EMPD_CODE = :EDH_EMP_CODE ;

begin
IF kk%ISOPEN THEN
CLOSE kk;
END IF;

OPEN kk ;
Loop
FETCH kk INTO :EDD_DOCU_CODE,:EDD_NUMBER,:EDD_ISS_PLACE,:EDD_ISS_DT,
:EDD_EXP_DT,:EDD_INIT_DAYS,:EDD_JS_DATE,:EDD_JS_REMARKS;
Exit when kk%notfound;

next_record;
end loop;
close kk;
END;


this will put your data in rows not in single row


regards
Muhammad Shahid Mughal
Re: how to fetch values in more than one row [message #198684 is a reply to message #198675] Wed, 18 October 2006 04:29 Go to previous messageGo to next message
qewani
Messages: 51
Registered: December 2005
Location: uaq
Member

next_record

i tried that but it gives me an error which says
FRM-40737:Illegal restricted procedure GO_BLOCK in POST_CHANGE trigger.
Re: how to fetch values in more than one row [message #198689 is a reply to message #198684] Wed, 18 October 2006 04:34 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Very Happy I was thinking that. You cannot use restricted built-ins in pre/post/when triggers.

why don't you create a master/detail:
master -> single record employee
detail -> multirecord PM_EMP_DOCUMENT


Create a relation between the two blocks. That way you don't have to do such a fancy programming.

MHE
Re: how to fetch values in more than one row [message #198700 is a reply to message #198689] Wed, 18 October 2006 05:12 Go to previous messageGo to next message
qewani
Messages: 51
Registered: December 2005
Location: uaq
Member

the problem is that the records are not takin from the child table but they are takin from another table..,

so any other ideas??

i hope you guys can help me solving that!
Re: how to fetch values in more than one row [message #198749 is a reply to message #198700] Wed, 18 October 2006 07:34 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Looking at your code, you select from one table (PM_EMP_DOCUMENT). Base the block on that table.

Option 2 is: add a button and perform your code in the when-button-pressed.

MHE
Previous Topic: Omniportlet
Next Topic: how to call form form server
Goto Forum:
  


Current Time: Sat Dec 03 14:16:41 CST 2016

Total time taken to generate the page: 0.17597 seconds