Hey everyone,
Relatively new to Perl and had a quick question. Is it possible to assign a SQL query result to a variable? The query will always return a single interger result. This is what I have thus far:
use DBI;
use DBD::DB2::Constants;
$dbh = DBI->connect("dbi:DB2:SLOGAN","","") or die "Cannot connect to database";
$stmt = "SELECT VARIABLE_VALUE from LAWSON.WFVARIABLE where VARIABLE_NAME = 'RQH_REQ_NUMBER' AND WORKUNIT = 1";
$sth = $dbh->prepare($stmt);
$sth->exectue();
#This is where I would like to assign the result to a variable
I connect to the database, write my select statement, prepare it, and then execute. From this point, I want to assign what was returned to a variable. Thanks for all your help!