|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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 ) |
|
#3
|
|||
|
|||
|
Alrightie,
Thanks. Quote:
|
|
#4
|
|||
|
|||
|
You cannot do this
Code:
select slope1=13/2 from dual; You have to use PL/SQL to declare and use variables. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > SQL Command not properly ended |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|