Add some "or die" clauses to your prepare and execute statements, like
you did to your connect.


On 8/21/06, rohit bhute <[EMAIL PROTECTED]> wrote:
This is my code.

<code>
#! C:\Perl\bin\perl.exe -w

use strict;
use DBI;
use CGI qw(:standard);
use CGI::Carp ;
use CGI::Carp 'fatalsToBrowser' ;

print header;
print start_html('IDS');

my $dbh = DBI->connect( 'dbi:Oracle:ilclpdv3',
                        'rbhute',
                        'rbhute',
                        {
                          RaiseError => 1,
                          AutoCommit => 0
                        }
                      ) || die "Database connection not made: $DBI::errstr";

print p('Connected');

my $sth = $dbh->prepare("select table_name from user_tables");
$sth->execute();
while (my ($table_name) = $sth->fetchrow_array()) {
    print p("$table_name");
}
$sth->finish();

print p('Disconnected');
$dbh->disconnect();
</code>

It gives the following output.
<output>
Connected

T_IDS_JOBS

T_IDS_APP

T_IDS_CLNT_DIV

T_IDS_MST_CLNT

T_IDS_MST_USR

Disconnected
<end of output>

Whih is correct. However, when  I change the query to read any of the
tables, it shows just "Connected" and "Disconnected".

Any idea of where I'm going wrong?
--
Rohit V. Bhute
http://blog.rvbhute.org/



--
--------------------------------------------------------------------------------------------------------------
The darkest places in hell are reserved for those who maintain their
neutrality in times of moral crisis.
   Dante Alighieri (1265 - 1321)

They who would give up an essential liberty for temporary security,
deserve neither liberty or security.
Benjamin Franklin

Our lives begin to end the day we become silent about things that matter.
Martin Luther King

The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no warrants shall issue, but upon probable cause,
supported by oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.

Amendment IV to the Constitution of the United States
--------------------------------------------------------------------------------------------------------------

Reply via email to