How To process a result in a stored procedure Suppose i have
sql = "SELECT fname, lname FROM students WHERE name ='Sam' ";
How will i fetch this result in variable and loop in a SP
like we do in PHP as:
$sql = "SELECT fname, lname FROM students WHERE name ='Sam' ";
$qSql = mysql_query($sql);
if ($qSql )
{
$fArr = mysql_fetch_array($qSql);
if ($fArr)
{
foreach ($fArr as $arrTmp)
{
$arrResult['fName'] = $arrTmp['fname'];
$arrResult['lName'] = $arrTmp['lname'];
}
}
}
How we can do such type of looping in SP ?
How can we split string in SP and loop as we do in PHP ?