[Lazarus] Problem with TSQLScript

Paul c-soft at wp.pl
Fri Jul 19 11:20:52 CEST 2013


W dniu 19.07.2013 10:48, Ludo Brands pisze:
> On 07/18/2013 05:40 PM, Paul wrote:
>> Hello,
>>
>> I have problem with TSQLScript (?)
>> Script looks like that
>>
>> SET TERM ^ ;
>> CREATE PROCEDURE GET_USER_PRIVILEGES (
>>      USER_ACCOUNT VARCHAR(10))
>> RETURNS (
>>      RESULT CHAR(1))
>> AS
>> BEGIN
>>       FOR
>>       SELECT DISTINCT RDB$PRIVILEGE
>>       FROM RDB$USER_PRIVILEGES
>>       WHERE (RDB$USER = :USER_ACCOUNT)
>>       INTO :RESULT
>>       DO
>>       BEGIN
>>            SUSPEND;
>>       END
>> END
>> ^
>> SET TERM ; ^
>>
>> and the error message looks like that
>> {...}PrepareStatement
>> -Dynamic SQL Error
>> -SQL Error Code = -104
>> Token unknown - line 11, column 11
>> -?
>>
>> line 11 ->     INTO :RESULT
>> column 11-> :
>>
>> FlameRobin does not have any problems with this piece of code
>>
>> Any hints ?
> I think you have to set TSQLScript.UseSetTerm:=true. TSQLScript is
> parsing the script and executes queries one by one and needs to know
> what the "real" terminator is.
> http://www.freepascal.org/docs-html/fcl/sqldb/tsqlscript.usesetterm.html
>
> Ludo
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>

UseSetTerm is set to TRUE and Terminator to ";"
Without "SET TERM" directive in the script and terminator set to ^ 
result is the same :(

I tested other similar procedures, every time problem is somewhere 
around "INTO :VARIABLE"
in the procedure code.

Paul






More information about the Lazarus mailing list