Board index » delphi » Token unknown when creating stored procedure
terriertech
![]() Delphi Developer |
Token unknown when creating stored procedure2005-03-02 11:58:23 AM delphi30 Dear all, I'm having a problem creating a stored procedure using IBX (something I have done successfully many times before). Basic outline is: ibq->SQL->Clear(); ibq->SQL->Add("CREATE PROCEDURE CLOSE_CALL"); ibq->SQL->Add("("); ibq->SQL->Add(" C_REF VARCHAR(32)"); ibq->SQL->Add(")"); ibq->SQL->Add("AS"); ibq->SQL->Add(" declare variable ACTIVITY VARCHAR(8);"); ... a number of other variables ibq->SQL->Add(" declare variable LOCATION VARCHAR(8);"); ibq->SQL->Add(" begin"); ibq->SQL->Add(" for select activity,location from call_list where c_ref=:c_ref into :activity,:location do"); ibq->SQL->Add(" insert into cl_call(c_ref,activity,location) values(:c_ref,:activity,:location);"); ibq->SQL->Add(" suspend;"); ibq->SQL->Add(" end"); ibq->ExecSQL(); I have a number of other variables (just like activity and location) that I have omitted for the sake of clarity. When this runs, I get the error: 'Error: Dynamic SQL Error SQL error code = -104 Token unknown - line XX, char YY ?' Where XX/YY corresponds to the space between ":c_ref" and "into" parameter in the select statement. I know the SQL is not wrong because I can copy/paste the SAME EXACT SQL into IBConsole and the stored procedure is created just fine. The problem only seems to occur when I use IBX. It doesn't matter whether I use a TIBQuery or TIBSQL, both do the same thing. Any ideas? Thanks. |