I have two procedures p1 and p2. My p1 gives me 4 columns output. I want a single column from p1 to be used in p2 procedure in a select query output in where condition. I am using mysql, Please suggest it.
Asked
Active
Viewed 51 times
0
-
possible duplicates: [use result set of mysql stored procedure in another stored procedure](http://stackoverflow.com/questions/2466713/use-result-set-of-mysql-stored-procedure-in-another-stored-procedure), [Getting mySQL stored procedure results in another stored procedure](http://stackoverflow.com/questions/8662987/getting-mysql-stored-procedure-results-in-another-stored-procedure) – mellamokb Jul 31 '12 at 12:51
-
Do you want to use srored procedure to use it in SELECT...FROM clause? Please provide more information, show your code. – Devart Jul 31 '12 at 13:10
2 Answers
0
Run the first store procedure.
Take the column value you want from the result and store it in a variable.
If a valid value available in the variable, Use that variable while calling the second stored procedure.

Shyju
- 214,206
- 104
- 411
- 497
-
-
@hariprasad http://stackoverflow.com/questions/2466713/use-result-set-of-mysql-stored-procedure-in-another-stored-procedure – Shyju Aug 01 '12 at 12:06
0
Use this:
$i=0;
while($row = mysql_fetch_array($result))
{
$smt[i]=$row['column_name'];
i++;
}
Now the column is stored in the array $smt.

Γεώργιος Βιδαλάκης
- 250
- 1
- 3
- 10