Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 8th, 2013, 10:03 AM
u0_java u0_java is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 u0_java User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 25 m 13 sec
Reputation Power: 0
is both are same ??

UPDATE GuestStayStatistics
SET
AvgLOS = ISNULL(gss.SumLOS*1.00/gss.TotalStays,0),
AvgGuestCount = ISNULL(gss.SumGuestCount*1.00/gss.TotalStays,0),
AvgRevPerStay = ISNULL(gss.SumTotalActualRevenue/gss.TotalStays,0),

FROM (
Select
ProfileId, PropertyCode, IsActualRecord,
sum(case
when gss.ReservationStatus not in ('CANCELED', 'NOSHOW','WAITLIST') then Nights
else NULL
end) SumLOS,

sum(case
when gss.ReservationStatus not in ('CANCELED', 'NOSHOW','WAITLIST') then GuestCount
else NULL
end) SumGuestCount,

can i use the following code in oracle for the same function

AS

sql_status number;
col1 gueststaystatistics.AVGLOS%TYPE;
col2 gueststaystatistics.AVGGUESTCOUNT%TYPE;
col3 gueststaystatistics.AVGREVPERSTAY%TYPE;

CURSOR c1 IS
SELECT gstat.ROWID,
gss.AVGLOS,gss.AVGGUESTCOUNT,gss.AVGREVPERSTAY FROM (SELECT
profileid,
propertycode,
isactualrecord,
AVG(case
when gss.ReservationStatus not in ( 'CANCELED' , 'NOSHOW' , 'WAITLIST' ) then Nights * 1.00
else 0
end) AVGLOS,
AVG(case
when gss.ReservationStatus not in ( 'CANCELED' , 'NOSHOW' , 'WAITLIST' ) then GuestCount * 1.00
else 0
end) AVGGUESTCOUNT,
AVG(case
when gss.ReservationStatus not in ( 'CANCELED' , 'NOSHOW' , 'WAITLIST' ) then
case
when gss.TotalActualRevenue = 0 THEN NVL(gss.TotalRoomRevenue, 0)
ELSE NVL(gss.TotalActualRevenue, 0)
END
else 0
end) AVGREVPERSTAY,

Reply With Quote
  #2  
Old February 18th, 2013, 03:43 AM
soniya_dawle soniya_dawle is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 4 soniya_dawle User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 4 m 25 sec
Reputation Power: 0
Please could you clarify what you want to achieve here. Are you trying to convert SQL server stored procedure into Oracle stored procedure? I don't understand what exactly your procedure is trying to do.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Need help in understanding a stored proc

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap