Subject Re: [firebird-support] Re: Select + Update in a single SPROC?
Author Helen Borrie
At 11:39 PM 23/11/2007, you wrote:
>Helen, thank you very much for this detailed explanation. Your code
>works very well, but I still have a little question:
>
>searchexists = 0;
>if (exists (
>select ID from TBLONE where searchterm = :SEARCHTERM
>)
>) then
>searchexists = 1;
>
>if (exists) will act like a boolean (or similar), right?. So if there
>is a matching record in the table, "searchexists" will be set to "1",
>right?
>To get the ID of the existing record into the "searchexists":
>
>select ID from TBLONE where searchterm = :SEARCHTERM into searchexists;
>
>But this would fire the select-statement twice, right?
>Is there way to do this within a single select?
>
>I need the ID of the existing record to update the
>"searchcount"-integer in TBLONE ( with something like "searchcount =
>searchcount + 1").
>
>Thanks for your help :)

Well, reading this and your other posts, I observe that confusion reigns supreme. You have introduced an "idcount" - so - did you really want to COUNT the number of hits on the searchitem????

If so, you're a bit lost...so answer that question and you will be overwhelmed with correcto solutions.

./heLen