ora-00933

Why does this HQL delete fail, when an HQL select with same terms works?

一笑奈何 提交于 2019-12-06 08:32:46
问题 Why does the following HQL query fail? string hql = @"delete MyLog log where log.UtcTimestamp < :threshold and log.Configuration.Application = :application"; session.CreateQuery(hql) .SetDateTime("threshold", threshold) .SetEnum("application", this.application) .ExecuteUpdate(); The same form of query works when used in a select: string hql = @"from MyLog log where log.UtcTimestamp < :threshold and log.Configuration.Application = :application"; IList<MyLog> log = session.CreateQuery(hql)

Oracle sql: using bind variable for dates

…衆ロ難τιáo~ 提交于 2019-12-05 05:16:38
问题 Here is a simple working query without bind variables: select * from table1 where time_stamp > sysdate - INTERVAL '1' day; where time_stamp is of type DATE . I should be able to input any number of days in the above query using bind variable. So I tried the following and does not seem to work: select * from table1 where time_stamp > sysdate - INTERVAL :days day; I tried entering the numeric input both as 10 and '10',for eg. You get ORA-00933 error on 10g. 回答1: The string INTERVAL '1' day in

Why does this HQL delete fail, when an HQL select with same terms works?

狂风中的少年 提交于 2019-12-04 12:08:06
Why does the following HQL query fail? string hql = @"delete MyLog log where log.UtcTimestamp < :threshold and log.Configuration.Application = :application"; session.CreateQuery(hql) .SetDateTime("threshold", threshold) .SetEnum("application", this.application) .ExecuteUpdate(); The same form of query works when used in a select: string hql = @"from MyLog log where log.UtcTimestamp < :threshold and log.Configuration.Application = :application"; IList<MyLog> log = session.CreateQuery(hql) .SetDateTime("threshold", threshold) .SetEnum("application", this.application) .List<MyLog>(); The mapping

how to modify an existing check constraint?

大兔子大兔子 提交于 2019-12-02 17:48:58
Is there any way to modify an existing check constraint on a table other than dropping and re-creating it ? create table t ( n number); ora10g> Tabelle wurde erstellt. ora10g> alter table t add constraint ck check(n>0); Tabelle wurde geõndert. ora10g> alter table t modify constraint ck check(n<0); alter table t modify constraint ck check(n<0) * FEHLER in Zeile 1: ORA-00933: SQL-Befehl wurde nicht korrekt beendet You have to drop it and recreate it, but you don't have to incur the cost of revalidating the data if you don't want to. alter table t drop constraint ck ; alter table t add constraint

Oracle syntax error [duplicate]

左心房为你撑大大i 提交于 2019-12-01 16:28:21
This question already has an answer here: How do I limit the number of rows returned by an Oracle query after ordering? 16 answers I got the following error in Oracle: SELECT * FROM abcd WHERE name LIKE 'a%' LIMIT 10 * ERROR at line 1: ORA-00933: SQL command not properly ended What is the problem with the command? Oracle doesn't support the limit clause. That's a MySQL/Postgres thing. There are alternatives, although they're often a lot more involved http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html The simplest equivalent is: select * from abcd where name like 'a%' and

Oracle syntax error [duplicate]

爱⌒轻易说出口 提交于 2019-12-01 15:33:14
问题 This question already has answers here : How do I limit the number of rows returned by an Oracle query after ordering? (16 answers) Closed 3 months ago . I got the following error in Oracle: SELECT * FROM abcd WHERE name LIKE 'a%' LIMIT 10 * ERROR at line 1: ORA-00933: SQL command not properly ended What is the problem with the command? 回答1: Oracle doesn't support the limit clause. That's a MySQL/Postgres thing. There are alternatives, although they're often a lot more involved http://www

Update with self-join

烂漫一生 提交于 2019-12-01 07:36:57
I want to update a table to indicate that some rows are parents of others, so I added a "parentid" column to the table. The following query finds all the parents: SELECT ca1.id, ca2.id FROM contactassociations ca1 JOIN contactassociations ca2 ON (ca1.contactid = ca2.contactid) where ca1.entitytable = 'EMPLOYER' AND ca2.entitytable = 'CLIENT'; but when I try to adapt that syntax to do the update, it doesn't work: UPDATE contactassociations ca1 SET ca1.parentid = ca2.id JOIN contactassociations ca2 ON (ca1.contactid = ca2.contactid) WHERE ca1.entitytable = 'EMPLOYER' AND ca2.entitytable =

Update with self-join

我是研究僧i 提交于 2019-12-01 05:35:59
问题 I want to update a table to indicate that some rows are parents of others, so I added a "parentid" column to the table. The following query finds all the parents: SELECT ca1.id, ca2.id FROM contactassociations ca1 JOIN contactassociations ca2 ON (ca1.contactid = ca2.contactid) where ca1.entitytable = 'EMPLOYER' AND ca2.entitytable = 'CLIENT'; but when I try to adapt that syntax to do the update, it doesn't work: UPDATE contactassociations ca1 SET ca1.parentid = ca2.id JOIN contactassociations

SQL Inner join on select statements

岁酱吖の 提交于 2019-11-29 03:10:19
I am trying to make an inner join on a select statement like this: select * from (select* from bars where rownum <= 10 )as tab1 inner join (select * from bars where rownum <= 10 )as tab2 on tab1.close=tab2.close and I get the following error: ORA-00933 SQL command not properly ended Any help would be appreciated, thank you! Just remove as from your query: select * from (select* from bars where rownum <= 10 ) tab1 inner join (select * from bars where rownum <= 10 ) tab2 on tab1.close=tab2.close I believe the error comes from you needing a semicolon to end the statement. The select looks fine to

SQL Command not properly ended?

匆匆过客 提交于 2019-11-28 01:52:13
I am using a SQL statement with a Temporary relation, and am getting the error ORA-009933: SQL command not properly ended I don't see anything wrong with the statement, so any assistance is greatly appreciated. The statement is: SELECT Temp.name, Temp.AvgSalary FROM (SELECT A.aid, A.aname AS name, AVG(E.salary) AS AvgSalary FROM Aircraft A, Certified C, Employees E) AS Temp; Thanks oracle does not support as for table aliases, only for column aliases and they are optional for that use => delete all as keywords ;) You shouldn't put the AS temp. When putting alias to a table (or subquery) you