04-27-2009
Input is text file not a single statement
Thanks for quick reply..but,
My SQL statement is not on a single line. I am reading from a file say .txt which has many other statement apart from 'select'.
Say my file source.txt is like:
Update table
-----
----;
select --- from tablexx;
Delete from table1
----
---;
select from tablexy;
Then the output shud be like:
"select --- from tablexx;"
"select --- from tablexy;"
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I am trying something like this: Let's say I have a file called File1 with contents:
x=-0.3
y=2.1
z=9.0
I have another file, File2, with contents:
xx=
yy=
zz=
(nothing after "="). What I want to do is get the value of x in File1 and set it to xx in File2, i.e., xx=-0.3. And the... (3 Replies)
Discussion started by: ommatidia
3 Replies
2. Shell Programming and Scripting
script is as below
v_process_run=5
typeset -i p_cnt=0
pdata=/home/proc_data.log
while
do
# execute script in background
dummy_test.sh "a1" "a2" &
p_cnt=$p_cnt+1
echo "data : $p_cnt : Y" >> $pdata
done
file created with following data in... (1 Reply)
Discussion started by: Vrgurav
1 Replies
3. UNIX for Dummies Questions & Answers
I have a text file with following content (3 lines)
filename : output.txt
first line:12/12/2008
second line:12/12/2008
third line:Y
I would like to know how we can replace 'Y' with 'N' in the 3rd line keeping 1st and 2nd lines same as what it was before.
I tried using cat output.txt... (4 Replies)
Discussion started by: santosham
4 Replies
4. UNIX for Dummies Questions & Answers
i am very new to UNIX
plz help me in this scenario
i have two text files as below
file1.txt
name=Rajakumar.
Discipline=Electronics and communication.
Designation=software Engineer.
file2.txt
name=Kannan.
Discipline=Mechanical.
Designation=CADD Design Engineer.
... (6 Replies)
Discussion started by: kkraja
6 Replies
5. Shell Programming and Scripting
hello all
greeting for the day
i have a text file as the following
text.xml
abcd<FIELD>123.456</FIELD>efgh
i need to replace the value between <FIELD> and </FIELD> by using awk command.
please throw some light on this.
thank you very very much
Erik (5 Replies)
Discussion started by: erikshek
5 Replies
6. Shell Programming and Scripting
Hi There...
I need to serach and replace a strings in a text file.
My file has; books.amazon='Let me read' and the output needed is
books.amazon=NONFOUND
pls if anybody know this can be done in script sed or awk.. i have a list of different strings to be repced by NONFOUND.... (7 Replies)
Discussion started by: Hiano
7 Replies
7. Emergency UNIX and Linux Support
Hi,
I have gigabytes of text files that I need to search for "&" and replace with "&". Is there a way to do this efficiently (like sed command)?
Hope you could help.
Thanks. (17 Replies)
Discussion started by: daytripper1021
17 Replies
8. Shell Programming and Scripting
Hi
I am new to unix and newbie to this forum. I need help in writing a gawk script that search and replace particular text in a flat file.
Input file text :
ZIDE_CONTROL000 100000000003869920900000300000001ISYNC 000002225489 0000000002232122 20120321 16:40:53
ZIDE_RECORD000... (5 Replies)
Discussion started by: gkausmel
5 Replies
9. Shell Programming and Scripting
Hello,
Some time ago a helpful awk file was provided on the forum which I give below:
NR==FNR{A=$0;next}{for(j in A){split(A,P,"=");for(i=1;i<=NF;i++){if($i==P){$i=P}}}}1
While it works beautifully on English and Latin characters i.e. within the ASCII range of 127, the moment a character beyond... (6 Replies)
Discussion started by: gimley
6 Replies
10. Shell Programming and Scripting
Hi there,
First of all this is my first post here. Thank you in advance for your help.
What I am trying to do is the following. I have a text file where each field of each row is separated by a tabulator.
Looks like this:
ATOM 1 N HSE A 26 3.033 -10.429 -2.262 1.00 17.07 ... (8 Replies)
Discussion started by: doom4
8 Replies
LEARN ABOUT PHP
db2_num_rows
DB2_NUM_ROWS(3) 1 DB2_NUM_ROWS(3)
db2_num_rows - Returns the number of rows affected by an SQL statement
SYNOPSIS
int db2_num_rows (resource $stmt)
DESCRIPTION
Returns the number of rows deleted, inserted, or updated by an SQL statement.
To determine the number of rows that will be returned by a SELECT statement, issue SELECT COUNT(*) with the same predicates as your
intended SELECT statement and retrieve the value.
If your application logic checks the number of rows returned by a SELECT statement and branches if the number of rows is 0, consider modi-
fying your application to attempt to return the first row with one of db2_fetch_assoc(3), db2_fetch_both(3), db2_fetch_array(3), or
db2_fetch_row(3), and branch if the fetch function returns FALSE.
Note
If you issue a SELECT statement using a scrollable cursor, db2_num_rows(3) returns the number of rows returned by the SELECT state-
ment. However, the overhead associated with scrollable cursors significantly degrades the performance of your application, so if
this is the only reason you are considering using scrollable cursors, you should use a forward-only cursor and either call SELECT
COUNT(*) or rely on the boolean return value of the fetch functions to achieve the equivalent functionality with much better perfor-
mance.
PARAMETERS
o $stmt
- A valid stmt resource containing a result set.
RETURN VALUES
Returns the number of rows affected by the last SQL statement issued by the specified statement handle.
PHP Documentation Group DB2_NUM_ROWS(3)