Subject Re: [firebird-support] Re: Select + Update in a single SPROC?
Author Woody
From: "Helen Borrie" <helebor@...>

Pardon my jumping in.

Maybe I'm wrong (seems more often nowadays), but I thought the OP just
wanted to store the count for each search item and increment it each time
that search item is used(searched for). If it's the first time the search
item is used, then insert a new record and set the count to 1. Either way,
the LastSearch field is updated with the current date/time.

I'm not sure why there is an ID field because it isn't inserted if a new
record is needed in any of the OPs posts. It might just be a generator-fed
field using an insert trigger but it isn't clear from any of the posts what
it is or contains.

1. User initiates a search of [something, don't know what or where] using a
search string.

2. The search code calls the procedure with the search string to update the

3. The procedure checks to see if the string has been searched for before.

4. If it has, it increments the count and returns that number and also
updates the LastSearch field with the current timestamp.

5. If it hasn't, it inserts a new record with that search string and returns
a count of 1.

I don't think he wanted to store each time a value was searched in a
separate record with a timestamp. Like I said, though, I've been wrong a lot
lately so maybe I should hone up on my reading skills. :)

One thing is certain, from all the differing answers, it's clear that the
original problem wasn't stated as clearly as it should be.

Woody (TMW)