Hi,
VALUES as replacement for a dummy select statement was introduced with
release 6.1.
The advantage of VALUES over a dummy select statement is, the function can
be accessed directly, while with a dummy select statement a query
optimization (i.e. FULL OPEN) must be performed. Even though those
optimizations are fast, if you need to execute a lot of those dummy
statements, performance may decrease noticeable.
VALUES ... INTO is another animal, which can be used in SQL programming as
replacement for SELECT ... INTO or SET, to return a single row (or value)
out of an SELECT-Statement.
Contrary to SELECT ... INTO, VALUES ... INTO can be used with dynamic SQL.
VALUES ... INTO is available for a long time. IIRC I already used it with
the releases V4.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
Lennon_s_j@xxxxxxxxxxx
Gesendet: Friday, 01. October 2010 02:52
An: midrange-l@xxxxxxxxxxxx
Betreff: Re: Get next Tuesday. Or the one after (VALUES)
Interesting info on values.
I was running from the green screen STRSQL on a V5R3 system. Tonight I
tried using values:
values week(Current date)
INTO clause missing from embedded statement.
So I'm guessing you can use it only in embedded SQL. Or else I'm doing
it wrongly.
I also took a peek at the V6R1 SQL Reference and it still contains
numerous examples that use SYSDUMMY1. Do you recall where you saw it as
deprecated?
(Finally found the V7R1 reference and it seems to contain the same examples)
Thanks, Sam
On 9/30/2010 9:30 AM, rob@xxxxxxxxx wrote:
The use of sysdummy1 has been deprecated on supported versions of the
operating system. I suggest you use VALUES instead of SELECT for
instances when you are tempted to use sysdummy1
Replace:
select week(current date) from sysibm/sysdummy1
With:
values week(current date)
or in sql rpg
exec sql values week(current date) into :WeekNumber;
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.