Sponsored Content
Top Forums Shell Programming and Scripting problem in reading a record from the file Post 302335079 by ranjithpr on Friday 17th of July 2009 07:42:06 AM
Old 07-17-2009
some space missing

Code:
if [[ $a = '01' ]] ; then
echo "select * from trd.trd_categroy where ctreadcomp='$a' withur;" > sql.out
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help me ...problem in reading a file

hi, while reading a file line by line # name of the script is scriptrd while read line do echo $line done while executing bash$ ./scriptrd if i give the input as * the output is like it displays the contents of the current directory i jus wanted it to print as * (6 Replies)
Discussion started by: brkavi_in
6 Replies

2. Shell Programming and Scripting

problem in reading a file

i need to read record by record i use script #!/bin/ksh for i in 'cat filename' do echo $1 done but i dont get expected result i just get filename echoed on screen (4 Replies)
Discussion started by: er_zeeshan05
4 Replies

3. Shell Programming and Scripting

While loop reading a record

Hi, I am trying to create a while loop that will do the following: INFILE= list of new records that need to be added after last previous record while read record do find the last record processed create list of new records output to a file echo "$record">> $NEWFILE done ... (9 Replies)
Discussion started by: shortyball24
9 Replies

4. Shell Programming and Scripting

Problem with reading from a properties file

Hi, i have a properties file a.prop where entry is like PROCESS_IDX=0 Now in my shell schript i am doing like this. #!/bin/sh . a.prop .............. -....................... while read line do # tokenize the string by ",". var=(`echo $line | tr ',' ' '`) echo $PROCESS_IDX -->... (6 Replies)
Discussion started by: sailaja_80
6 Replies

5. Shell Programming and Scripting

Problem in reading a file content

Hi, I am reading a file line by line using read line function of while loop. Each line contains 4 fields. I want to take these 4 values in 4 variables in each iteration so that i can use them in my script. The issue here is that my awk command is returning awkward results - Here is a sample line... (8 Replies)
Discussion started by: garman
8 Replies

6. Shell Programming and Scripting

Problem in reading a file

Hi Guys, I am having a file which does not have any name when i do a ls -l -rw-r--r-- 1 dctrdat1 dctrdata 35 Feb 09 08:04 -rw-r--r-- 1 dctrdat1 dctrdata 11961 Feb 08 06:40 DAI_data.txt Now i want to see what is inside that file. Can you please let me know how to read... (9 Replies)
Discussion started by: mac4rfree
9 Replies

7. Shell Programming and Scripting

Reading a file (one record) in a SHL script

I am trying to read a file in a shl script (only one record) and stored in a variable file_number I got the following read -u $BANNER_HOME/xxxxxxx/misc/EFTSQL.dat file_number file_number2 = $file_number + 1 echo $file_number2 > $BANNER_HOME/xxxxxx/misc/EFTSQL.dat EOF It is not working... (2 Replies)
Discussion started by: rechever
2 Replies

8. Shell Programming and Scripting

Problem in reading file (bash)

i get a name from user first name : last name, in this format. Now i am saving this to a file. what i want is, I do not want to save any name if I already have one entry o that same name..what should i do for example user give robert fernandez this will save in file as robert:fernandez. if... (5 Replies)
Discussion started by: Learnerabc
5 Replies

9. Shell Programming and Scripting

filter record from a file reading another file

Hi, I want to filter record from a file if the records in the second column matches the data in another file. I tried the below awk command but it filters the records in the filter file. I want the opposite, to include only the records in the filter file. I tried this: awk -F'|'... (8 Replies)
Discussion started by: gpaulose
8 Replies

10. UNIX for Dummies Questions & Answers

Reading only first record from the multipe directories

Hi All, I have a requirement, I had a parent directory Land under that we have sub directories Yesterday, Today and Tommorrow And we have a file test.txt under the above directories Yesterday, Today and Tommorrow The data in the file test.txt under Yesterday folder is ... (5 Replies)
Discussion started by: somu_june
5 Replies
MAXDB_PREPARE(3)							 1							  MAXDB_PREPARE(3)

maxdb_prepare - Prepare an SQL statement for execution

       Procedural style

SYNOPSIS
resource maxdb_prepare (resource $link, string $query) DESCRIPTION
Object oriented style maxdb_stmt maxdb::prepare (string $query) maxdb_prepare(3) prepares the SQL query pointed to by the null-terminated string query, and returns a statement handle to be used for fur- ther operations on the statement. The query must consist of a single SQL statement. Note You should not add a terminating semicolon or g to the statement. The parameter $query can include one or more parameter markers in the SQL statement by embedding question mark ( ?) characters at the appropriate positions. Note The markers are legal only in certain places in SQL statements. For example, they are allowed in the VALUES() list of an INSERT statement (to specify column values for a row), or in a comparison with a column in a WHERE clause to specify a comparison value. However, they are not allowed for identifiers (such as table or column names), in the select list that names the columns to be returned by a SELECT statement), or to specify both operands of a binary operator such as the = equal sign. The latter restriction is necessary because it would be impossible to determine the parameter type. In general, parameters are legal only in Data Manipula- tion Languange (DML) statements, and not in Data Defination Language (DDL) statements. The parameter markers must be bound to application variables using maxdb_stmt_bind_param(3) and/or maxdb_stmt_bind_result(3) before exe- cuting the statement or fetching rows. RETURN VALUES
maxdb_prepare(3) returns a statement resource or FALSE if an error occurred. EXAMPLES
Example #1 Object oriented style <?php $maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $city = "Rosemont"; /* create a prepared statement */ if ($stmt = $maxdb->prepare("SELECT state FROM hotel.city WHERE name=?")) { /* bind parameters for markers */ $stmt->bind_param("s", $city); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($district); /* fetch value */ $stmt->fetch(); printf("%s is in district %s ", $city, $district); /* close statement */ $stmt->close(); } /* close connection */ $maxdb->close(); ?> Example #2 Procedural style <?php $link = maxdb_connect("localhost", "MONA", "RED", "DEMODB"); /* check connection */ if (maxdb_connect_errno()) { printf("Connect failed: %s ", maxdb_connect_error()); exit(); } $city = "Rosemont"; /* create a prepared statement */ if ($stmt = maxdb_prepare($link, "SELECT state FROM hotel.city WHERE name=?")) { /* bind parameters for markers */ maxdb_stmt_bind_param($stmt, "s", $city); /* execute query */ maxdb_stmt_execute($stmt); /* bind result variables */ maxdb_stmt_bind_result($stmt, $district); /* fetch value */ maxdb_stmt_fetch($stmt); printf("%s is in district %s ", $city, $district); /* close statement */ maxdb_stmt_close($stmt); } /* close connection */ maxdb_close($link); ?> The above example will output something similar to: Rosemont is in district IL SEE ALSO
maxdb_stmt_execute(3), maxdb_stmt_fetch(3), maxdb_stmt_bind_param(3), maxdb_stmt_bind_result(3), maxdb_stmt_close(3). PHP Documentation Group MAXDB_PREPARE(3)
All times are GMT -4. The time now is 11:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy