next_record [message #474892] |
Thu, 09 September 2010 09:04 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
manisha_borade
Messages: 49 Registered: May 2010
|
Member |
|
|
hi
i create form in which first block is non database having 2 items from_date and to_date and one button is there
when i click on button
i.e when button pressed new window is open having new database block
i write code on when button pressed
HIDE_WINDOW('XX_RFQ_FIND');
SET_WINDOW_PROPERTY('XX_RFQ_FIND', visible, property_false);
SHOW_WINDOW('XX_RFQ_ACKT');
GO_ITEM('LE_NAME');
SEARCH_REQ;
PROCEDURE SEARCH_REQ IS
FLAG NUMBER:=1;
NEED_BY_FROM_DATE DATE;
NEED_BY_TO_DATE DATE;
CURSOR C1 IS
SELECT prh.org_id, prd.project_id, prh.segment1 AS "REQ", mts.segment1,
prl.quantity, prl.need_by_date,PA.AGENT_NAME "CREATED_BY",ppf.full_name AS APPROVED_BY
FROM po_requisition_headers_all prh,
po_requisition_lines_all prl,
mtl_system_items mts,
per_people_f ppf,
po_req_distributions_all prd,
PO_AGENTS_V PA
WHERE prh.requisition_header_id = prl.requisition_header_id
AND mts.inventory_item_id = prl.item_id
AND prl.destination_organization_id = mts.organization_id
AND prh.preparer_id = PA.AGENT_ID
AND prl.requisition_line_id = prd.requisition_line_id
AND PRL.TO_PERSON_Id=ppf.person_id
AND PPF.EFFECTIVE_END_DATE ='31-DEC-4712'
AND prh.authorization_status = 'APPROVED'
AND prl.need_by_date BETWEEN :XX_FIND.FROM_DATE
AND :XX_FIND.TO_DATE;
BEGIN
FIRST_RECORD;
FOR I IN C1
LOOP
:XX_RFQ_SUM.OU_NAME:=I.ORG_ID;
:XX_RFQ_SUM.PROJECT_NAME:=I.PROJECT_ID;
:XX_RFQ_SUM.REQ_NO:=I.REQ ;
:XX_RFQ_SUM.ITEM:=I.SEGMENT1;
:XX_RFQ_SUM.QTY:=I.quantity;
:XX_RFQ_SUM.NEED_BY_DATE:=I.NEED_BY_DATE;
:XX_RFQ_SUM.TCREATED_BY:=I.CREATED_BY;
:XX_RFQ_SUM.APPROVED_BY:=I.APPROVED_BY;
IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
EXIT;
ELSE NEXT_RECORD;
END IF;
END LOOP;
-- COMMIT;
LAST_RECORD;
END;
my problem is that when i click on button i fetch only one record
can you please tell me where is going wrong.... as i use cursor still not comes
|
|
|
|
|
Re: next_record [message #474900 is a reply to message #474896] |
Thu, 09 September 2010 09:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
I meant specifically:
IF :SYSTEM.LAST_RECORD = 'TRUE' THEN
EXIT;
In an empty data block the first record is also the last. Hence the problem.
Scrap this code.
Create a view that matches your query.
Base the block on the view.
Use execute_query to populate.
It'll be a lot easier.
|
|
|