Javier,

I normally use the "SELECT Colname INTO...INDICATOR" as well.
Works great. The only time I have an issue is when it could return more than 
one row.

Thanks,

Jan


From: <[email protected]>
To: <[email protected]>
Date: Wed, 6 Feb 2019 12:31:56 -0600
Subject: RE: [RBASE-L] - SQL tutorial


Jan,

A while back I stopped using the “SET VAR =…” syntax and replaced 
(when possible) with the “SELECT ColName INTO…INDICATOR …” construct 
as R:azzak example shows. As I understand, it reflects the more standard SQL 
syntax and works great.

Javier,

Javier Valencia, PE
O: 913-829-0888
C: 913-915-3137



From:[email protected] [mailto:[email protected]] On Behalf 
Ofjan johansen
Sent: Wednesday, February 06, 2019 12:06 PM
To: [email protected]
Subject: Re: [RBASE-L] - SQL tutorial


Razzak,

Thank you. I was actually replacing the existence check with this when I 
posted the question.
I think elsewhere in the system when I look at
WHILE SQLCODE = 0
or
WHILE SQLCODE <> 100
my brain got really tied in knots.

Thx again,

Jan


From: "A. Razzak Memon" <[email protected]>
To: [email protected], [email protected]
Date: Tue, 05 Feb 2019 20:28:00 -0500
Subject: Re: [RBASE-L] - SQL tutorial
Jan,

Here is one approach to validate the existence of a row ...

SET VAR vRows INTEGER = 0
SELECT COUNT(*) INTO vRows INDICATOR iv1 FROM PODetail WHERE PO_ID =
.vPOID AND ReceiptStatus = 'P'

IF vRows = 0 THEN
    CLS
    PAUSE 2 USING 'No record found!' CAPTION 'Receipt Status' ICON WARNING +
    BUTTON 'Press any key to continue ...' +
    OPTION BACK_COLOR WHITE +
    |MESSAGE_FONT_NAME Tahoma +
    |MESSAGE_FONT_COLOR RED +
    |MESSAGE_FONT_SIZE 12
    GOTO Done
ENDIF

-- Do what you have to do here ...
-- Example
    CLS
    EDIT USING ReceiptStatus WHERE PO_ID = .vPOID AND ReceiptStatus = 'P'
LABEL Done
    CLEAR VARIABLES iv%,vRows
    RETURN

Hope it helps!

Razzak


At 06:41 PM 2/5/2019, jan johansen wrote:

>All,
>
>I think I need a SQL refresher.
>I need to update old code that looks like this.
>
>SET ERROR VAR hold
>SET VAR vchk = ReceiptStatus IN PODetail WHERE PO_ID = .vPOID AND
>ReceiptStatus = 'P'
>IF hold = 0 THEN
>
>So is
>IF hold = 0 the same as
>IF SQLCODE = 0?
>
>Sorry such a dumb question.
>
>Jan
>
>--
>For group guidelines, visit
><http://www.rbase.com/support/usersgroup_guidelines.php 
[http://www.rbase.com/support/usersgroup_guidelines.php]>http://www.rbase.com/support/usersgroup_guidelines.php
 
[http://www.rbase.com/support/usersgroup_guidelines.php]
>---
>You received this message because you are subscribed to the Google
>Groups "RBASE-L" group.
>To unsubscribe from this group and stop receiving emails from it,
>send an email to
><mailto:[email protected] 
[mailto:rbase-l%2Bunsubscribe%40googlegroups.com]>[email protected]
 
[mailto:rbase-l%2Bunsubscribe%40googlegroups.com].
>For more options, visit
><https://groups.google.com/d/optout 
[https://groups.google.com/d/optout]>https://groups.google.com/d/optout 
[https://groups.google.com/d/optout].

--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php 
[http://www.rbase.com/support/usersgroup_guidelines.php]
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected] 
[mailto:rbase-l%2Bunsubscribe%40googlegroups.com].
For more options, visit https://groups.google.com/d/optout 
[https://groups.google.com/d/optout].
--
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php 
[http://www.rbase.com/support/usersgroup_guidelines.php]
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected] 
[mailto:[email protected]].
For more options, visit https://groups.google.com/d/optout 
[https://groups.google.com/d/optout].
 --
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php 
[http://www.rbase.com/support/usersgroup_guidelines.php]
---
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an 
email to [email protected] 
[mailto:[email protected]].
For more options, visit https://groups.google.com/d/optout 
[https://groups.google.com/d/optout].
<!--{cke_protected}{C}%3C!%2D%2D%0A%2F*%20Font%20Definitions%20*%2F%0A%40font-face%0A%09%7Bfont-family%3ACalibri%3B%0A%09panose-1%3A2%2015%205%202%202%202%204%203%202%204%3B%0A%09mso-font-charset%3A0%3B%0A%09mso-generic-font-family%3Aswiss%3B%0A%09mso-font-pitch%3Avariable%3B%0A%09mso-font-signature%3A-536870145%201073786111%201%200%20415%200%3B%7D%0A%40font-face%0A%09%7Bfont-family%3ATahoma%3B%0A%09panose-1%3A2%2011%206%204%203%205%204%204%202%204%3B%0A%09mso-font-charset%3A0%3B%0A%09mso-generic-font-family%3Aswiss%3B%0A%09mso-font-pitch%3Avariable%3B%0A%09mso-font-signature%3A-520081665%20-1073717157%2041%200%2066047%200%3B%7D%0A%2F*%20Style%20Definitions%20*%2F%0Ap.MsoNormal%2C%20li.MsoNormal%2C%20div.MsoNormal%0A%09%7Bmso-style-unhide%3Ano%3B%0A%09mso-style-qformat%3Ayes%3B%0A%09mso-style-parent%3A%22%22%3B%0A%09margin%3A0in%3B%0A%09margin-bottom%3A.0001pt%3B%0A%09mso-pagination%3Awidow-orphan%3B%0A%09font-size%3A12.0pt%3B%0A%09font-family%3A%22Times%20New%20Roman%22%2C%22serif%22%3B%0A%09mso-fareast-font-family%3ACalibri%3B%7D%0Aa%3Alink%2C%20span.MsoHyperlink%0A%09%7Bmso-style-noshow%3Ayes%3B%0A%09mso-style-priority%3A99%3B%0A%09color%3Ablue%3B%0A%09text-decoration%3Aunderline%3B%0A%09text-underline%3Asingle%3B%7D%0Aa%3Avisited%2C%20span.MsoHyperlinkFollowed%0A%09%7Bmso-style-noshow%3Ayes%3B%0A%09mso-style-priority%3A99%3B%0A%09color%3Apurple%3B%0A%09text-decoration%3Aunderline%3B%0A%09text-underline%3Asingle%3B%7D%0Ap%0A%09%7Bmso-style-noshow%3Ayes%3B%0A%09mso-style-priority%3A99%3B%0A%09mso-margin-top-alt%3Aauto%3B%0A%09margin-right%3A0in%3B%0A%09mso-margin-bottom-alt%3Aauto%3B%0A%09margin-left%3A0in%3B%0A%09mso-pagination%3Awidow-orphan%3B%0A%09font-size%3A12.0pt%3B%0A%09font-family%3A%22Times%20New%20Roman%22%2C%22serif%22%3B%0A%09mso-fareast-font-family%3ACalibri%3B%7D%0Aspan.EmailStyle18%0A%09%7Bmso-style-type%3Apersonal-reply%3B%0A%09mso-style-noshow%3Ayes%3B%0A%09mso-style-unhide%3Ano%3B%0A%09mso-ansi-font-size%3A11.0pt%3B%0A%09mso-bidi-font-size%3A11.0pt%3B%0A%09font-family%3A%22Calibri%22%2C%22sans-serif%22%3B%0A%09mso-ascii-font-family%3ACalibri%3B%0A%09mso-fareast-font-family%3ACalibri%3B%0A%09mso-hansi-font-family%3ACalibri%3B%0A%09mso-bidi-font-family%3A%22Times%20New%20Roman%22%3B%0A%09color%3A%231F497D%3B%7D%0Aspan.SpellE%0A%09%7Bmso-style-name%3A%22%22%3B%0A%09mso-spl-e%3Ayes%3B%7D%0A.MsoChpDefault%0A%09%7Bmso-style-type%3Aexport-only%3B%0A%09mso-default-props%3Ayes%3B%0A%09font-size%3A10.0pt%3B%0A%09mso-ansi-font-size%3A10.0pt%3B%0A%09mso-bidi-font-size%3A10.0pt%3B%7D%0A%40page%20WordSection1%0A%09%7Bsize%3A8.5in%2011.0in%3B%0A%09margin%3A1.0in%201.0in%201.0in%201.0in%3B%0A%09mso-header-margin%3A.5in%3B%0A%09mso-footer-margin%3A.5in%3B%0A%09mso-paper-source%3A0%3B%7D%0Adiv.WordSection1%0A%09%7Bpage%3AWordSection1%3B%7D%0A%2D%2D%3E-->

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to