Agha Jawad [EMAIL PROTECTED] wrote:
> Dear all,
>  
> I have a problem. I have installed "Indigo Perl". I have used the
> following commands to install DBI for Oracle.
>  
> Ipm install DDL-Oracle-1.11
>  
> This thing installed oracle.pm along with the other files. Then I wrote
> the following code in a simple text file and saved it as "abc.pl". The
> code is as follows.
>  
> #!perl -w
>  use DBI;
>  use DDL::Oracle;
>  my $dbh = DBI->connect(
>                          "dbi:Oracle:dbname",
>                          "cbs",
>                          "pwd",
>                          {
>                           PrintError => 0,
>                           RaiseError => 1
>                          }
>                        );
>  # Use default resize and schema options.
>  # query default DBA_xxx tables (could use USER_xxx for non-DBA types)
>  DDL::Oracle->configure(
>                          dbh    => $dbh,
>                        );
>  # Create a list of one or more objects
>  my $sth = $dbh->prepare(
>         "SELECT
>                 csr
>               
>          FROM
>                 tblcsr
>          WHERE
>                 csrid = 1    -- your mileage may vary
>         "
>      );
>  $sth->execute;
>  my $list = $sth->fetchall_arrayref;
>  my $obj = DDL::Oracle->new(
>                              type  => 'table',
>                              list  => $list,                          );
>                            );
>  my $ddl = $obj->create;      # or $obj->resize;  or $obj->drop;  etc.
>  print $ddl;    # Use STDOUT so user can redirect to desired file.
>  # Here's another example, this time for type 'components'.  This type
>  # differs from the norm, because it has no owner and no name.
>  my $obj = DDL::Oracle->new(
>                              type => 'components',
>                              list => [[ 'no owner','no name' ]]
>                            );
>  my $ddl = $obj->create;
>  print $ddl;
>  
>  
> It gives me this error
> Premature end of script headers
> And sometimes it says that file not found or not a proper exe etc

Are you trying to run this script in your browser?  If you are,
then
  1. you'll need to produce valid html output - just doing
     simple prints to stdout like you are doing above won't
     work, and
  2. this isn't a DBI issue - you might want to try asking
     this question on a perl list - one that comes to mind
     can be found at www.perlmonks.org.

I'm not familiar with running Perl/DBI/Oracle on a Windows
platform, but are you able to run Oracle queries with the
Oracle supplied client?  The oracle command line client
on the linux platform is called 'psql' (I think - it's been
a while ;-)
-- 
Hardy Merrill
Red Hat, Inc.

Reply via email to