Jensen Kenneth B SrA AFPC/DPDMPQ wrote: > I can't install the DBI modules to talk to our database, so I am trying to > run some commands from a system call. I am trying to pass some variables > retrieved from command line arguments to the sql statements. Here's my > problem, I can't get the variables to expand for use in the sql code
A stepwise approach might help here--see inline > #!perl -w > use strict; > use warnings; > > my ($TABLENAME, $VIEWNAME) = (shift,shift); > > my $system_call =<<SQLEOF > set heading off > set linesize 120 > > spool viewdata.kj > select table_name,column_name,data_length,data_type from dba_tab_columns > where table_name = \'$VIEWNAME\' > and owner = 'XXXX'; > > spool tabdata.kj > select table_name,column_name,data_length,data_type from dba_tab_columns > where table_name = \'$TABLENAME\' > and owner = 'XXXX'; > SQLEOF > '); system ($system_call); The problem was the single quotes around the entire heredoc. For one thing, they shouldn't be neccesary. In an appropriate context, Perl interprets the <<HERE HERE as a multiline quote. No other quoting operator should be needed for the SQL as a whole. For another, as others have pointed out, they prevent variabvle interpolation. The qx operator you chose should also work well for this. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]