unix script to establish a connection to oracle database from unix shell

how to assign the output value of an sql querry to variables in unix