Is it possible to Hexadecimal or Binary Value as the input to WHERE clause in query?
Question posted by: Praveen
(Guest)
on
November 12th, 2005 10:10 AM
Hi,
I am a newbie in DB2 and mainframe technology. While compiling a query
I cam across a situation where I had to give a Hex value as the input
to a query; i.e. WHERE file_status = x'00'. Is this correct.
More over if I were to give a BINARY as the input instead, How is it
done?
Please forgive if my question is baseless and silly. Guide me please.
Thank you very much.
3
Answers Posted
Hi,
You can try this:
"Select * from <table_name> where HEX(file_status)=x'00';" .
similar to "select HEX(file_status) from <table_name>;"
Hope this helps,
JWK(RdR)
"Praveen" <praveen.unnithan@gmail.com> wrote in message
news:1107773354.755779.44810@l41g2000cwc.googlegro ups.com...[color=blue]
> Hi,
>
> I am a newbie in DB2 and mainframe technology. While compiling a query
> I cam across a situation where I had to give a Hex value as the input
> to a query; i.e. WHERE file_status = x'00'. Is this correct.
>
> More over if I were to give a BINARY as the input instead, How is it
> done?
>
> Please forgive if my question is baseless and silly. Guide me please.
>
> Thank you very much.
>[/color]
Ooops,
It should be without the "x" in between "=" and the first single quote:
"Select * from <table_name> where HEX(file_status)='00';"
Thanks,
RdR
"RdR" <rrosario@datamirror.com> wrote in message
news:lnPNd.90493$vO1.566400@nnrp1.uunet.ca...[color=blue]
> Hi,
>
> You can try this:
>
> "Select * from <table_name> where HEX(file_status)=x'00';" .
>
> similar to "select HEX(file_status) from <table_name>;"
>
> Hope this helps,
>
> JWK(RdR)
> "Praveen" <praveen.unnithan@gmail.com> wrote in message
> news:1107773354.755779.44810@l41g2000cwc.googlegro ups.com...[color=green]
> > Hi,
> >
> > I am a newbie in DB2 and mainframe technology. While compiling a query
> > I cam across a situation where I had to give a Hex value as the input
> > to a query; i.e. WHERE file_status = x'00'. Is this correct.
> >
> > More over if I were to give a BINARY as the input instead, How is it
> > done?
> >
> > Please forgive if my question is baseless and silly. Guide me please.
> >
> > Thank you very much.
> >[/color]
>
>[/color]
Thanks a zillion RdR. That was really helpfull.
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 196,926 network members.
Top Community Contributors
|