Home » Developer & Programmer » Forms » Question on program unit
Question on program unit [message #83001] Thu, 24 July 2003 12:45 Go to next message
Vinod
Messages: 76
Registered: April 1999
Member
I have the following 2 program units in my form which has same select statement but the into clause and where clause is different, how can we merge these 2 program units into 1 unit so that i can populate the values into different items in different blocks

PROCEDURE POP_FUND_TYPE_SOURCE_SUMMARY IS
BEGIN

SELECT fund_type_code,fund_source_code
INTO :funds_ofda_summary.fund_type_code,
:funds_ofda_summary.fund_source_code
FROM fund_lookup
WHERE fund_code = :funds_ofda_summary.fund_code
AND budget_fy = :funds_ofda_summary.budget_fy;

EXCEPTION
WHEN OTHERS THEN
NULL;
END;

PROCEDURE POP_FUND_TYPE_SOURCE_DETAILS IS
BEGIN

SELECT fund_type_code,fund_source_code
INTO :funds_ofda_details.fund_type_code,
:funds_ofda_details.fund_source_code
FROM fund_lookup
WHERE fund_code = :funds_ofda_details.fund_code
AND budget_fy = :funds_ofda_details.budget_fy;

EXCEPTION
WHEN OTHERS THEN
NULL;
END;

can anyone hep me regarding this

Thanks

Vinod
Re: Question on program unit [message #83012 is a reply to message #83001] Fri, 25 July 2003 03:23 Go to previous messageGo to next message
Indrani
Messages: 14
Registered: June 2003
Junior Member
Hi,
Ur prob is not completely cleared but
U can try out like this.
To make a common SQL statement take two variables for into clause and another two variables for where clause.
say var1,var 2 and var3,var4
if 1st cond then
var3:= :funds_ofda_summary.fund_code;
var4:= :funds_ofda_summary.budget_fy;
elsif 2nd cond then
var3:= :funds_ofda_details.fund_code;
var4:= :funds_ofda_details.budget_fy;
end if;

SELECT fund_type_code,fund_source_code
INTO var1,var2
FROM fund_lookup
WHERE fund_code = var3
AND budget_fy = var4;

if 1st cond then
:funds_ofda_summary.fund_type_code := var1;
:funds_ofda_summary.fund_source_code := var2;
elsif 2nd cond then
:funds_ofda_details.fund_type_code := var1;
:funds_ofda_details.fund_source_code := var2;
end if;
Re: Question on program unit [message #83025 is a reply to message #83001] Mon, 28 July 2003 00:25 Go to previous messageGo to next message
Sun
Messages: 92
Registered: August 2002
Member
Whats your problem..without telling the problem how will others help u..
Re: Question on program unit [message #83060 is a reply to message #83001] Fri, 01 August 2003 05:37 Go to previous message
lars
Messages: 11
Registered: July 2002
Junior Member
Write a procedure with return (OUT) variables

PROCEDURE GET_FUND_DATE(par_code IN varchar2, par_fy IN VARCHAR2, par_type_code OUT varchar2, par_source_code OUT VARCHAR2) IS
BEGIN
SELECT fund_type_code,fund_source_code
INTO par_type_code, par_source_code
FROM fund_lookup
WHERE fund_code = par_code
AND budget_fy = par_fy;
END;

In form 1 call the procedure
GET_FUND_DATE(:funds_ofda_details.fund_code
, :funds_ofda_details.budget_fy, :funds_ofda_details.fund_type_code,:funds_ofda_details.fund_source_code);

and do it in Form 2 with the other variables.
Previous Topic: Which software should I buy?
Next Topic: How to copy a request id from a con request in apps?
Goto Forum:
  


Current Time: Fri Mar 29 08:34:56 CDT 2024