You should look up Dynamic SQL Format 3 in the PowerBuilder help. It has exactly what you want with examples. One example is as follows:
DECLARE my_proc DYNAMIC PROCEDURE FOR SQLSA ;
integer Emp_id_var
string Emp_state_var
PREPARE SQLSA FROM "emp_select @stateparm=?" ;
// emp_select is a stored procedure
// Set variable to pass to SP
Emp_state_var = "MA"
EXECUTE DYNAMIC my_proc USING :Emp_state_var ;
FETCH my_proc INTO :Emp_id_var ;
CLOSE my_proc ;
Mike
Main Topics
Browse All Topics





by: sandeep_patelPosted on 2006-11-28 at 23:10:19ID: 18034858
Hi,
Try this...
string ls_sql,ls_spname
ls_spname = 'sp_macdonalds_budget'
ls_sql = "execute " + ls_spname + " ( " + ls_Budget_ID+ "," + ls_Status_ID + "," + ls_Resp_Person + ")"
execute immediate :ls_sql using sqlca;
Hope this will work but I am not sure how you can get return value. Instead pass one value as reference i mean as out parameter and i think then you will be able to get that value once this statement is executed.
Regards,
Sandeep