Hi
I want to connect to the Oracle database using a username/password and get back the query result(a numeric value) in a variable, which I can then compare using a conditional.
Can anybody help me with this.
Thanks
Gaurav
Hi
I want to connect to the Oracle database using a username/password and get back the query result(a numeric value) in a variable, which I can then compare using a conditional.
Can anybody help me with this.
Thanks
Gaurav
Try:
var=$(sqlplus -s username/password@datbase_connect_string @abc.sql)
Thanks Dennis
I tried this snippet, it worked:
RESULT=`sqlplus -s <<!
${USER}/${PASSWORD}@${DSQUERY}
select WO_STAT from tbl_wrk_ord where WO_ID='756843658';
!`
echo $RESULT
Output:
WO_STAT ---------- 104
Is there any way I can get only the value of "104" and not the column header in RESULT?
Try:
RESULT=`sqlplus -s <<!
${USER}/${PASSWORD}@${DSQUERY}
SET FEEDBACK OFF;
SET HEADING OFF;
select WO_STAT from tbl_wrk_ord where WO_ID='756843658';
!`
Thanks Dennis, it worked perfect !!