Tablename as Parameter in stored function

Martin S. blackfin at elfenherz.de
Thu Oct 18 09:19:24 CDT 2007


Bart Pietercil schrieb:
>
> On 18-okt-07, at 15:54, Martin S. wrote:
>
>> How can I pass a table name into a stored procedure?
>>
>> This is my function:
>>
>> CREATE FUNCTION NextAutoID(inValue string)
>> RETURNS ULONG
>> begin
>>    DECLARE max_autoid ULONG ;
>>    select MAX(AutoID) INTO max_autoid from  inValue ;
>>    RETURN max_autoid + 1 ;
>> end;
>>
>>
>> but I get this error:
>> error: Table "inValue" not found.
>
> you can't pass variables as "placeholders" for the real thing :(
>
> However, you can wrap the functionality in a case structure.
> A bit cumbersome but it works
>
> hth
>
> Bart
>
mhm, what a pity, but ok.....
I thank you very much!

>
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>



More information about the Valentina mailing list