[Lazarus] Problem with TSQLScript
Paul
c-soft at wp.pl
Fri Jul 19 11:39:16 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
>
>
TSQLScript.OnException
Exception.Message shows statement to run like this
(without any terminator)
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
Paul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130719/d990fd6b/attachment-0003.html>
More information about the Lazarus
mailing list