Subject | Re: In firebird store_procedure IN clause is not giving the desired result |
---|---|
Author | mauleen2001 |
Post date | 2007-06-09T08:23:19Z |
Hi Martijn Tonies,
I had tried as u said but still it does not work.
if i write in store-procedure
Delete from container where fileid in ('FL005','FL006');
it is deleted but i pass it as a input parameter it does not
Delete from container where fileid in (:new1);
Can anybody help me in this matter?
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@...> wrote:
I had tried as u said but still it does not work.
if i write in store-procedure
Delete from container where fileid in ('FL005','FL006');
it is deleted but i pass it as a input parameter it does not
Delete from container where fileid in (:new1);
Can anybody help me in this matter?
--- In firebird-support@yahoogroups.com, "Martijn Tonies"
<m.tonies@...> wrote:
>'FL000001','FL000003')
> Hi,
>
> > I am having one problem in store-procedure. I am passing a variable
> > value as a input parameter in a store-procedure and that value is used
> > in following statement (:varValue and its value is
> >''FL000001'',''FL000003'' ')
> > Delete fileid from container where fileid in (:varValue)
> >
> > I can not get the desired result.
> >
> > If i use the hard coded value then it works fine. for ex.
> > Delete fileid from container where fileid in ('FL000001','FL000003')
> >
> > What could be the problem?
>
> Because what you're doing is wrong. A variable holds a single value. In
> your case, the statement will become (more or less) the following:
>
>
> Delete fileid from container where fileid in ('
>
> I've quoted your string (and doubled the single quotes to escape each
> quote).
>
> See the difference? You're passing a string value to a parameter, and I
> replaced
> the parameter with its actual value.
>
> In other words: you cannot use parameters like this.
>
>
> Try using a dynamic statement by using EXECUTE STATEMENT.
>
> Martijn Tonies
> Database Workbench - development tool for Firebird and more!
> Upscene Productions
> http://www.upscene.com
> My thoughts:
> http://blog.upscene.com/martijn/
> Database development questions? Check the forum!
> http://www.databasedevelopmentforum.com
>