Output number of rows inserted, updated...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Output number of rows inserted, updated...
# 1  
Old 01-30-2008
MySQL Output number of rows inserted, updated...

Hi all,
I am new to Unix.

I have written pl/sql script to be run in Unix.
I have used Merge statement and subsequently would like to know the number of rows updated or inserted.

Any suggestions in this regard would be great

Thanks in advance
Kushal
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare two and write updated output in third file

Hi Linux Experts. I have a requirement where i need to update the thousands of table definitions to extend the column length and character set therefore i am looking for some sort of linux script which i can use to update the length and chacterset. I have two files In first file i have 7... (1 Reply)
Discussion started by: Black-Linux
1 Replies

2. Shell Programming and Scripting

Number of rows loaded via sqlldr

Hi all, I'm loading data in database through sqlldr. I want to know the total record count And the number of records inserted in table.. what is the logic to achieve that. Thanks (5 Replies)
Discussion started by: Pratiksha Mehra
5 Replies

3. Shell Programming and Scripting

Comparing two files to get only records to be inserted and updated

Hello all, Please help me for a script that compares two files and reads only those records that are to be inserted and updated. File1: c_id name place contact_no 1 abc xyz 34567 10 efg uvw 82725 6 hjk wth 01823 2 iuy ... (4 Replies)
Discussion started by: T@ni@
4 Replies

4. Shell Programming and Scripting

extracting number of rows

if > wc -l data.txt > 100 (meaning there are 100 rows) i want to assgn 100 as n so that if i do >echo n it would give me 100 Thanks (5 Replies)
Discussion started by: johnkim0806
5 Replies

5. Shell Programming and Scripting

awk number rows from 1 to 3 in file

I have a file with the following format, i need to change de field9 each 3 rows to renumber field9 with gpo1, gpo2, gpo3. I need to use awk Original file field1 field2 field3 field4 field5 field6 field7 field8 gpo3 field1 field2 field3 field4 field5 ... (3 Replies)
Discussion started by: robonet
3 Replies

6. Shell Programming and Scripting

how to add the number of row and count number of rows

Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count The input file: 21 2341 A 21 2341 A 21 2341 A 21 2341 C 21 2341 C 21 2341 C 21 2341 C 21 4567 A 21 4567 A 21 4567 C ... (6 Replies)
Discussion started by: juelillo
6 Replies

7. UNIX for Dummies Questions & Answers

how to capture no. of rows updated in update sql in unix db2

hi, i am a new user in unix..and we have unix db2. i want to capture the no. of rows updated by a update db2 sql statement and redirect into a log file. I've seen db2 -m...but not sure how the syntax should be. The update sql that I'm going to run is from a file... Can you please share... (1 Reply)
Discussion started by: j_rymbei
1 Replies

8. Shell Programming and Scripting

Diff Command to return the number of lines inserted,deleted and changed.

Hello, I have to compare two files file1 and file2, retrieve the number of lines modified (added, deleted or modified) in file2. Output must be like: File2: Added Deleted Changed Total ------ ------- -------- ----- 2 1 1 4 Somebody... (2 Replies)
Discussion started by: nmattam
2 Replies

9. Shell Programming and Scripting

How can i extarct the output from a file which has been updated from last half an hou

hi, I have a log file , which is appending with current data i need the extarct which is updated from last 30 minutes the format of the date is Jun 18, 2008 8:59:18 AM how can i subtract 30 mins from the current date thanks Tarun. (5 Replies)
Discussion started by: tarundeepdhawan
5 Replies

10. Shell Programming and Scripting

return number of rows selected

Hi all, i am doing a perl script to read from a db. I am able to retrieve the rows, but i am unable to return the number of rows selected. i tried $selectedrows = $sth->numrows; i got the error msg: Can't locate object method "numrows" via package "DBI::st" i changed it to $selectedrows =... (7 Replies)
Discussion started by: new2ss
7 Replies
Login or Register to Ask a Question
SQLSRV_ROWS_AFFECTED(3) 												   SQLSRV_ROWS_AFFECTED(3)

sqlsrv_rows_affected - Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed

SYNOPSIS
int sqlsrv_rows_affected (resource $stmt) DESCRIPTION
Returns the number of rows modified by the last INSERT, UPDATE, or DELETE query executed. For information about the number of rows returned by a SELECT query, see sqlsrv_num_rows(3). PARAMETERS
o $stmt - The executed statement resource for which the number of affected rows is returned. RETURN VALUES
Returns the number of rows affected by the last INSERT, UPDATE, or DELETE query. If no rows were affected, 0 is returned. If the number of affected rows cannot be determined, -1 is returned. If an error occurred, FALSE is returned. EXAMPLES
Example #1 sqlsrv_rows_affected(3) example <?php $serverName = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" ); $conn = sqlsrv_connect( $serverName, $connectionInfo); if( $conn === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "UPDATE Table_1 SET data = ? WHERE id = ?"; $params = array("updated data", 1); $stmt = sqlsrv_query( $conn, $sql, $params); $rows_affected = sqlsrv_rows_affected( $stmt); if( $rows_affected === false) { die( print_r( sqlsrv_errors(), true)); } elseif( $rows_affected == -1) { echo "No information available.<br />"; } else { echo $rows_affected." rows were updated.<br />"; } ?> SEE ALSO
sqlsrv_num_rows(3). PHP Documentation Group SQLSRV_ROWS_AFFECTED(3)