comparing the null values in the unix

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting comparing the null values in the unix
# 1  
Old 02-11-2008
comparing the null values in the unix

hi all,

iam new to this forum.i have to submit the script please help me.

my requirement is to compare two null values..iam trying to compare two null values :One null value output of the storedprocedure and another iam giving spaces in script.

it is giving the error line 215: [: =: unary operator expected

Thanx in Advance.
# 2  
Old 02-11-2008
Not sure why compare null values!


Not sure why you are trying to compare null values. Smilie

I would suggest, you create a function & make it return "0" if success.
Then you can check for "ZERO" instead of any other value.

Hope this helps Smilie
# 3  
Old 02-11-2008
comparing the null values in the unix

its a client requirement.already all the stored procedures are created iam using those stored procedures.the return value is used some where else in the script if it retuns not a null value
# 4  
Old 02-11-2008
Plz give more info on script...

Would like to see the script & place where error is coming...

# 5  
Old 02-11-2008

I assume that its a oracle stored procedure, can you clarify the following points?

How can a stored procedure return any value? u mean to say tat ur using an OUT parameter and u wanna check whether it contains null value?

Is it possible to post ur script and specify ur requirement?
# 6  
Old 02-11-2008
This was the procedure declaration in unix script

#connecting to oracle database and inserting a row into btch_ctrl and getting the sequence value and
#storing it into the variable VALUE
VALUE=`sqlplus -silent $DbUserName/$DbPassword@$DbSchema <<END >$PathOfTempLstFile/TrdAcctSqlLog
set serveroutput on
set pagesize 0
set feedback off
set verify off
set heading off
set echo off
variable Acct_id varchar2;
variable curr_cfdc_parm_typ_cd number;
variable curr_org_id number;
exec dtstg.lkp_trd_acct_prc('$1','$2',$3,$4,$5,$6,:Acct_id,:curr_cfdc_parm_typ_cd,:curr_org_id);
print :Acct_id;

This was the call of storedproc

Lkp_Trd_Acct $NewAcctNbr_Lk $TrNbr_Lkp $Cty_Geo_Ref_Id_Us $BatchID 0 $CD_VAL_ID_PRCS_STEP_LOD_TRD_ACCT

it will stored this value in log
AcctID=`cut -f1 $PathOfTempLstFile/TrdAcctSqlLog

iam storing the return value into the variable AcctID.

then i am comparing that value with the null

if [ AcctID = " "]--- iam getting the error in this line
exit 0
# 7  
Old 02-11-2008
Need some more info..

(1) Check the value of "Acct_id" in procedure: dtstg.lkp_trd_acct_prc.
This is stored in your log $PathOfTempLstFile/TrdAcctSqlLog

exec dtstg.lkp_trd_acct_prc('$1','$2',$3,$4,$5,$6,:Acct_id,:curr_cfdc_parm_typ_cd,:curr_org_id);
print :Acct_id;

(2) Echo value of $AcctID after the below statement

AcctID=`cut -f1 $PathOfTempLstFile/TrdAcctSqlLog`
echo $AcctID

(3) Need to change the below.. you need to use $AcctID & based on
point(1) you need to change the condition

if [ AcctID = " "]--- iam getting the error in this line

Hope this helps Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace null values in csv with zero

Hi, i have another issue: i have three files: FILE 1 ServiceEventHandler, Processed,Percentage 5285337,100% FILE 2 Wallet, Processed,Percentage 5285337,100% (1 Reply)
Discussion started by: reignangel2003
1 Replies

2. Shell Programming and Scripting

Check null values column

hi, I had a small question.I had a file from which i need to extract data. I have written the below script to check if the file exists and if it exists extract requierd columns from the file. IFILE=/home/home01/Report_1.csv OFILE=/home/home01/name.csv.out1 if #Checks if file exists... (1 Reply)
Discussion started by: Vivekit82
1 Replies

3. Shell Programming and Scripting

Handle null values-awk

I am using below code to validate the source file,code working fine but if any column contains null value then below code throwing error actually it should to customize the below code to handle null null values also. When I run the script with below source data getting “date error”, as... (2 Replies)
Discussion started by: srivalli
2 Replies

4. Shell Programming and Scripting

Check for null values in columns

Hi , I have below data with fixed with of 52 bytes having three columns value data. 01930 MA GLOUCESTER 02033 02025 COHASSET 01960 MA ... (3 Replies)
Discussion started by: sonu_pal
3 Replies

5. Shell Programming and Scripting

How to use sort with null values?

Hello everyone I am doing a join command. Obviously, before I need two files sorted first. ( Both files have headers and have about 2 million lines each one ) The problem is, one of the files has null values in the key to sort (which is the first filed ). For example I have the original... (4 Replies)
Discussion started by: viktor1985
4 Replies

6. Shell Programming and Scripting

sorting null values

Hi I have a file with the values abc res set kls lmn ops i want to sort this file with the null values at the bottom of the file OUTPUT should look like this abc kls lmn ops (6 Replies)
Discussion started by: vickyhere
6 Replies

7. UNIX for Advanced & Expert Users

How to Compare Null values??

Hi, Can someone help me comparing Null values. Scenario is as follows: I have a variable which "cache_prd" which can have either some integer or nothing(Null) if it is integer I have to again do some comparision but these comparisons give me this error:( "line 32: [: 95: unary operator... (3 Replies)
Discussion started by: Yagami
3 Replies

8. UNIX for Dummies Questions & Answers

Check for null values in a column

Hi All, I have a file with 10 columns and get the required data for nine columns properly except 8th. In 8th column i have both NULL and NON NULL values...i.e certain records have values for all the columns including 8th column and certain records have 8th column as NULL.My requisite is,without... (20 Replies)
Discussion started by: ganesh_248
20 Replies

9. Shell Programming and Scripting

identifying null values in a file

I have a huge file with 20 fileds in each record and each field is seperated by "|". If i want to get all the reocrds that have 18th or for that matter any filed as null how can i do it? Please let me know (3 Replies)
Discussion started by: dsravan
3 Replies

10. Shell Programming and Scripting

handling null values in files

Hi , I have a script where i will remove header and trailer record and ftp to another server. I'm using the code: latestfilename=`ls filename_* | tail -1` echo "Latest filename = $latestfilename" sed '1d;$d' $latestfilename > a.ftpedfile I have an issue if input data is having null... (1 Reply)
Discussion started by: ammu
1 Replies
Login or Register to Ask a Question

Featured Tech Videos