user1909766
user1909766

Reputation: 55

qt call oracle stored procedure

I am using QsqlQuery to call oracle stored procedure that uses input parameters and two output parameters The procedure executed perfectly but output parameters contains no data

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());

Any ideas Thank you for your interest

Upvotes: 2

Views: 1485

Answers (1)

Tim Meyer
Tim Meyer

Reputation: 12600

You are executing movementQuery

movementQuery.exec();

but you are returning the bound values of query.

message(query.boundValue(":pReturn").toString());

Upvotes: 1

Related Questions