没有SQL查询的结果集

时间:2015-08-11 03:54:22

标签: mysql sql

我遇到了调用SQL查询的问题 在我调用SQL查询后,结果为空。

SQLAdapter-impl.js

//Create SQL query
var getAccountsTransactionsStatement = WL.Server.createSQLStatement(
"SELECT transactionId, fromAccount, toAccount, transactionDate,        transactionAmount, transactionType " +
"FROM accounttransactions " +
"WHERE accounttransactions.fromAccount = ? OR accounttransactions.toAccount    = ? " +
"ORDER BY transactionDate DESC " +
"LIMIT 20;"
);

//Invoke prepared SQL query and return invocation result    
function getAccountTransactions1(accountId){
return WL.Server.invokeSQLStatement({
    preparedStatement : getAccountsTransactionsStatement,
    parameters : [accountId, accountId]
});
}

//Invoke stored SQL procedure and return invocation result
function getAccountTransactions2(accountId){
return WL.Server.invokeSQLStoredProcedure({
    procedure : "getAccountTransactions",
    parameters : [accountId]
});
}

调用结果:

{
   isSuccessful: true,
   resultSet: [ ]
}

enter image description here

1 个答案:

答案 0 :(得分:0)

var getAccountsTransactionsStatement = WL.Server.createSQLStatement("SELECT transactionId, fromAccount, toAccount, transactionDate,     transactionAmount, transactionType FROM accounttransactions WHERE accounttransactions.fromAccount = ? OR accounttransactions.toAccount    = ? ORDER BY transactionDate DESC LIMIT 20");
  
      
  1. 执行上面的行不要使用+""作为java中的行连接符   脚本。
  2.   
  3. 尝试按上述单行给出命令并说出我的意思   结果。
  4.   
  5. 为安全起见,请删除SQL查询末尾的;
  6.