Subject RE: [firebird-support] Newbie on SPs: HELP ON STORED PROCEDURE
Author Carol Milius
Well,

I was using firebird 1.5.0 and updated to 1.5.2 and now it is wornig..
I really dont know if the error was mine or not.. bu, anyways.. thanks for the tip!

Best Regards,

Carol M.



On Tue, 1 Feb 2005 15:09:44 -0600, "Clay Shannon" <cshannon@...> escreveu:

> De: "Clay Shannon" <cshannon@...>
> Data: Tue, 1 Feb 2005 15:09:44 -0600
> Para: <firebird-support@yahoogroups.com>
> Assunto: RE: [firebird-support] Newbie on SPs: HELP ON STORED PROCEDURE
>
> <html><body><tt>Carol,<BR><BR><< I am using IB Expert personal edition and when I try to compile de SP, an<BR>error is reported<BR>(parser error)<BR>The cursor is placed after the number 1 in the first select statement..>><BR><BR>I don't know if that's an IB Expert problem or what.<BR><BR>I use Database Workbench (an awesome product) and this:<BR><BR>SELECT 1 FROM rdb$database WHERE EXISTS<BR>(SELECT 1 FROM CAREGIVERS WHERE ID = 0)<BR><BR>works fine for me in the script editor. In the above case, I get an empty<BR>result set, because my lowest ID val in that table is 2. If I change the "="<BR>to a "<>", I get a result of "1".<BR><BR>Clay Shannon,<BR>Dimension 4 Software<BR><BR>-----Original Message-----<BR>From: Carol Milius [mailto:lista@...] <BR>Sent: Tuesday, February 01, 2005 2:32 PM<BR>To: firebird-support@yahoogroups.com<BR>Subject: RE: [firebird-support] Newbie on SPs: HELP ON STORED PROCEDURE<BR><BR><BR>hi Clay,<BR><BR>Thanks for the tip!<BR><BR>I am using IB Expert personal edition and when I try to compile de SP, an<BR>error is reported<BR>(parser error)<BR>The cursor is placed after the number 1 in the first select statement..<BR><BR>thank again!<BR><BR>Carol.<BR><BR>>BTW, didn't you used to work with Bob what's...<BR>No.<BR><BR><BR><BR><BR>On Tue, 1 Feb 2005 13:40:22 -0600, "Clay Shannon" <cshannon@...><BR>escreveu:<BR><BR>> De: "Clay Shannon" <cshannon@...><BR>> Data: Tue, 1 Feb 2005 13:40:22 -0600<BR>> Para: <firebird-support@yahoogroups.com><BR>> Assunto: RE: [firebird-support] Newbie on SPs: HELP ON STORED PROCEDURE<BR>> <BR>> <html><body><tt><< I am trying to make a SP to check if the record already<BR>exists.>><BR><BR>Carol,<BR><BR>Try something like this:<BR><BR>SELECT 1 FROM<BR>rdb$database WHERE EXISTS <BR>(SELECT 1 FROM <a table> WHERE<BR><conditions>)<BR><BR>If result = 1, the record exists; otherwise, it<BR>doesn't.<BR><BR>BTW, didn't you used to work with Bob what's-his-face on<BR>"Let's Make a<BR>Deal"?<BR><BR>Clay Shannon,<BR>Dimension 4<BR>Software<BR>-----Original Message-----<BR>From: Carol Milius<BR>[mailto:lista@...] <BR>Sent: Tuesday, February 01, 2005 12:58<BR>PM<BR>To: firebird-support@yahoogroups.com<BR>Subject: [firebird-support]<BR>Newbie on SPs: HELP ON STORED PROCEDURE<BR><BR><BR>Hi!<BR><BR>I am trying to<BR>make a SP to check if the record already exists.<BR>The SP below is<BR>something I am trying but it is not working..<BR>I am reading de IB manuals<BR>but can not get an clear exemple..<BR>Any coments are welcome (links<BR>too)<BR><BR>Best Regards,<BR><BR>Carol<BR><BR>Input: IN_FIELDNAME,<BR>IN_TABLENAME, IN_FIELDVALUE<BR>Output: OUT_EXISTS<BR>Var:<BR>VAR_FIELDVALUE<BR><BR>begin<BR> OUT_EXISTS = 'No';<BR><BR> For Execute<BR>Statement<BR><BR> 'Select ' || IN_FIELDNAME ||<BR> ' From ' ||<BR>IN_TABLENAME<BR> Into :VAR_FIELDVALUE<BR> Do<BR> if<BR>(VAR_FIELDVALUE = IN_FIELDVALUE) Then<BR> OUT_EXISTS = 'Yes';<BR><BR><BR>suspend;<BR><BR>end<BR><BR><BR><BR><BR><BR><BR> <BR>Yahoo! Groups<BR>Links<BR><BR><BR><BR> <BR><BR><BR><BR><BR></tt><!-- |**|begin egp html<BR>banner|**| --><br><tt><hr width="500"><b>Yahoo! Groups<BR>Links</b><br><ul><li>To visit your group on the web, go to:<br><a<BR>href="<a href="http://groups.yahoo.com/group/firebird-support/">http://groups.yahoo.com/group/firebird-support/</a>"><a href="http://groups.yahoo.c">http://groups.yahoo.c</a><BR>om/group/firebird-support/</a><br> <li>To unsubscribe from this group, send<BR>an email to:<br><a<BR>href="mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscrib<BR>e">firebird-support-unsubscribe@yahoogroups.com</a><br> <li>Your use of<BR>Yahoo! Groups is subject to the <a<BR>href="<a href="http://docs.yahoo.com/info/terms/">http://docs.yahoo.com/info/terms/</a>">Yahoo! Terms of<BR>Service</a>.</ul></tt></br><!-- |**|end egp html banner|**|<BR>--></body></html><BR><BR><BR> <BR>Yahoo! Groups Links<BR><BR><BR><BR> <BR><BR><BR><BR><BR></tt><!-- |**|begin egp html banner|**| --><br><tt><hr width="500"><b>Yahoo! Groups Links</b><br><ul><li>To visit your group on the web, go to:<br><a href="http://groups.yahoo.com/group/firebird-support/">http://groups.yahoo.com/group/firebird-support/</a><br> <li>To unsubscribe from this group, send an email to:<br><a href="mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe">firebird-support-unsubscribe@yahoogroups.com</a><br> <li>Your use of Yahoo! Groups is subject to the <a href="http://docs.yahoo.com/info/terms/">Yahoo! Terms of Service</a>.</ul></tt></br><!-- |**|end egp html banner|**| --></body></html>