我想知道这个条件是否可以通过检查约束来完成,或者我是否需要创建一个触发器。
条件:如果学生录取日期不为空,则考试成绩为空
备注:Contain case OR Trigger
我尝试过的:
ALTER TABLE ADMITED_TABLE
ADD CONSTRAINT AAAA CHECK
( CASE WHEN DATEADMITED IS NOT NULL THEN MARK NULL END);
Run Code Online (Sandbox Code Playgroud)
错误:
ORA-00920: invalid relational operator
00920. 00000 - "invalid relational operator"
Run Code Online (Sandbox Code Playgroud) 在论坛上查看讨论同一问题的不同问题后,我仍然不知道如何解决我的请求方法“DELETE”不受支持
当客户端的用户按下按钮时,会触发 Ajax 方法调用,该方法检索Ajax 调用中包含的sportId并将其发送到 spring 控制器的 Delete 方法。
阿贾克斯方法:
function removeRow(link) {
var sportId = link.getAttribute("data-sport-id");
$.ajax({
type : "DELETE",
url : "/sports-actions",
data: {id : sportId},
contentType: "application/json",
dataType : 'json',
success: function (result) {
console.log(result);
},
error: function (e) {
console.log(e);
}
})
}
Run Code Online (Sandbox Code Playgroud)
弹簧控制器:
@RestController
@RequestMapping("/sports-actions")
public class SportController {
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public Object deleteSport(@PathVariable("id") String id) {
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:
即使我在 url 中发送 id,我仍然收到相同的错误
阿贾克斯代码:
$.ajax({ …Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个涉及体育的 Spring Boot 应用程序,我看不到如何在错误部分中的 ajax 调用后返回错误而不是成功,我想知道如何恢复来自类错误控制器的所有返回在错误部分而不是在成功部分
注意:此代码中一切正常,仅在成功部分返回错误。
类错误:
public class Error extends Exception{
public String code;
public String message;
}
Run Code Online (Sandbox Code Playgroud)
运动类别:
public class Sport {
public String id;
public String name;
}
Run Code Online (Sandbox Code Playgroud)
阿贾克斯调用
$.ajax({
type : "GET",
url : "/sports-actions",
data: {"id" : sportId},
contentType: "application/json",
dataType : 'json',
success: function (result) {
console.log(result);
},
error: function (e) {
console.log(e);
}
})
Run Code Online (Sandbox Code Playgroud)
弹簧控制器
@RestController
@RequestMapping("/sports-actions")
public class SportController {
@RequestMapping(method = RequestMethod.GET)
public Object deleteSport(@RequestParam("id") String id) {
return new …Run Code Online (Sandbox Code Playgroud)