I assume from the heading and tags you are looking for an SQL answer...
That's just a guess.
Why not just use "WHERE (EMPID IS NULL)" and drop the test to itself.
Last Wiki Answer Submitted: March 30, 2012 2:07 pm by ToddN20003,910 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
This is the where clause from an SQL statement.
*BLANKS is an RPG literial but that doesn’t extend into the SQL precompiler.
So your where clause might look something like this.
WHERE (EMPID = ‘ ‘ OR EMPID = :EMPID)
This would accept rows with blank employee ids or where the empid = the RPG value of EMPID.
Phil
Hi Carlos
I think the first respondees missed the SQL issue and ‘:’ is a bit small to see for my old eyes. But you’re correct as an embedded SQL where clause in RPG it’s using the RPG field EMPID to compare with the database field EMPID.
Phil
WHERE (EMPID=:*BLANKS OR
EMPID=:EMPID)
Why would you check to see if a values of a field is equal to itselt?
And how do you know there is somehting wrong with *BLANKS
Is this RPG, CL ot some other language?
This is the where clause from an SQL statement.
*BLANKS is an RPG literial but that doesn’t extend into the SQL precompiler.
So your where clause might look something like this.
WHERE (EMPID = ‘ ‘ OR EMPID = :EMPID)
This would accept rows with blank employee ids or where the empid = the RPG value of EMPID.
Phil
I would think that this condition “EMPID=:EMPID” is not comparing a field to itself…
In my non-400 world, :EMPID would be called a “bind variable”.
Hi Carlos
I think the first respondees missed the SQL issue and ‘:’ is a bit small to see for my old eyes. But you’re correct as an embedded SQL where clause in RPG it’s using the RPG field EMPID to compare with the database field EMPID.
Phil
Basically, there is no such host variable named “*BLANKS”. Therefore, it can’t used where a host variable is needed.
The word “*BLANKS” is a “figurative constant” rather than a variable. It is only known to the RPG compiler. SQL has no knowledge of it.
Phil’s example of simply using {EMPID = ‘ ‘} is best for this.
Tom