Difference between revisions of "SQLCNT"

From Recital Documentation Wiki
Jump to: navigation, search
 
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
=SQLCNT=
 
 
 
==Class==
 
Pseudo Columns
 
 
 
 
==Purpose==
 
==Purpose==
 
Return the number of rows affected by the last SQL statement
 
Return the number of rows affected by the last SQL statement
Line 19: Line 12:
  
 
==Description==
 
==Description==
A Pseudo Column behaves like a table column, but is not actually stored in the table. You can select from Pseudo Columns, but they cannot be updated.  Pseudo Columns provide extra information about a SELECT row set.
+
SQLCNT will return the number of rows affected by the last SQL statement.  For example, after a SELECT statement, SQLCNT will contain the number of rows selected.
 
+
The SQLCNT Pseudo Column will return the number of rows affected by the last SQL statement.  For example, after a SELECT statement, SQLCNT will contain the number of rows selected.
+
  
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
// Display all overdue accounts with 15% commission in
+
OPEN DATABASE southwind
// Sorted "name" and "paid date" order with the row number.
+
SELECT * FROM example WHERE state = "MA"
EXEC SQL
+
? sqlcnt
SELECT ROWNUM, name, address, balance, cost*1.15
+
        17
FROM accounts
+
WHERE paid_date < date()
+
ORDER BY name, paid_date;
+
// Check return code and number of rows returned
+
EXEC SQL
+
SELECT DISTINCT sqlcode, sqlcnt from accounts;
+
 
</code>
 
</code>
  
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]
 
[[Category:Pseudo Columns]]
 
[[Category:Pseudo Columns]]

Latest revision as of 14:51, 5 July 2011

Purpose

Return the number of rows affected by the last SQL statement


Syntax

SQLCNT


See Also

PSEUDO COLUMNS, INSERT, SELECT, UPDATE


Description

SQLCNT will return the number of rows affected by the last SQL statement. For example, after a SELECT statement, SQLCNT will contain the number of rows selected.


Example

OPEN DATABASE southwind
SELECT * FROM example WHERE state = "MA"
? sqlcnt
        17


Products

Recital, Recital Server