10 pts.
 SQLRPGLE Prepare
When using the prepare statement I'm creating a string that contains my select statement... I want to compare a numeric field within my string. For example I have batch# which is numeric, how can I say where batch# = 21

Software/Hardware used:
ASKED: April 2, 2010  7:11 PM
UPDATED: April 5, 2010  7:27 PM

Answer Wiki:
Ok your statement might look like this: Stmt = 'Select x,y,z from myfile where batch# = ' + %editc(reqBatch# : 'Z') where batch# is a numeric field in myfile reqBatch# has the reqired numeric value by the time that this string is built. Phil
Last Wiki Answer Submitted:  April 3, 2010  12:51 am  by  philpl1jb   44,130 pts.
All Answer Wiki Contributors:  philpl1jb   44,130 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Note that technically the name “batch#” is invalid in SQL. The “#” (hash or pound symbol) is not in past SQL language character sets.

You might need to enclose the column name in full-quotes (double quote marks, i.e., [ " ]) or maybe even create a view that renames the column.

Stmt = 'Select x,y,z from myfile where "BATCH#" = ' + %editc(reqBatch# : 'Z')

Tom

 107,995 pts.