55 lines
3.4 KiB
HTML
55 lines
3.4 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="concept" />
|
|
<meta name="DC.Title" content="Process UPDATE, DELETE, and INSERT statements in a DB2 UDB CLI application" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzadpprocessresults.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="rzadpfnnrcol.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="rzadpprocupd" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Process UPDATE, DELETE, and INSERT statements in a DB2 UDB CLI application</title>
|
|
</head>
|
|
<body id="rzadpprocupd"><a name="rzadpprocupd"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Process UPDATE, DELETE, and INSERT statements in a DB2 UDB CLI application</h1>
|
|
<div><p>If the statement is modifying data (UPDATE, DELETE or INSERT), no action
|
|
is required other than the normal check for diagnostic messages. In this case, <samp class="codeph">SQLRowCount()</samp> can
|
|
be used to obtain the number of rows affected by the SQL statement. </p>
|
|
<p>If the SQL statement
|
|
is a Positioned UPDATE or DELETE, it is necessary to use a <em>cursor</em>.
|
|
A cursor is a moveable pointer to a row in the result table of a SELECT statement.
|
|
In embedded SQL, cursors are used to retrieve, update or delete rows. When
|
|
using DB2<sup>®</sup> UDB
|
|
CLI, it is not necessary to define a cursor, because one is generated automatically.</p>
|
|
<p>In the case of Positioned UPDATE or DELETE statements, you need to specify
|
|
the name of the cursor within the SQL statement. You can either define your
|
|
own cursor name using <samp class="codeph">SQLSetCursorName()</samp>, or query the name
|
|
of the generated cursor using <samp class="codeph">SQLGetCursorName()</samp>. It is best
|
|
to use the generated name, because all error messages refer to this name,
|
|
and not the one defined by <samp class="codeph">SQLSetCursorName()</samp>.</p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzadpprocessresults.htm">Processing results in a DB2 UDB CLI application</a></div>
|
|
</div>
|
|
<div class="relref"><strong>Related reference</strong><br />
|
|
<div><a href="rzadpfnnrcol.htm">SQLNumResultCols - Get number of result columns</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |