Unix - Oracle DB Connect

Hello,

Returing to Unix scripts after a long while,
This might be a simple question for most of you ,
I need to connect from a .sh script to oracle, select XYZ.nextval from dual ,
, meaning either get the Current Val or Next Val for a sequence.

How do I store the return value , I know we can spool the file
but I need only the value like 34, 35...etc
Not the other connection info ...
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
NEXTVAL
----------
39
SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0

Can someone please Advice.

Thx

/home/oracle > X=$(sqlplus -s scott/tiger << !
set heading off
select 12345 from dual;
!)

echo X is $X
X is 12345

(replace "12345" with "sequence_name.nextval", of course!)

Thanks Scott,

You mean from the command prompt , will we be able to get the results using these steps in the .sh script ?

Thx

---------- Post updated at 03:03 PM ---------- Previous update was at 03:00 PM ----------

Sorry ,
Ignore my earlier email ,

Thx