Sponsored Content
Full Discussion: Error in Comparison value
Top Forums Shell Programming and Scripting Error in Comparison value Post 302769308 by Rushab on Tuesday 12th of February 2013 12:47:29 AM
Old 02-12-2013
Error in Comparison value

Hi I have written below Script
Code:
IFS=:
while read emp_id_ name manager department;
do echo "$emp_id_";
count=`sqlplus -s sys/orcl as sysdba << EOF
select count(*) from employee where emp_id = ('$emp_id_');
exit;
EOF`;
echo "$count" ;
if [ $count == 1 ] ; then echo "data exist" else echo "not exist" ; fi;
done < employee_data.txt

In employee_data file data as below:-
Code:
1:rushabh:4:IT

I employee table data is already there with emp_id = 1

now when I am comparing data its returning not exist
but it should return "data exist"

where is the problem in my script ?

please help me out from this problem?
thanks in advance

Last edited by Franklin52; 02-12-2013 at 03:10 AM.. Reason: Please use code tags for data and code samples
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

comparison

can anyone point me to a comparison of *nix file systems ? i think i prefer a journalling fs but i would like to see a comparison between several fs's before i make up my mind (2 Replies)
Discussion started by: cnf
2 Replies

2. UNIX for Dummies Questions & Answers

Unix comparison

I am very new to Unix. What are the similiarities and differences between ScoUnix and AIX5 if any? Where might i find the information? Which is better? (1 Reply)
Discussion started by: NewGuy100
1 Replies

3. Shell Programming and Scripting

Comparison error

My default shell is ksh. I'm making a simple comparison in a script. ... if then ... i keep getting the error " ] if if if I have also tried all of these with parentheses instead of brackets, nothing works. I know exists1 (I expect it to be 1 in my tests) is being set properly,... (2 Replies)
Discussion started by: lazerfoursix
2 Replies

4. Shell Programming and Scripting

need some help..Comparison

I need some help which would probably be for most of you a simple script. I need to read in the data from a .dat file and then compare avg to see who is the highest avg. Here is my script so far. #!/bin/ksh #reading in the data from lab3.dat filename=$1 while read name o1 o2 o3 o4 o5 o6... (0 Replies)
Discussion started by: bluesilo
0 Replies

5. Solaris

Error in String comparison

Hi, I am getting an error while executing the below code. The error is " then echo "string matches" fi Please help me to solve this error (3 Replies)
Discussion started by: sreedivia
3 Replies

6. Shell Programming and Scripting

$((...)) and $[...] comparison

Does $((mathematical expression)) and $ mean the same? (7 Replies)
Discussion started by: proactiveaditya
7 Replies

7. Shell Programming and Scripting

row Comparison

(5 Replies)
Discussion started by: number10
5 Replies

8. Shell Programming and Scripting

Error in if condition string comparison

Hello all! I need help in debugging following script. I have no idea where I am going wrong. #!/bin/bash for p1 in A1 TM MP do for p2 in A1 TM MP do for mp1 in N1 N2 do for mp2 in N1 N2 do for mp3 in N1 N2 do for mp4 in N1 N2 do for... (7 Replies)
Discussion started by: RLOA
7 Replies

9. UNIX for Dummies Questions & Answers

comparison

hi guys i need a program that can compare a value read from a com-port and one from the terminal. can somebody help me??? using linux kernel 2.6.14-M5 can only use standard function in sh and bash... (5 Replies)
Discussion started by: metal005
5 Replies

10. Shell Programming and Scripting

Help about comparison

Hello folks, I have two files, which have usernames, I want to see the contents of file1.txt which is missing in file2.txt and another comparison file2.txt contents which is missing in file1.txt. please suggest. file1.txt user u2 u8 a9 p9 p3 u4 z8 aaa ahe oktlo (7 Replies)
Discussion started by: learnbash
7 Replies
OCI_NEW_CONNECT(3)														OCI_NEW_CONNECT(3)

oci_new_connect - Connect to the Oracle server using a unique connection

SYNOPSIS
resource oci_new_connect (string $username, string $password, [string $connection_string], [string $character_set], [int $ses- sion_mode]) DESCRIPTION
Establishes a new connection to an Oracle server and logs on. Unlike oci_connect(3) and oci_pconnect(3), oci_new_connect(3) does not cache connections and will always return a brand-new freshly opened connection handle. This is useful if your application needs transactional isolation between two sets of queries. PARAMETERS
o $username - The Oracle user name. o $password - The password for $username. o $connection_string -Contains the Oracle instance to connect to. It can be an Easy Connect string, or a Connect Name from the tnsnames.ora file, or the name of a local Oracle instance. If not specified, PHP uses environment variables such as TWO_TASK (on Linux) or LOCAL (on Windows) and ORACLE_SID to determine the Oracle instance to connect to. To use the Easy Connect naming method, PHP must be linked with Oracle 10 g or greater Client libraries. The Easy Connect string for Oracle 10 g is of the form: [//]host_name[:port][/ser- vice_name]. From Oracle 11 g, the syntax is: [//]host_name[:port][/service_name][:server_type][/instance_name]. Service names can be found by running the Oracle utility lsnrctl status on the database server machine. The tnsnames.ora file can be in the Oracle Net search path, which includes $ORACLE_HOME/network/admin and /etc. Alternatively set TNS_ADMIN so that $TNS_ADMIN/tnsnames.ora is read. Make sure the web daemon has read access to the file. o $character_set -Determines the character set used by the Oracle Client libraries. The character set does not need to match the character set used by the database. If it doesn't match, Oracle will do its best to convert data to and from the database character set. Depending on the character sets this may not give usable results. Conversion also adds some time overhead. If not specified, the Oracle Client libraries determine a character set from the NLS_LANG environment variable. Passing this parameter can reduce the time taken to connect. o $session_mode -This parameter is available since version PHP 5 (PECL OCI8 1.1) and accepts the following values: OCI_DEFAULT, OCI_SYSOPER and OCI_SYSDBA. If either OCI_SYSOPER or OCI_SYSDBA were specified, this function will try to establish privileged connection using external credentials. Privileged connections are disabled by default. To enable them you need to set oci8.privileged_connect to On. PHP 5.3 (PECL OCI8 1.3.4) introduced the OCI_CRED_EXT mode value. This tells Oracle to use External or OS authentication, which must be configured in the database. The OCI_CRED_EXT flag can only be used with username of "/" and a empty password. oci8.privileged_connect may be On or Off. OCI_CRED_EXT may be combined with the OCI_SYSOPER or OCI_SYSDBA modes. OCI_CRED_EXT is not supported on Windows for security reasons. RETURN VALUES
Returns a connection identifier or FALSE on error. EXAMPLES
The following demonstrates how you can separate connections. Example #1 oci_new_connect(3) example <?php // create table mytab (mycol number); function query($name, $c) { echo "Querying $name "; $s = oci_parse($c, "select * from mytab"); oci_execute($s, OCI_NO_AUTO_COMMIT); $row = oci_fetch_array($s, OCI_ASSOC); if (!$row) { echo "No rows "; } else { do { foreach ($row as $item) echo $item . " "; echo " "; } while (($row = oci_fetch_array($s, OCI_ASSOC)) != false); } } $c1 = oci_connect("hr", "welcome", "localhost/orcl"); $c2 = oci_new_connect("hr", "welcome", "localhost/orcl"); $s = oci_parse($c1, "insert into mytab values(1234)"); oci_execute($s, OCI_NO_AUTO_COMMIT); query("basic connection", $c1); query("new connection", $c2); oci_commit($c1); query("new connection after commit", $c2); // Output is: // Querying basic connection // 1234 // Querying new connection // No rows // Querying new connection after commit // 1234 ?> See oci_connect(3) for further examples of parameter usage. SEE ALSO
oci_connect(3), oci_pconnect(3). PHP Documentation Group OCI_NEW_CONNECT(3)
All times are GMT -4. The time now is 05:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy