how to create cursor with bind variables [message #36192] |
Fri, 09 November 2001 01:14 |
srin
Messages: 3 Registered: November 2001
|
Junior Member |
|
|
Hi,
i have a procedure as
procedure test(stime in varchar2,dtime in varchar2) as
sttime: = to_date(stime,'dd/mm/yyyy hh24:mi');
endtime: = to_date(dtime,'dd/mm/yyyy hh24:mi');
select col1,col2 from tab where
col3>= sttime and col4<= endtime
How do i make this select statement as a cursor.
Any help is appreciated.
Srin
----------------------------------------------------------------------
|
|
|
Re: how to create cursor with bind variables [message #36196 is a reply to message #36192] |
Fri, 09 November 2001 05:00 |
Suresh Vemulapalli
Messages: 624 Registered: August 2000
|
Senior Member |
|
|
procedure test(stime in varchar2,dtime in varchar2) as
sttime date: = to_date(stime,'dd/mm/yyyy hh24:mi');
endtime date: = to_date(dtime,'dd/mm/yyyy hh24:mi');
cursor c1 IS SELECT col1,col2
where col3>=sttime and col4<=endtime;
begin
---
end;
----------------------------------------------------------------------
|
|
|
Re: how to create cursor with bind variables [message #36209 is a reply to message #36196] |
Fri, 09 November 2001 11:23 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
Even better - user cursor parameters - it helps keep the cursor more efficient in multi user environments:
procedure test(stime in varchar2,dtime in varchar2) as
sttime date: = to_date(stime,'dd/mm/yyyy hh24:mi');
endtime date: = to_date(dtime,'dd/mm/yyyy hh24:mi');
cursor c1 (STTIME IN DATE, ENDTIME IN DATE)IS SELECT col1,col2
where col3>=sttime and col4<=endtime;
begin
---
end;
----------------------------------------------------------------------
|
|
|