Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 22nd, 2005, 04:45 PM
bisesar bisesar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 16 bisesar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 23 m 27 sec
Reputation Power: 0
Exclamation SQL Command not properly ended

Hi all,

Has anyone ever seen this error? (I'm using SQL Station by the way.):

"ORA-00923-FROM keyword not found where expected" or "ORA-00933 - SQL command not properly ended"

Maybe someone can help me with it. I have attached the code for you to see, maybe if a second person takes a look at it, they'll find the problem. God knows I've been looking at it waaaaay too long.

Someone suggested that I had to Select Statements butting against each other, but I tried working around that and it didn't work. If you do come up with the same thing, can you please give me an example of how the syntax should be written.

Thanks,
Bisesar.

Select
AVG(total_rx*1.0) Mean1,
AVG(prod_grp_total*1.0) Mean2
FROM georgea.stgd_wkly_trnd2
Select
Slope1=
SUM((total_rx*1.0 - mean1)*(prod_grp_total*1.0 - mean2))
/SUM(SQUARE((total_rx*1.0 - mean1))),
Intercept1=
Mean2 - Mean1 *
(SUM((total_rx*1.0 - mean1)*(prod_grp_total*1.0
- mean2))
/SUM(SQUARE((total_rx*1.0- mean1)))),
Slope2=
SUM((total_rx*1.0 - mean1)*(prod_grp_total*1.0- mean2))
/SUM(SQUARE((prod_grp_total*1.0 - mean2))),
Intercept2=
Mean1 - Mean2 *
(SUM((total_rx*1.0 - mean1)*(prod_grp_total*1.0
- mean2))
/SUM(SQUARE((prod_grp_total*1.0 - mean2))))
FROM georgea.stgd_wkly_trnd2
WHERE PRSCRBR_ID = '0041236'
AND TIME_PER_ID = 6119
AND PROD_NMBR= 316
ORDER by wkly_prscrbr_rx_smmry.time_per_id,
wkly_prscrbr_rx_smmry.prod_nmbr,
wkly_prscrbr_rx_smmry.prscrbr_id

))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))


Select
AVG(total_rx*1.0) Mean1,
AVG(prod_grp_total*1.0) Mean2
FROM georgea.stgd_wkly_trnd2
Select
Slope1=SUM((total_rx*1.0-mean1)*(prod_grp_total*1.0-mean2))
/SUM(SQUARE((total_rx*1.0-mean1))),
Intercept1=Mean2 - Mean1 *

(SUM((total_rx*1.0-mean1)*(prod_grp_total*1.0-mean2))
/SUM(SQUARE((total_rx*1.0- mean1)))),
Slope2=
SUM((total_rx*1.0 - mean1)*(prod_grp_total*1.0- mean2))
/SUM(SQUARE((prod_grp_total*1.0 - mean2))),
Intercept2=
Mean1 - Mean2 *
(SUM((total_rx*1.0 - mean1)*(prod_grp_total*1.0
- mean2))
/SUM(SQUARE((prod_grp_total*1.0 - mean2))))
FROM georgea.stgd_wkly_trnd2



))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))

Select
AVG(total_rx*1.0) Mean1,
AVG(prod_grp_total*1.0) Mean2
FROM georgea.stgd_wkly_trnd2
Select CoVar=
Sum((total_rx*1.0 - mean1)*(prod_grp_total*1.0 - mean2))
/COUNT(*)
FROM georgea.stgd_wkly_trnd2
WHERE PRSCRBR_ID = '0041236'
AND TIME_PER_ID = 6140
AND PROD_NMBR= 383
ORDER by wkly_prscrbr_rx_smmry.time_per_id,
wkly_prscrbr_rx_smmry.prod_nmbr,
wkly_prscrbr_rx_smmry.prscrbr_id

))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
))))))))))))))))))))

SELECT Median =
CASE
WHEN (SELECT COUNT(*) FROM georgea.stgd_wkly_trnd2) % 2 = 1
THEN
(SELECT prod_grp_total
FROM georgea.stgd_wkly_trnd2
WHERE (SELECT COUNT (*)
FROM georgea.stgd_wkly_trnd2
WHERE prod_grp_total < prod_grp_total) =
(SELECT COUNT (*)
FROM georgea.stgd_wkly_trnd2
WHERE prod_grp_total > prod_grp_total)
ELSE
(SELECT AVE (prod_grp_total)
FROM georgea.stgd_wkly_trnd2
END

Reply With Quote
  #2  
Old February 22nd, 2005, 05:22 PM
r937's Avatar
r937 r937 is online now
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,689 r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level)r937 User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 6 Days 15 h 57 m 56 sec
Reputation Power: 985
you've posted this before --

http://forums.devshed.com/showpost.php?p=980876&postcount=1

hang on a second and i will move this thread to the oracle forum as well

(the oracle moderators can decide whether to allow it, as it is essentially a duplicate posting )
__________________
r937.com | rudy.ca

Reply With Quote
  #3  
Old February 22nd, 2005, 09:05 PM
bisesar bisesar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 16 bisesar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 23 m 27 sec
Reputation Power: 0
Alrightie,

Thanks.

Quote:
Originally Posted by r937
you've posted this before --

http://forums.devshed.com/showpost.php?p=980876&postcount=1

hang on a second and i will move this thread to the oracle forum as well

(the oracle moderators can decide whether to allow it, as it is essentially a duplicate posting )

Reply With Quote
  #4  
Old February 22nd, 2005, 11:15 PM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,308 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 5 h 2 m 57 sec
Reputation Power: 48
You cannot do this
Code:
select slope1=13/2 from dual;


You have to use PL/SQL to declare and use variables.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > SQL Command not properly ended


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway