Don't forget the "WHERE" clause in your select statement, and rather 
than selecting "*" why not ONLY select the email field. And the example 
is connecting to an Oracle DB not an Intersolv DB, unless they are the 
same (sorry I am not familar with Intersolv).  *If* you are only looking 
to do a single query and a relatively simple one as you indicated than 
you can also look to going directly to a "query" rather than a 
prepare->execute structure, save one trip to the DB engine.

In general you should have a look at DBI and its various resources.

http://danconia.org


Rajaraman_Seetharaman wrote:
> Hi Michael,
> Try the following code might be useful..in connecting to a database..and
> retrieving value...
> 
>     $dbh = DBI->connect("DBI:Oracle:$dbname", $user, $options,
> {AutoCommit=>0})
>     $statement = "Select * from emp"
>     $sth = $dbh->prepare($statement)
>     $sth = $dbh->prepare($statement, {ing_readonly=>1})
>     $sth->execute
>     @row = $sth->fetchrow
>     $sth->finish
>     $dbh->commit
>     $dbh->rollback
>     $dbh->disconnect
> 
> regards,
> Rajaraman.S
> 
> 
>>-----Original Message-----
>>From: Michael Pastore [SMTP:[EMAIL PROTECTED]]
>>Sent: Tuesday, July 16, 2002 5:26 PM
>>To:   [EMAIL PROTECTED]
>>Subject:      Retrieving Data from a Db using Perl
>>
>>Hello All,
>>
>>I would like to query a Database using Perl and an Intersolv ODBC Driver.
>>For exmaple...knowing a customer # open a table in a database, find the
>>customer record and return an email address.
>>
>>Does anyone have or know of:
>>- any references on how to do this 
>>- any example snippets of code on doing this.
>>
>>Any help would be greatly appreciated.
>>
>>Thank You,
>>Mike
>>
>>-- 
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ************************************************************************** 
> This email (including any attachments) is intended for the sole use of the
> intended recipient/s and may contain material that is CONFIDENTIAL AND
> PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
> distribution or forwarding of any or all of the contents in this message is
> STRICTLY PROHIBITED. If you are not the intended recipient, please contact
> the sender by email and delete all copies; your cooperation in this regard
> is appreciated.
> **************************************************************************
> 



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

Reply via email to