dear monks, is there a way to parse perl variable defined in config file which in turn is the sql statement that is read in a file-handle and assigned to the variable which is further executed via a db-handle.
To elaborate further....
1) suppose here is the config file say test_query.sql
test_query.sql contains below. The variable $schema & $name are further defined in the master config file that is read separately.
select * from $schema.app_table where col1 = $name
2) my main perl script will read this file into a filehandler and assign to a variable that will be further passed to db-handler
open SQLFILE, $sqlFile or die "Cannot open file $sqlFile : $!\n";
$sqlRef = <SQLFILE>;
$sth =$dbh ->prepare($sqlRef);
$sth -> execute();
3) The issue here is i see below error at the prepare call as the perl-variable is not evaluated
:: DBD::Oracle::db prepare failed: ORA-00911: invalid character (DBD E
+RROR: error possibly near <*> indicator at char (<*>$schema.app_table
+)
4) Kindly help me point to right direction on how to go about evaluating the variable from config file.
Let me know if you need more information ?
Thanks in advance!!