Howdy: I have a script where I want to
* connect to database * create a subroutine where it executes and returns the value of the SQL * pass that value to another area to check and IF statement * continue with program I am having problems trying to figure out if the SQL is actually being processed and if so, why the value isn't being returned. [snip script] #!/usr/bin/perl -w use POSIX 'strftime'; use strict; use warnings; use diagnostics; use DBI; use Getopt::Std; --snip password variables-- # map tables and their variables our ($MBRHLTH,$DATES,$RESULTS)=qw(sys_mbrhlth sys_dates sys_results) ; my $dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $username, $password, { RaiseError => 1 }) or die "Can not connect: $!"; if (!defined($dbh)) {exit;} print "CONNECTED!\n"; getopt('ts'); if ( our($opt_t) eq '' or our($opt_s) eq '' ) { print STDERR qq!Usage: $0 -v DEBUG-LEVEL -s SOURCE-TABLE -t TARGET-TABLE -p PROCCESS SOURCE-TABLE is the name of the Oracle table containing update candidates TARGET-TABLE is the name of the system table to be loaded either sys_dates or sys_mbrhlth PROCESS is the process option, either "check" (default) which checks on what would be updated, if an "update" is done, or "update", which updates the dates table. DEBUG-LEVEL is the amount of debugging reporting to provide 1=all messages 0=no messages !; exit (1); } print "Loading ", our($opt_t), " from ", our($opt_s), "...\n"; sub getcols { my($table)[EMAIL PROTECTED]; my $rc=$dbh->do(" select column_name, nullable, column_id, data_type, default_length from all_tab_columns where table_name='$table' and column_id > 0 order by column_name "); }; #--------------- GET THE SOURCE TABLE'S VARIABLES my $source=&getcols($opt_s); print $source, "\n"; print &getcols($opt_s), "\n"; #if ( $source->ntuples==0 ) { # print STDERR "Source table $opt_s not found\n"; # exit 1; #} #--------------- GET THE TARGET TABLE'S VARIABLES my $target=&getcols($opt_t); #print $target, "\n"; if ($target->ntuples==0 ) { print STDERR "Target table $opt_t not found\n"; exit 1; } print "End of test\n"; $dbh->disconnect; [/snip script] The results of running the script looks like this: [snip results] [EMAIL PROTECTED] test_load_pl]$ ./get_tbl_info.pl -s t_hb_dates -t sys_dates -p check ** ** NOTE: ** I know about the main:<whatever> ... i haven't done ** anything with those yet ... that's for later ... ** Name "main::DATES" used only once: possible typo at ./get_tbl_info.pl line 39 (#1) (W once) Typographical errors often show up as unique variable names. If you had a good reason for having a unique name, then just mention it again somehow to suppress the message. The our declaration is provided for this purpose. Name "main::MBRHLTH" used only once: possible typo at ./get_tbl_info.pl line 39 (#1) Name "main::RESULTS" used only once: possible typo at ./get_tbl_info.pl line 39 (#1) ** ** should be my connection to the database ** CONNECTED! ** ** I expected results from either table (rows) ** so I can test them again for ** attributes ** Loading sys_dates from t_hb_dates... 0E0 <--the table or query? 0E0 <--the table or query? ** ** I thought ntuples would give me row info - ** is this not correct? ** Can't call method "ntuples" without a package or object reference at ./get_tbl_info.pl line 111 (#2) (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an expression that returns a defined value which is neither an object reference nor a package name. Something like this will reproduce the error: $BADREF = 42; process $BADREF 1,2,3; $BADREF->process(1,2,3); Uncaught exception from user code: Can't call method "ntuples" without a package or object reference at ./get_tbl_info.pl line 111. [/snip results] What have I missed? Can someone point me in the right direction? TIA! -X