<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: SQR Evaluate Versus C/Java Switch, Part I*</title>
	<atom:link href="http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/feed/" rel="self" type="application/rss+xml" />
	<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/</link>
	<description>When Peoplebooks Is Not Enough</description>
	<lastBuildDate>Mon, 12 Jul 2010 20:20:25 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-706</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Fri, 19 Jun 2009 23:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-706</guid>
		<description>I think the comment editor deleted most of your code.  Sorry about that - it happens to me too.  I hope you&#039;ve still got it in a text file.  Try again, and if it still doesn&#039;t work, email it to me at steven@peoplesoftsqr.com.</description>
		<content:encoded><![CDATA[<p>I think the comment editor deleted most of your code.  Sorry about that &#8211; it happens to me too.  I hope you&#8217;ve still got it in a text file.  Try again, and if it still doesn&#8217;t work, email it to me at <a href="mailto:steven@peoplesoftsqr.com">steven@peoplesoftsqr.com</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sundeep Kumar</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-696</link>
		<dc:creator>Sundeep Kumar</dc:creator>
		<pubDate>Fri, 19 Jun 2009 18:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-696</guid>
		<description>SOLUTION FOR THE BRAIN TEASER
BEGIN-SELECT
A.ERNCD 
A.EFFDT

from PS_EARNINGS_TBL A
WHERE A.EFFDT = (SELECT MAX(A_ED.EFFDT) FROM PS_EARNINGS_TBL A_ED WHERE A.ERNCD=A_ED.ERNCD AND A_ED.EFFDTSYSDATE)
AND NOT EXISTS (SELECT &#039;X&#039; FROM PS_EARNINGS_TBL WHERE ERNCD = A1.ERNCD AND EFFDT &lt;= SYSDATE)
END-SELECT</description>
		<content:encoded><![CDATA[<p>SOLUTION FOR THE BRAIN TEASER<br />
BEGIN-SELECT<br />
A.ERNCD<br />
A.EFFDT</p>
<p>from PS_EARNINGS_TBL A<br />
WHERE A.EFFDT = (SELECT MAX(A_ED.EFFDT) FROM PS_EARNINGS_TBL A_ED WHERE A.ERNCD=A_ED.ERNCD AND A_ED.EFFDTSYSDATE)<br />
AND NOT EXISTS (SELECT &#8216;X&#8217; FROM PS_EARNINGS_TBL WHERE ERNCD = A1.ERNCD AND EFFDT &lt;= SYSDATE)<br />
END-SELECT</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-97</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Wed, 25 Feb 2009 22:43:03 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-97</guid>
		<description>Yes, a good example of why the expression-type distinction is important came up when we were running SQR against Sybase a long time ago.  At that point, Sybase only supported &quot;+&quot; as the string concatenation operator, so we had to use &quot;+&quot; in SQL expressions and &quot;&#124;&#124;&quot; in SQR expressions.

Another fun point is the different behaviors of the &quot;translate(source,from_set,to_set)&quot; function between Oracle SQL and SQR.  If the value of &quot;from_set&quot; is longer than the value of &quot;to_set&quot;, Oracle will delete any characters from &quot;source&quot; that are in the unmatched characters at the end of &quot;from_set&quot;, while SQR will just ignore them....</description>
		<content:encoded><![CDATA[<p>Yes, a good example of why the expression-type distinction is important came up when we were running SQR against Sybase a long time ago.  At that point, Sybase only supported &#8220;+&#8221; as the string concatenation operator, so we had to use &#8220;+&#8221; in SQL expressions and &#8220;||&#8221; in SQR expressions.</p>
<p>Another fun point is the different behaviors of the &#8220;translate(source,from_set,to_set)&#8221; function between Oracle SQL and SQR.  If the value of &#8220;from_set&#8221; is longer than the value of &#8220;to_set&#8221;, Oracle will delete any characters from &#8220;source&#8221; that are in the unmatched characters at the end of &#8220;from_set&#8221;, while SQR will just ignore them&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-96</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Wed, 25 Feb 2009 00:07:45 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-96</guid>
		<description>Oops, you&#039;re right.  I tried some expressions with an SQR function that didn&#039;t exist in SQL (cond(), edit()).  They failed.  And the cursor report showed that SQR replaced variables with bind variables, but passed the expressions to SQL to interpret.

I guess I&#039;ve always used functions and operators (e.g. substr() and &#124;&#124;) that exist in both languages.  Thanks, I&#039;ve learned something today.</description>
		<content:encoded><![CDATA[<p>Oops, you&#8217;re right.  I tried some expressions with an SQR function that didn&#8217;t exist in SQL (cond(), edit()).  They failed.  And the cursor report showed that SQR replaced variables with bind variables, but passed the expressions to SQL to interpret.</p>
<p>I guess I&#8217;ve always used functions and operators (e.g. substr() and ||) that exist in both languages.  Thanks, I&#8217;ve learned something today.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-95</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Tue, 24 Feb 2009 23:17:36 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-95</guid>
		<description>I suppose SQR for Peoplesoft could be different (though it seems unlikely), but I&#039;m sure that &quot;Hyperion SQR&quot; does not attempt to parse the text of SQL expressions.

For example, I made a symple SQR using contrived BEGIN-SELECTs using the expressions of the style you mentioned above, then ran it with &quot;-s&quot;.  Here are the results:

$ sqr sql_expressions_test.sqr -s
SQR V6.2
Copyright (C) Brio Technology 1994-2001.  All Worldwide Rights Reserved.


Cursor Status:

 Cursor #1:
   SQL = SELECT &#039;x&#039;  from dual where substr(dummy,1,2)=&#039;50&#039; or dummy like
         dummy &#124;&#124; &#039;%&#039; 
 Compiles = 1
 Executes = 1
 Rows     = 1

 Cursor #2:
   SQL = SELECT &#039;y&#039;  from dual where dummy like :1 &#124;&#124; &#039;%&#039; 
 Compiles = 1
 Executes = 1
 Rows     = 0


SQR: End of Run.



Note that the limit of SQRs parsing is to look for SQR variables (i.e. $ or # punctuation marks) and convert those individual tokens in the expression to bind variables.....

I don&#039;t have immediate access to tables with DEPTID and SETID columns, but I think if you repeated the test usuing your original examples in that environment, you would see the same results.

I could list some other evidence of various sorts to support my claim; let me know if you would like further convincing.... :)</description>
		<content:encoded><![CDATA[<p>I suppose SQR for Peoplesoft could be different (though it seems unlikely), but I&#8217;m sure that &#8220;Hyperion SQR&#8221; does not attempt to parse the text of SQL expressions.</p>
<p>For example, I made a symple SQR using contrived BEGIN-SELECTs using the expressions of the style you mentioned above, then ran it with &#8220;-s&#8221;.  Here are the results:</p>
<p>$ sqr sql_expressions_test.sqr -s<br />
SQR V6.2<br />
Copyright (C) Brio Technology 1994-2001.  All Worldwide Rights Reserved.</p>
<p>Cursor Status:</p>
<p> Cursor #1:<br />
   SQL = SELECT &#8216;x&#8217;  from dual where substr(dummy,1,2)=&#8217;50&#8242; or dummy like<br />
         dummy || &#8216;%&#8217;<br />
 Compiles = 1<br />
 Executes = 1<br />
 Rows     = 1</p>
<p> Cursor #2:<br />
   SQL = SELECT &#8216;y&#8217;  from dual where dummy like :1 || &#8216;%&#8217;<br />
 Compiles = 1<br />
 Executes = 1<br />
 Rows     = 0</p>
<p>SQR: End of Run.</p>
<p>Note that the limit of SQRs parsing is to look for SQR variables (i.e. $ or # punctuation marks) and convert those individual tokens in the expression to bind variables&#8230;..</p>
<p>I don&#8217;t have immediate access to tables with DEPTID and SETID columns, but I think if you repeated the test usuing your original examples in that environment, you would see the same results.</p>
<p>I could list some other evidence of various sorts to support my claim; let me know if you would like further convincing&#8230;. <img src='http://peoplesoftsqr.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-94</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Tue, 24 Feb 2009 22:24:46 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-94</guid>
		<description>I think expressions in WHERE and SET can be evaluated by SQL or SQR, depending on their content.  For example,

WHERE SUBSTR(DEPTID, 1, 2) = &#039;50&#039;
OR DEPTID LIKE SETID &#124;&#124; &#039;%&#039;

I would guess the substring function and concatenation are SQL expressions.

WHERE DEPTID LIKE $dept_prefix &#124;&#124; &#039;%&#039;

I would guess that SQR evaluates &quot;$dept_prefix &#124;&#124; &#039;%&#039;&quot; and sends it to the database as a bind variable.

I suspect your theory of SQR evolution is correct, and I wonder about the decision process that led to the apparent practice of freezing old commands, even in the light of new data types.</description>
		<content:encoded><![CDATA[<p>I think expressions in WHERE and SET can be evaluated by SQL or SQR, depending on their content.  For example,</p>
<p>WHERE SUBSTR(DEPTID, 1, 2) = &#8216;50&#8242;<br />
OR DEPTID LIKE SETID || &#8216;%&#8217;</p>
<p>I would guess the substring function and concatenation are SQL expressions.</p>
<p>WHERE DEPTID LIKE $dept_prefix || &#8216;%&#8217;</p>
<p>I would guess that SQR evaluates &#8220;$dept_prefix || &#8216;%&#8217;&#8221; and sends it to the database as a bind variable.</p>
<p>I suspect your theory of SQR evolution is correct, and I wonder about the decision process that led to the apparent practice of freezing old commands, even in the light of new data types.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-89</link>
		<dc:creator>Nathan</dc:creator>
		<pubDate>Tue, 24 Feb 2009 20:57:53 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-89</guid>
		<description>Of course, expressions in WHERE and SET clauses of SQL statements are SQL expressions, not SQR expressions (and the difference is quite important)....

I have never seen manuals from SQR v1 days or anything, but I have always assumed that the first few versions of SQR did not support expressions at all.  Instead, you had only the &quot;simple&quot; commands: ADD, SUBTRACT, EXTRACT, GET, PUT, etc.

Later, it became clear how much a pain it was to do anything at all complicated using only those commands, so the LET command was added to the language, and along with it support for expressions -- but it was &quot;too late&quot; for those expressions to be allowed in the general spots that other languages would allow them (e.g. my personal &quot;favorite&quot;, as arguments to procedure calls)....

(It seems to me that this &quot;theory of SQR evolution&quot; also explains why there is such obvious duplication between the &quot;simple&quot; commands and the functionality available from expressions....)

Similarly, I suspect that support for arrays was added after the language was already established, and in general the support was added by creating new language features rather than by trying to retrofit support to old language features that hadn&#039;t been designed to work with arrays originally.</description>
		<content:encoded><![CDATA[<p>Of course, expressions in WHERE and SET clauses of SQL statements are SQL expressions, not SQR expressions (and the difference is quite important)&#8230;.</p>
<p>I have never seen manuals from SQR v1 days or anything, but I have always assumed that the first few versions of SQR did not support expressions at all.  Instead, you had only the &#8220;simple&#8221; commands: ADD, SUBTRACT, EXTRACT, GET, PUT, etc.</p>
<p>Later, it became clear how much a pain it was to do anything at all complicated using only those commands, so the LET command was added to the language, and along with it support for expressions &#8212; but it was &#8220;too late&#8221; for those expressions to be allowed in the general spots that other languages would allow them (e.g. my personal &#8220;favorite&#8221;, as arguments to procedure calls)&#8230;.</p>
<p>(It seems to me that this &#8220;theory of SQR evolution&#8221; also explains why there is such obvious duplication between the &#8220;simple&#8221; commands and the functionality available from expressions&#8230;.)</p>
<p>Similarly, I suspect that support for arrays was added after the language was already established, and in general the support was added by creating new language features rather than by trying to retrofit support to old language features that hadn&#8217;t been designed to work with arrays originally.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-37</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Fri, 30 Jan 2009 20:28:07 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-37</guid>
		<description>I forgot &lt;strong&gt;if&lt;/strong&gt; and &lt;strong&gt;while&lt;/strong&gt;!  I&#039;m blushing.  Expressions can also be in &lt;strong&gt;where&lt;/strong&gt; clauses of SQL statements (&lt;strong&gt;delete&lt;/strong&gt;, &lt;strong&gt;select&lt;/strong&gt;, &lt;strong&gt;update&lt;/strong&gt;) and on the right side of a &lt;strong&gt;set&lt;/strong&gt; within an &lt;strong&gt;update&lt;/strong&gt; SQL statement.</description>
		<content:encoded><![CDATA[<p>I forgot <strong>if</strong> and <strong>while</strong>!  I&#8217;m blushing.  Expressions can also be in <strong>where</strong> clauses of SQL statements (<strong>delete</strong>, <strong>select</strong>, <strong>update</strong>) and on the right side of a <strong>set</strong> within an <strong>update</strong> SQL statement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-36</link>
		<dc:creator>Kevin</dc:creator>
		<pubDate>Fri, 30 Jan 2009 18:11:48 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-36</guid>
		<description>Expressions are also allowed in IF and WHILE, but I think that might be it. These and LET sort of remind me of old BASIC. You mentioned COBOL. Then there are even hints of C in that two commands (EXTRACT and FIND) use string offsets that start at 0 instead of 1.</description>
		<content:encoded><![CDATA[<p>Expressions are also allowed in IF and WHILE, but I think that might be it. These and LET sort of remind me of old BASIC. You mentioned COBOL. Then there are even hints of C in that two commands (EXTRACT and FIND) use string offsets that start at 0 instead of 1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2009/01/sqr-evaluate-versus-cjava-switch-part-i/comment-page-1/#comment-32</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Wed, 28 Jan 2009 05:52:58 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=136#comment-32</guid>
		<description>You bring up so many good points, I hardy know where to begin.

The C switch and the SQR evaluate may serve different purposes, just as the C language (sometimes called a high level assembler) and the SQR language (perhaps an interpreter of a streamlined version of COBOL with enhanced output) serve different purposes.  The switch command might speed up a program while the evaluate command might untangle the source code.  I decided to compare them because the SQR Language Reference minimized their differences.

If it stunned you to learn that SQR won&#039;t take an expression as the test value, brace yourself.  SQR&#039;s nouns (data objects) and verbs (commands) are far from orthogonal.  Many commands take scalar values (literals and variables) but not array elements.  Some commands take literals but not variables.  And very few commands take expressions.  I&#039;ll have to research it, but I think expressions are only allowed in the let command.</description>
		<content:encoded><![CDATA[<p>You bring up so many good points, I hardy know where to begin.</p>
<p>The C switch and the SQR evaluate may serve different purposes, just as the C language (sometimes called a high level assembler) and the SQR language (perhaps an interpreter of a streamlined version of COBOL with enhanced output) serve different purposes.  The switch command might speed up a program while the evaluate command might untangle the source code.  I decided to compare them because the SQR Language Reference minimized their differences.</p>
<p>If it stunned you to learn that SQR won&#8217;t take an expression as the test value, brace yourself.  SQR&#8217;s nouns (data objects) and verbs (commands) are far from orthogonal.  Many commands take scalar values (literals and variables) but not array elements.  Some commands take literals but not variables.  And very few commands take expressions.  I&#8217;ll have to research it, but I think expressions are only allowed in the let command.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
