SQL错误:ORA-00933:SQL命令未在Oracle Update查询中正确结束

时间:2015-06-16 13:42:07

标签: sql oracle sql-update

我有SYSTEM_SQL_CHECK表,其中我已经在CHECK_SQL列中保存了sql。此列是Varchar数据类型。现在我想更新特定的sql.I已经写了下面的更新sql查询,但它给出了一个错误 Update RATOR_MONITORING_CONFIGURATION.SYSTEM_SQL_CHECK SET CHECK_SQL = 'select count(*) as CNT from O2_SDR_Header where id = (select max(id) from O2_SDR_Header where id > 2012000000000000 and sp_id = 'SP602') And sp_id = 'SP602' and FILE_CREATED_DATE > (SYSTIMESTAMP - INTERVAL '2' HOUR)' WHERE SYSTEM_SQL_CHECK_ID = 604; 。我还尝试使用双引号进行查询,但之后它会出现<div class="col-sm-6"> <label class=" control-label" for="start-date">Start Date & Time</label> <input kendo-date-time-picker id="start-date-time" name="start-date-time" data-ng-model="registeringUser.StartDate" data-ng-required="true" min="today" max="howFarOut" data-ng-show="!setAllDay"> <input kendo-date-picker id="start-date" name="start-date" data-ng-model="registeringUser.StartDate" data-ng-required="true" min="today" max="howFarOut" data-ng-show="setAllDay"> <span class="help-block"></span> </div> <div class="col-sm-6"> <label class=" control-label" for="end-date">End Date & Time</label> <input kendo-date-time-picker id="end-date-time" name="end-date-time" data-ng-model="registeringUser.EndDate" data-ng-required="true" min="today" max="howFarOut" data-ng-show="!setAllDay"> <input kendo-date-picker id="end-date" name="end-date" data-ng-model="registeringUser.EndDate" data-ng-required="true" min="today" max="howFarOut" data-ng-show="setAllDay"> <span class="help-block"></span> </div> 错误。

scope.setAllDay = false;

                        scope.cbSelected = function () {
                            if (scope.myCheckbox) {  // when checked
                                scope.setAllDay = true;

                            } else {
                                scope.setAllDay = false;

                            }
                        };

2 个答案:

答案 0 :(得分:3)

此代码应如下所示:sp_id = ''SP602'''2'

以及''2'' Update RATOR_MONITORING_CONFIGURATION.SYSTEM_SQL_CHECK SET CHECK_SQL = 'select count(*) as CNT from O2_SDR_Header where id = (select max(id) from O2_SDR_Header where id > 2012000000000000 and sp_id = ''SP602'') And sp_id = ''SP602'' and FILE_CREATED_DATE > (SYSTIMESTAMP - INTERVAL ''2'' HOUR)' WHERE SYSTEM_SQL_CHECK_ID = 604;

你的最终代码应该是这样的

values

答案 1 :(得分:0)

你需要逃避单引号,如下所示

Update RATOR_MONITORING_CONFIGURATION.SYSTEM_SQL_CHECK SET CHECK_SQL = "select count(*) as CNT from O2_SDR_Header
where id = (select max(id) from O2_SDR_Header where id > 2012000000000000 and sp_id = ''SP602'') 
And sp_id = ''SP602'' and FILE_CREATED_DATE > (SYSTIMESTAMP - INTERVAL '2' HOUR)"
WHERE SYSTEM_SQL_CHECK_ID = 604;