Hi,

--- Jensen Kenneth B SrA AFPC/DPDMPQ <[EMAIL PROTECTED]> 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
> 
> #!perl -w
> use strict;
> use warnings;
> 
> my ($TABLENAME, $VIEWNAME) = (shift,shift);
> 
> system('sqlplus / << 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
> ');
> __END__
> 
> The above will execute, but no rows will be selected because the variables
> are treated as null. I tried declaring the variables globally but still the
> same problem. I also tried to pass the variables to the system call (system
> (), ($TABLENAME, $VIEWNAME);) But couldn't get that to work either. $_[0]
> was read as "scriptname[0]"..
> 
> I can insert a print statement inside the system call and print the
> variables to STDOUT, but can't get sql to use them. Am I missing something
> blatantly obvious? Any help very much appreciated.


>From what I can see, yes...... use double-quotes, not single-quotes.  Single
quotes will not expand varables.  See 'perldoc -q quote'

-JW


> Ken
> 
> P.S. I only have modules distributed with perl 5.6.1, and I am not allowed
> to install any new ones at the present time.


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to