473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SQL command not properly ended?

This works in mySQL, but not Oracle 10g and I have no idea why. Please help!

SQL> SELECT E.name, B.publisher FROM employee as E
2 INNER JOIN loan AS L ON (E.empno=L.empno)
3 INNER JOIN books as B ON (L.isbn=B.isbn)
4 GROUP BY E.name, B.publisher
5 HAVING COUNT(DISTINCT B.isbn)>5;


ERROR at line 1:
ORA-00933: SQL command not properly ended

How should this be written in Oracle?
Feb 20 '08 #1
4 10520
Dave44
153 100+
This works in mySQL, but not Oracle 10g and I have no idea why. Please help!

SQL> SELECT E.name, B.publisher FROM employee as E
2 INNER JOIN loan AS L ON (E.empno=L.empno)
3 INNER JOIN books as B ON (L.isbn=B.isbn)
4 GROUP BY E.name, B.publisher
5 HAVING COUNT(DISTINCT B.isbn)>5;


ERROR at line 1:
ORA-00933: SQL command not properly ended

How should this be written in Oracle?
your table name alias cant have the AS in it

Expand|Select|Wrap|Line Numbers
  1. [145]dave@> select * from dual as d;
  2. select * from dual as d
  3.                    *
  4. ERROR at line 1:
  5. ORA-00933: SQL command not properly ended
  6.  
  7.  
  8. Elapsed: 00:00:00.01
  9. [145]dave@> select * from dual d;
  10.  
  11. D
  12. -
  13. X
  14.  
  15. Elapsed: 00:00:00.01
  16.  
Feb 21 '08 #2
This works in mySQL, but not Oracle 10g and I have no idea why. Please help!

SQL> SELECT E.name, B.publisher FROM employee as E
2 INNER JOIN loan AS L ON (E.empno=L.empno)
3 INNER JOIN books as B ON (L.isbn=B.isbn)
4 GROUP BY E.name, B.publisher
5 HAVING COUNT(DISTINCT B.isbn)>5;


ERROR at line 1:
ORA-00933: SQL command not properly ended

How should this be written in Oracle?
like this, may be it will be helpful to you

SELECT e.empno,E.ename,B.dname FROM emp E
INNER JOIN dept b ON (E.deptno=b.deptno)
GROUP BY E.ename, B.dname,e.empno
HAVING COUNT(DISTINCT e.empno)>5
Feb 21 '08 #3
debasisdas
8,127 Expert 4TB
In oracle AS is used for alias of column names .For table aliasing the alias name must immediately follow the table name without AS keyword.

Just try to use this .

Expand|Select|Wrap|Line Numbers
  1. SELECT E.name, B.publisher FROM employee  E
  2.     INNER JOIN loan  L ON (E.empno=L.empno)
  3.     INNER JOIN books  B ON (L.isbn=B.isbn)
  4.     GROUP BY E.name, B.publisher
  5.     HAVING COUNT(DISTINCT B.isbn)>5;
Feb 21 '08 #4
Thanks everyone... I got it working now!!
Feb 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: jlea | last post by:
I'm trying to pass a filename, obtained with using the fileName property from the OpenFileDialog, as a application parameter in Process.StartInfo.Arguments and run a MFC/C++ application using the...
5
by: Gene | last post by:
What can I do if I want to get the result using the sql command? for example, the select command is "select Name from Employee where StaffID=10" How to get the "Name"??? dim Name as string and...
5
by: Good Man | last post by:
Hi there I am trying to execute a custom-built java program on my linux server via PHP. Basically, a user uploads files via PHP, and then the java program performs some action on these files. ...
3
by: Double Echo | last post by:
Hi all, I'm using PHP 4.4.2, and use PHP on both the command-line and the web. I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using Apache 2.0.55 , on my Dell laptop. ...
2
by: Chris Song | last post by:
Hello, I'v installed mysql 5.0 (MySQL-server-standard-5.0.27-0.rhel4.i386.rpm) on RedHat AS4. When I start mysql through command line (i.e. /usr/bin/mysqld_safe --datadir=/var/lib/mysql...
2
by: Sahar Madahian | last post by:
Hi! I try to insert value to a table column but I'v got this error 'ORA-00933: SQL command not properly ended' Can anyone help me please? insert into SHAMROCK.CAT_SALESPRODUCT...
4
by: narenshines | last post by:
Hi I am trying to update my table using this.. update tablename set sqlquery = 'select max(upd_rows) from tablename where data_center='***' and tab_abbrev='***'' where userid='12345'; ...
2
by: SREESHAK | last post by:
i am getting the erroe ORA:00933 sql command not properly ended ,for sqlStatement.executeUpdate( "INSERT INTO CLARITY.Z_INBOUND_AUTO_SCHEDULE(FILE_NAME, FILE_DATE, CREATED_DATE, MODIFIED_DATE,...
2
by: MSSatpute84 | last post by:
hi, I have one sql code written. I ran it n getting a error--"Sql query not properly ended". can anyone tell me solution to fix the error?/////
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.