Skip navigation links

MySQL Forums :: Cursors :: Problem with CHAR() variable throwing INT error in CURSOR in Stored Procedure


Advanced Search

Re: Problem with CHAR() variable throwing INT error in CURSOR in Stored Procedure
Posted by: Jarad Peckenpaugh ()
Date: May 07, 2010 10:06PM

I can accomplish the task by writing a driver in php, but I'd rather keep the entire routine server-side (in mysql as a stored procedure). PHP would be::


<?php

include("mysql.include.php") ;
open_mysql_connection() ;


$sql01_source = "SELECT collection_id,criteria FROM collection_criteria WHERE disabled = 0" ;
$sql01 = mysql_query("$sql01_source") or die(mysql_error()) ;

while( $row = mysql_fetch_object($sql01)) {
$sql02_source = "INSERT INTO collections_to_docs (sku,collection_id) SELECT T1.sku, '{$row->collection_id}' collection_id FROM documents AS T1 WHERE {$row->criteria} AND T1.sku NOT IN (SELECT T2.sku FROM collections_to_docs AS T2 WHERE T2.collection_id = {$row->collection_id})" ;
$sql02 = mysql_query("$sql02_source") or die(mysql_error()) ;
}

?>



Edited 1 time(s). Last edit at 05/07/2010 10:09PM by Jarad Peckenpaugh.

Options: ReplyQuote


Subject Views Written By Posted
Problem with CHAR() variable throwing INT error in CURSOR in Stored Procedure 2566 Jarad Peckenpaugh 05/07/2010 07:16PM
Re: Problem with CHAR() variable throwing INT error in CURSOR in Stored Procedure 1332 Peter Brawley 05/07/2010 08:06PM
Re: Problem with CHAR() variable throwing INT error in CURSOR in Stored Procedure 1298 Jarad Peckenpaugh 05/07/2010 09:28PM
Re: Problem with CHAR() variable throwing INT error in CURSOR in Stored Procedure 1479 Jarad Peckenpaugh 05/07/2010 10:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.