如何写谓词abslist(L,R)

时间:2017-04-28 11:03:42

标签: list prolog

用L表示谓词abslist(L,R)是给定数字的列表,R是与L中的数字对应的绝对值列表。

示例:

?- abslist([0, -1, -2, 3], L).  
L = [0, 1, 2, 3].

1 个答案:

答案 0 :(得分:0)

我认为这就是你需要的

Connection conn = //get connection
PreparedStatement stat = conn.prepareStatement("INSERT INTO  admission (a_id,sickness,recPhysicianDetails,admittedDate,Patient_ID,Doctor_id,Doctor_id1)"
+" VALUES(?, ?, ?, ?, (SELECT ID FROM patient WHERE Patient_name = ?),(SELECT ID FROM employee WHERE Name = ?),(SELECT ID FROM employee WHERE Name = ?))");
stat.setString(1, txt1.getText());
stat.setString(2, txt7.getText());
stat.setString(3, txt8.getText());
stat.setString(4, txt6.getText());
stat.setString(5, txt3.getText());
stat.setString(6, txt9.getText());
stat.setString(7, txt10.getText());
stat.executeUpdate();