Subject RE: [firebird-support] Access to Stored Procedure
Author Thomas Steinmaurer
> I have created a stored procedure
>
>
>
>
>
> CREATE PROCEDURE "TESTPROC"
>
> RETURNS
>
> (
>
> "ID" CHAR(30) CHARACTER SET WIN1252
>
> )
>
> AS
>
> DECLARE VARIABLE xpart VARCHAR(30);
>
> DECLARE VARIABLE NewNum INTEGER;
>
> BEGIN
>
> NewNum = GEN_ID(CCPART_GEN,1);
>
> xPart = Cast(Newnum as INTEGER);
>
> WHILE (STRLEN(xPart)<6) DO
>
> BEGIN
>
> xPart = ('0'||xPart);
>
> END
>
> ID= ('CCS-'||Xpart);
>
> EXIT;
>
> END

Replace the EXIT with a SUSPEND.


> My query is how do access this from my application or IbConsole
>
> Using
>
> SELECT ID FROM TESTPROC
>
> activates the procedure and increments the generator but I get null as a
> result.

The usage of the stored procedure as a selectable SP is fine, but
you need to use SUSPEND. See above.


HTH,
Thomas Steinmaurer
LogManager Serie - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com