Oracle Sql Error 933 Sqlstate 42000
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About ora-00933 sql command not properly ended in oracle Us Learn more about Stack Overflow the company Business Learn more about hiring ora-00933 sql command not properly ended select developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the sql command not properly ended update Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Hibernate exception Query not properly ended sql command not properly ended insert up vote 0 down vote favorite Getting exception while running this query select COUNT(tl.LOG_ID)AS EVTCOUNT,tl.PRIORITY FROM Customer_? tl Where tl.DEVICE_REPORTED_TIME >= SysDate-90 GROUP BY tl.PRIORITY ORDER BY tl.PRIORITY` Here I am using query.setLong(0,custId); so it will become like Customer_1 If I run the above query from SqlDeveloper IDE It is working fine or If I set this value as Statically like Customer_1 instead of Customer_? It
Pl/sql: Ora-00933: Sql Command Not Properly Ended
working fine. Errors: WARN : org.hibernate.util.JDBCExceptionReporter - SQL Error: 933, SQLState: 42000 ERROR: org.hibernate.util.JDBCExceptionReporter - ORA-00933: SQL command not properly ended What Might be wrong with this query though other queries are running fine? Edit I am using NamedQueries and I have written this query in a separate xml file. java oracle hibernate share|improve this question edited Feb 24 '15 at 12:02 asked Feb 24 '15 at 11:54 Ali786 1,3441736 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted You can't use a parameter in a query like that. Without going into the logic behind this, your best option is to concatenate the query string before creating a query String queryString = "select COUNT(tl.LOG_ID) AS EVTCOUNT,tl.PRIORITY FROM Customer_" + custId + " tl Where tl.DEVICE_REPORTED_TIME >= SysDate-90 GROUP BY tl.PRIORITY ORDER BY tl.PRIORITY"; Query query = session.createSQLQuery(queryString); EDIT As for NamedQueries, they are compiled when the application is started so I don't think there is a way to change the target entity (table) at runtime. share|improve this answer edited Feb 25 '15 at 6:34 answered Feb 24 '15 at 11:59 Predrag Maric 14.3k2829 Thanks, I removed The NamedQuery a
MySQL MariaDB PostgreSQL SQLite MS Office Excel Access Word Web Development HTML CSS Color Picker Languages C Language More ASCII Table Linux UNIX Java Clipart Techie Humor Advertisement Oracle
Sql Command Not Properly Ended Join
Basics ALIASES AND AND & OR BETWEEN COMPARISON OPERATORS DELETE DISTINCT EXISTS ora-00933 sql command not properly ended group by FROM GROUP BY HAVING IN INSERT INSERT ALL INTERSECT IS NOT NULL IS NULL JOIN LIKE MINUS NOT ora-00933 sql command not properly ended in java OR ORDER BY PIVOT REGEXP_LIKE SELECT SUBQUERY TRUNCATE UNION UNION ALL UPDATE WHERE Oracle Advanced Oracle Cursors Oracle Exception Handling Oracle Foreign Keys Oracle Loops/Conditionals Oracle Transactions Oracle Triggers String/Char Functions http://stackoverflow.com/questions/28695144/hibernate-exception-query-not-properly-ended Numeric/Math Functions Date/Time Functions Conversion Functions Analytic Functions Advanced Functions Oracle / PLSQL: ORA-00933 Error Message Learn the cause and how to resolve the ORA-00933 error message in Oracle. Description When you encounter an ORA-00933 error, the following error message will appear: ORA-00933: SQL command not properly ended Cause You tried to execute a SQL statement with an inappropriate clause. Resolution The https://www.techonthenet.com/oracle/errors/ora00933.php option(s) to resolve this Oracle error are: Option #1 You may have executed a INSERT statement with a ORDER BY clause. To resolve this, remove the ORDER BY clause and re-execute the INSERT statement. For example, you tried to execute the following INSERT statement: INSERT INTO supplier (supplier_id, supplier_name) VALUES (24553, 'IBM') ORDER BY supplier_id; You can correct the INSERT statement by removing the ORDER BY clause as follows: INSERT INTO supplier (supplier_id, supplier_name) VALUES (24553, 'IBM'); Option #2 You may have tried to execute a DELETE statement with a ORDER BY clause. To resolve this, remove the ORDER BY clause and re-execute the DELETE statement. For example, you tried to execute the following DELETE statement: DELETE FROM supplier WHERE supplier_name = 'IBM' ORDER BY supplier_id; You can correct the DELETE statement by removing the ORDER BY clause as follows: DELETE FROM supplier WHERE supplier_name = 'IBM'; Share this page: Advertisement Back to top Home | About Us | Contact Us | Testimonials | Donate While using this site, you agree to have read and accepted our Terms of Service and Privacy Po
Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.