Avatar of vvsrk76
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
DB2SQL

Avatar of undefined
Last Comment
gplana

8/22/2022 - Mon
momi_sabag

Select '01 011' as inpitField , ...
From ...
ASKER CERTIFIED SOLUTION
gplana

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
vvsrk76

ASKER
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
vvsrk76

ASKER
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..
Your help has saved me hundreds of hours of internet surfing.
fblack61
vvsrk76

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

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

for the following reason:

Good
vvsrk76

ASKER
Thank you
gplana

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.

Regards.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.