Unix Technical Forum

Cursor problem

This is a discussion on Cursor problem within the Oracle Database forums, part of the Database Server Software category; --> I have a situation that have a cursor defined and need to add the resukt of the following query ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 04:18 AM
soalvajavab1@yahoo.com
 
Posts: n/a
Default Cursor problem

I have a situation that have a cursor defined and need to add the
resukt of the following query to its where clause:

select max(last_update_date)
into v_last_run
from sa_service_request
where last_update_user = 'FRANK_PIA';


I mean it needs to be like this:

CURSOR pia1
IS
SELECT t1.service_request_no, t1.problem_description
FROM sa_service_request t1
WHERE t1.service_request_status = 'FINISHED'
AND t1.finished_date >= v_last_run

If I could have my select max() statment in DECLARE part of Stored
Proc then I would be OK. I don't want to go with REF Cursor if
possible. Is there anyway to easily do that?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 04:18 AM
DA Morgan
 
Posts: n/a
Default Re: Cursor problem

soalvajavab1@yahoo.com wrote:
> I have a situation that have a cursor defined and need to add the
> resukt of the following query to its where clause:
>
> select max(last_update_date)
> into v_last_run
> from sa_service_request
> where last_update_user = 'FRANK_PIA';
>
>
> I mean it needs to be like this:
>
> CURSOR pia1
> IS
> SELECT t1.service_request_no, t1.problem_description
> FROM sa_service_request t1
> WHERE t1.service_request_status = 'FINISHED'
> AND t1.finished_date >= v_last_run
>
> If I could have my select max() statment in DECLARE part of Stored
> Proc then I would be OK. I don't want to go with REF Cursor if
> possible. Is there anyway to easily do that?


What version of Oracle?

Who is last_update_user? The last person to update any record?
specific records? the records selected by the cursor?

Potentially link an in-line view into your query but form what
you've written I can imagine quite a few possible scenarios.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:34 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com