Usually most developers working with Oracle databases on UNIX platform would have some point in their "coding" life felt the need to read Oracle results into a shell variable.
Here is one of the many ways to accomplish this -
The below example required getting the directory path into a UNIX shell variable to perform some OS related maintenance operations.
DATA_PUMP_DIR="TEST_DIR"
DIR_PATH=`sqlplus -s ${DEST_DB_ADMIN}/${DEST_DB_ADMIN_PWD} <<EOF
set heading off
set pagesize 0
set feedback off
set verify off
select directory_path from dba_directories where directory_name='$DATA_PUMP_DIR';
exit;
EOF`
echo $DIR_PATH
No comments:
Post a Comment