2

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

  • 1
    You are executing `movementQuery` and returning the bound values of `query`. Is this just a mistake you made when setting up the question? Also, what is the type of your `Out` parameters in Oracle? – Tim Meyer Dec 17 '12 at 11:57
  • Thank you very much that was the real problem – user1909766 Dec 17 '12 at 12:08
  • 1
    @TimMeyer - your comment seems to have solved the OP's problem: perhaps you should post it as the answer, so the question can be finalised in the proper SO fashion. – APC Dec 17 '12 at 14:07
  • @APC Right you are... Done ;) – Tim Meyer Dec 17 '12 at 15:54

1 Answers1

1

You are executing movementQuery

movementQuery.exec();

but you are returning the bound values of query.

message(query.boundValue(":pReturn").toString());
Tim Meyer
  • 12,210
  • 8
  • 64
  • 97