2012-12-17 194 views
2

不包含任何数据QT调用Oracle我使用QsqlQuery调用Oracle存储过程使用的输入参数和完美的执行两个输出参数 工序,但输出参数的存储过程

QSqlQuery movementQuery ; 
movementQuery.prepare("call Qt.add_movement(:pDocumentType , :pDocumentId ,  
to_date(sysdate,'dd-mm-yyyy') ,:pDocumentNumber" 
",to_date(sysdate,'dd-mm-yyyy') , :pCustId ,:pMovementId ,:pReturn)"); 
movementQuery.bindValue(":pDocumentType",documentType); 
movementQuery.bindValue(":pDocumentId",documentId); 
movementQuery.bindValue(":pDocumentNumber",0); 
movementQuery.bindValue(":pCustId",ui->custId->text()); 
movementQuery.bindValue(":pMovementId", 0, QSql::Out); 
movementQuery.bindValue(":pReturn", "FALSE", QSql::Out); 
movementQuery.exec(); 
//// The query executed the query is active and no errors are valid 
//// message is method to display the value 
message(query.boundValue(":pReturn").toString()); 
message(query.boundValue(5).toString()); 
message(query.boundValue(":pMovementId").toString()); 
message(query.boundValue(4).toString()); 

任何想法 感谢您感兴趣

+1

您正在执行'movementQuery'并返回'query'的绑定值。这只是你在设置问题时犯的一个错误吗?另外,Oracle中的Out参数的类型是什么? –

+0

非常感谢您这是真正的问题 – user1909766

+1

@TimMeyer - 您的评论似乎已经解决了OP的问题:或许您应该将其作为答案发布,因此可以以适当的SO方式最终确定问题。 – APC

回答

1

您正在执行movementQuery

movementQuery.exec(); 

但你retur ning的值为query

message(query.boundValue(":pReturn").toString()); 
相关问题