Link to home
Start Free TrialLog in
Avatar of vvsrk76

asked on

Need Select SQL Return results includes the INPUT value..

I have select SQL with Where clause..

Select partnumber,description from IMCCRP.IMC_PARTSEARCH_MQT where partnumber = Replace('01 011',' ','')

Result Output:
PartNumber     Description
01011               ignition

I need the SQL with input parameter in the result..

inputValue      PartNumber       Description
01 011             01011                 ignition

input value should display in the result set as Column(inputValue).Please help me in this.

Thank You
Avatar of momi_sabag
Flag of United States of America image

Select '01 011' as inpitField , ...
From ...
Avatar of gplana
Flag of Spain image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vvsrk76


Thank You.

I am using Preapred Statment in java. Can I put "?" in the statement..

Select ? as inputField, crossref, partnumber from imc.PARTSEARCH_MQT where crossref = Replace(?,' ','')

I am getting the below Error.

Error during Prepare
42610(-418)[IBM][CLI Driver][DB2/LINUXX8664] SQL0418N  A statement contains a use of an untyped parameter marker, the DEFAULT keyword, or a null value that is not valid.  SQLSTATE=42610
Avatar of vvsrk76


Thank You It is working with below statment..

Select cast(? as varchar(64)) as inputField, crossref, partnumber from imc.PARTSEARCH_MQT where crossref = Replace(?,' ','')

Thak You..
Avatar of vvsrk76


I've requested that this question be closed as follows:

Accepted answer: 0 points for vvsrk76's comment #a39049711

for the following reason:

Avatar of vvsrk76


Thank you
Sorry, I were sleeping ! :)

You are right: my select statement can be used with java prepared statements, however, as you noticed, sometimes some casting is required.

I'm happy to know I have contributed to found your solution.