Subject | RE: [firebird-support] Re: What is the BEST method to find if a record exists? |
---|---|
Author | Ricardo Agüero Rodas |
Post date | 2004-11-16T18:45:17Z |
Just a little correction .... if you let me ....
if (exists(select 1 from testfile where testfield='xxxxx')) then
Ricardo.
-----Mensaje original-----
De: jjochoa75 [mailto:jochoa@...]
Enviado el: martes, 16 de noviembre de 2004 23:29
Para: firebird-support@yahoogroups.com
Asunto: [firebird-support] Re: What is the BEST method to find if a record
exists?
Try
if exists(select 1 from testfile where testfield='xxxxx') then
...
Juan Jose
--- In firebird-support@yahoogroups.com, "Michael L. Horne"
<guardian@p...> wrote:
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004
[Non-text portions of this message have been removed]
if (exists(select 1 from testfile where testfield='xxxxx')) then
Ricardo.
-----Mensaje original-----
De: jjochoa75 [mailto:jochoa@...]
Enviado el: martes, 16 de noviembre de 2004 23:29
Para: firebird-support@yahoogroups.com
Asunto: [firebird-support] Re: What is the BEST method to find if a record
exists?
Try
if exists(select 1 from testfile where testfield='xxxxx') then
...
Juan Jose
--- In firebird-support@yahoogroups.com, "Michael L. Horne"
<guardian@p...> wrote:
> Hello,into :numrecords;
>
> I need to check to see if a record exists from inside a
> stored procedure. What is the best code to use?
>
> The methods I know of are:
>
> 1.
> NO_RECORD_EXISTS = 'FALSE';
> select count(*) from testfile where testfield='xxxxx'
> if (numrecords = 0) then NO_RECORD_EXISTS = 'TRUE';into :testfield
>
> 2.
> NO_RECORD_EXISTS = 'FALSE';
> for select testfield from testfile where testfield='xxxxx'
> do beginwhy */
> NO_RECORD_EXISTS = 'TRUE';
> end
>
> 3. /* this one doesn't seem to work correctly and I am not sure
> NO_RECORD_EXISTS = 'FALSE';out if a
> select first 1 testfield from testfile where testfield='xxxxx' into
> :testfield;
> if (testfield = null) then NO_RECORD_EXISTS = 'TRUE';
>
> -------
> But these all seem like a difficult set of things to do to find
> record exists, so is there a better way and what is it?Yahoo! Groups Sponsor
>
> Thanks
> Michael L. Horne
ADVERTISEMENT
----------------------------------------------------------------------------
--
Yahoo! Groups Links
a.. To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
b.. To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 01/11/2004
[Non-text portions of this message have been removed]