Segmentation fault in function call, shell script

I am getting Segmentation fault at below function call in my script:

get_x() {

sqlplus -s / <<end | grep KEEP | sed 's/KEEP//;s/[   ]//g'
select 'KEEP' ,table_name from all_synonyms where upper(synonym_name)= '$1';
exit
end

x=$(get_x $1)
echo " SQL OUTPUT IS :: $x"
}

I am getting output of the sqlplus but it is not getting stored in variable "x".

If you are experiencing a segmentation fault, the error is not in your script; there is a memory management bug in one of your tools (shell, application, c library, or kernel). This does not preclude an actual error in your script, but any such error is not the source of a segmentation fault.

Regards,
Alister

P.S. Please use code tags for code and data. Welcome to the forum.