So you want to create a Concurrent Program that will run some code on the environment your application is installed on? OK but you also want to use the environment variables that are setup. Seems reasonable. Well I ran into a problem when trying to build a string and then run it.
I have a table that I store various commands related to an object. For this example say I want to use FNDLOAD to upload or download a concurrent program I would use something like this:FNDLOAD apps/$APPLPWD 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct ./MY_CONC.ldt PROGRAM APPLICATION_SHORT_NAME=XXX CONCURRENT_PROGRAM_NAME=MY_CONC
So far makes sense but if I want to automate this and seeing as FNDLOAD is pretty standard with its layout i placed the data into the table and made some fields that I change using replace. Not that important but when running the program using a HOST concurrent I was running into trouble. All the fields can be setup using replace except for the apps password that you can see here as $APPLPWD. Not a problem I thought I would just use variable 1 of the HOST program as this is what it is there for.
set line 1000 heading off TAB OFF
select xds_cust_obj_pkg.get_compile_command($P_OBJECT_ID) from dual;
echo "Compile:" $P_COMPILE_COMMAND
What I would normally do here is a simple echo `$P_COMPILE_COMMAND`
For the life of me it just wouldn't work, the parameter within the parameter just wasn't being executed or converted.
I called our DBA Arty Borulia and he came to the rescue:
eval `echo $P_COMPILE_COMMAND`