Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL - Replace field name with parameter

PL/SQL - Replace field name with parameter

From: PaulM <mandoswork_at_hotmail.com>
Date: 24 Aug 2004 03:45:21 -0700
Message-ID: <fc844f16.0408240245.5a369566@posting.google.com>


Hi

I'm trying to call a cursor in PL/SQL function and replace one of the field names in the select statement with a parameter that is passed to the function. The script is below:

CREATE OR REPLACE function fnc_get_week (p_reg_key IN number, p_week_num IN number)
RETURN date IS
l_date date;

cursor cur_week is
select date_27 --<<I want to replace '27' with p_week_num>>> from registers_1
where reg_key = p_reg_key;

BEGIN open cur_week;
fetch cur_week into l_date;
close cur_week;

RETURN l_date;

END fnc_get_week;
/

Could anyone let me know what the syntax is to replace the number 27 above with the value passed into the function thru the p_week_num parameter.

Any help would be greatly appreciated.

Thanks

Paul Received on Tue Aug 24 2004 - 05:45:21 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US