"There was an error or 0 rows updated" I am getting this . But 3 rows were updated in the sql , so I should have gotten the second output with counts of rows updated (i.e. 3)
No you shouldn't.
Your shell script is working just like you have programmed it. Because 3 rows were updated, the test $error_exit not equal to 0 is TRUE:
and hence you are seeing the output you have programmed.
How do I create a K Shell which would silently (without user input) logon to Oracle and
run an SQL script?
Any help will be greatly appreciated.
Steve (1 Reply)
Hi,
In my shell script when I am using mv command using shell variables it is giving me error of syntax. Following is the shell script:
file_edifice="*.txt"
fquote="'"
fdquote=\"
for file in $file_edifice
do
file_name=$fquote$file$fquote
tofile_name=`date... (5 Replies)
Hi all,
I need a shell script which runs a sql script but I couldn't find how to finish it. This is the code that I have:
#! /usr/bin/ksh
export SHELL=/bin/ksh
export ORACLE_SID=database
export ORACLE_HOME=/opt/oracle/product/9.2.0.8
sqlplus user <<EOF @/path/path/path/scriptname.sql... (3 Replies)
Hi,
My script is running with no erros but not giving any output can anyonehelp.
#!/bin/ksh
. /home/application/bin/application.env
OUTFILE=Result.txt
PROD_PASSWORD=`${GET_PWD} -f ${PWD_FILE_PATH} -s ${PROD_SERVER} -u ${PROD_USER}`
echo "1)To get the book last loaded details "
read... (7 Replies)
HI,
I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging.
here is the core of the script
CFG_FILE=tab25.cfg
sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c
do
#echo "jobs output"
#jobs
#echo "jobs... (13 Replies)
Hi All,
Is there any way to monitor a command inside shell script ? I have a script inside which I have a tar command which zips around 200GB data.
tar zcvf $Bckp_Dir/$Box-BaseBackup-$Day.tar.gz * --exclude 'dbserver_logs/*' --exclude postmaster.pid --exclude 'pg_xlog/*'
I want to... (3 Replies)
Hi, I'm new to these forums, and I'm hoping that someone can solve this problem...
To make things short:
I have DD-wrt set up on a router.
I'm trying to run a script in CRON that fetches the daily password from my database using SSH.
CRON is set like so(in web interface):
* * * *... (4 Replies)
OS version : AIX 6.1
Shell : Korn
When you 'postfix' a command with ampersand (&) , it is supposed to run in the background and give you back the control.
I tested this with ping command (by default it pings every 1 second )
After I ran the below ping command with ampersand, I pressed... (3 Replies)
hii,,
I am trying to automate jira. during my scripting using bash script, in the terminal i got the terminal message like this:
"Configure which ports JIRA will use.
JIRA requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you... (1 Reply)
Hi,
i have a source file and have 3 columns and separated by "|" .i want to split this 3 columns in different variable.When i am executing this values indivisually giving correct result but when the same execute inside a for loop,it's giving issues.
Src file(jjj.txt)
-------... (8 Replies)
Discussion started by: raju2016
8 Replies
LEARN ABOUT PHP
sqlsrv_rows_affected
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 executedSYNOPSIS
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)