Hi, This post shows you the sample script to run SQL query from host file in Oracle Apps.
In the below example, I used a query to fetch the directory path.
#!/bin/ksh
#----- Standard Parameters: -----#
p_apps_passwd=`echo ${1}`
p_user_id=`echo ${2}`
p_username=`echo ${3}`
p_request_id=`echo ${4}`
target_path=/u01/apps/apps_st/appl/jtm/12.0.0
p_file_directory() #Directory Path
{
sqlplus -s ${p_apps_passwd} << EOF #Starts from here
WHENEVER SQLERROR EXIT SQL.SQLCODE;
SET LINES 255
SET PAGES 0
SET FEEDBACK OFF
SET ECHO OFF
SET PAGESIZE 0
SET TIMING OFF
SET SERVEROUTPUT ON
SET TERM ON
SELECT file_path FROM request_table; #sample query
EOF
}
echo "Directory Path: $p_file_directory" #Printing directory path
# - Represents comments
Hope this helps for beginners. Great learning ahead!!