Hi Michael and All,

I am trying to use getopt.pl, however, it give me errors and terminate when
I use 'use strict;'.

aztec:/usr/local/apps/sma/devl/bin>runAgg_TAlgnRxTerrSpcltDrugPlan.pl

Loading DB routines from perl5db.pl version 1.0402
Emacs support available.

Enter h or `h h' for help.

Global symbol "$opt_s" requires explicit package name at sma_run_aggs.pl
line 53.
Global symbol "$opt_l" requires explicit package name at sma_run_aggs.pl
line 53.
Global symbol "$opt_c" requires explicit package name at sma_run_aggs.pl
line 73.
Global symbol "$opt_t" requires explicit package name at sma_run_aggs.pl
line 75.
Global symbol "$opt_d" requires explicit package name at sma_run_aggs.pl
line 76.
Global symbol "$opt_m" requires explicit package name at sma_run_aggs.pl
line 77.
Execution of sma_run_aggs.pl aborted due to compilation errors.
Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.

This is how I call getopt.pl:


  use strict;
  use Cwd;
  use DBI;
  require "getopt.pl";

  Getopt('sl:ctdm');

Thanks.

Peter

-----Original Message-----
From: Michael A. Chase [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 8:02 AM
To: Peter Loo; Loo, Peter # PHX; [EMAIL PROTECTED]
Subject: Re: Stored Procedure (arguments)


I forgot to mention.  You are not checking for errors after the prepare()
calls.  Either set $dbh->{RaiseError} to 1 or check after all connect(),
prepare(), execute(), and fetch*() calls or you will get errors after the
real cause and have more trouble tracking down the real cause.
--
Mac :})
** I normally forward private database questions to the DBI mail lists. **
Give a hobbit a fish and he'll eat fish for a day.
Give a hobbit a ring and he'll eat fish for an age.
----- Original Message -----
From: "Michael A. Chase" <[EMAIL PROTECTED]>
To: "Peter Loo" <[EMAIL PROTECTED]>; "Loo, Peter # PHX"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, March 13, 2001 4:23 AM
Subject: Re: Stored Procedure (arguments)


> ----- Original Message -----
> From: "Peter Loo" <[EMAIL PROTECTED]>
> To: "Michael A. Chase" <[EMAIL PROTECTED]>; "Loo, Peter # PHX"
> <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Monday, March 12, 2001 8:38 PM
> Subject: RE: Stored Procedure (arguments)
>
>
> > 1) $DICEpackage is a store procedure we use internally.
>
> That's your error this time.  Perl is trying to interpolate the variable
> $DICEpackage into the string.  As mentioned by Peter J Holzer, -w in the
#!
> line should have caught this.  'use strict;' (without the quotes) is also
a
> good idea to prevent syntax irregularities from growing into program
errors.
>
> > 2) The reason that $dbh->prepare is in loop to dynamically handle
multiple
> > tables.
>
> The only reason the prepares should be inside the loop is if the text of
the
> SQL changes inside the loop.  Since it does not for either statement, you
> are paying a severe penalty by re-preparing both statements inside the
loop.
> The execute() calls are the only DBI statements that need to be inside the
> loop.
>
> > 3) I have tried bind variables with commas and yet it didn't work.
>
> Run 'perldoc DBI' and read the sections on bind_param() and placeholders
to
> see examples of how to use placeholders/bind variables and a discussion of
> their limitiations.  The commas are required as a matter of SQL syntax.
>
> There are also examples of procedure calls in DBI-Oracle-1.06/Oracle.ex/.
> Procedure calls are coverd by proc.pl, but all the examples are worth a
> look.
>
> > 4) {} is a style I had adopted to identify that a variable was
previously
> > declared.
>
> All variables should be previously declared in production code as required
> by '-w' and 'use strict' to avoid the problem that brought you here.  Use
> both and let the Perl interpreter help you write good code.
>
> > 6) I will give DBI->trace a try after I have figured out how it works.
>
> It's described in the fine manual.
>
> > -----Original Message-----
> > From: Michael A. Chase [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, March 12, 2001 8:38 PM
> > To: Loo, Peter # PHX; [EMAIL PROTECTED]
> > Subject: Re: Stored Procedure (arguments)
> >
> >
> > 1. What is the value in $DICEpackage?
> > 2. You should call $dbh->prepare() outside the loop.  Keep both prepared
> > handles in separate variables.
> > 3. The bind variables (:1, :2, :3) definitely need to be separated by
> commas
> > (,) in both SQL statements.
> > 4. You don't need either the quotes or braces in the first argument to
> > either $sth->execute().  Just use $tableName in that position.
> > 5. The braces are also not needed in ${tableName} in the print
statement.
> > 6. Try adding DBI->trace(2,"file_name"); before this section to see
what's
> > really happening.
> > ----- Original Message -----
> > From: "Loo, Peter # PHX" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, March 12, 2001 3:15 PM
> > Subject: Stored Procedure (arguments)
> >
> > > Can someone please tell me what this is all about?
> > >
> > > DBD::Oracle::st execute failed: ORA-01036: illegal variable
name/number
> > (DBD
> > > ERROR: OCIBindByName) at sma_run_aggs.pl line 172.
> > >
> > > Here is my syntax:
> > >
> > >     foreach $tableName (@tableList) {
> > >       print STDERR "\n\nDropping indexes (${tableName}).\n";
> > >       $sth = $dbh->prepare("BEGIN $DICEpackage.DROP_INDEXES(:1:2:3);
> > END;");
> > >       $sth->execute("${tableName}", "ALL", "FALSE"); <=== Line 172
> > >       sub_dbms_output_errors($SearchString, $dbh);
> > >       print STDERR "Truncating table (${tableName}).\n";
> > >       $sth = $dbh->prepare("BEGIN $DICEpackage.TRUNCATE_TABLE(:1:2);
> > END;");
> > >       $sth->execute("${tableName}", "ALL");
> > >       sub_dbms_output_errors($SearchString, $dbh);
> > >       }
>
>
>

Reply via email to