[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

about db2 store procedure

i create a store procedure  in db2 ,it have two parameter :one is input ,the other is output,i dont know how to call this store procedure in visual c++!who can give some information ?thanks
0
fyf7262284
Asked:
fyf7262284
1 Solution
 
itsmeandnobodyelseCommented:
Look at this sample of MSDN:

SQLUINTEGER PartID;
SQLINTEGER  PartIDInd = 0;

// Bind the parameter.
SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0,
       &PartID, 0, PartIDInd);

// Place the department number in PartID.
PartID = 544;

// Execute the statement.
SQLExecDirect(hstmt, "{call PARTS_IN_ORDERS(?)}", SQL_NTS);

SQL_PARAM_INPUT_OUTPUT defines an argument that is input and output, while SQL_PARAM_OUTPUT defines the return value that must be declared like that:

   {?=call GetNextEmpID}

You may either use SQLPrepare + SQLExecute or SQLExecDirect to invoke Stored Procedures after defining the parametres by SQLBindParameter.

Regards, Alex
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now