IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

LOW VALUES in DB2 columns


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pdevidas12

New User


Joined: 28 Feb 2010
Posts: 3
Location: Pune

PostPosted: Mon Aug 30, 2010 6:14 pm
Reply with quote

HI
WHEN WE HAVE LOW VALUES IN COLUMN SUPPOSE NAME SO HOW I CAN GET ALL THE ROWS WHERE I HAVE THE LOW VALUES. LIKE
SELECT * FROM TABLE WHERE NAME = "PDEVDAS12"
SO WHAT WE HAVE TO GIVE IN NAME TO FIND OUT ALL COLUMN WHERE VALUES ARE "LOW VALUES"

THANKS
PDEVIDAS12IN c
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Aug 30, 2010 6:34 pm
Reply with quote

first, do not write in capital letters
second, define LOW VALUES
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 30, 2010 6:34 pm
Reply with quote

Quote:
SELECT *

that is very poor sql. you should select only those columns that you need.

I will attribute your wording of your question as a language thing.

low-values is a COBOL literal, has nothing to do with db2

you want to select 'what' WHEN NAME = X'0000000000' ?
the literal has to be the same number of characters as the column NAME

if NAME is CHAR(10) the literal has to be x'00000000000000000000'

if NAME is varchar you will need to substring the literal for the length of the column NAME length.

are you sure that all bytes of the column NAME are binary zeroes?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Mon Aug 30, 2010 6:43 pm
Reply with quote

pdevidas12 wrote:
HI
WHEN WE HAVE LOW VALUES IN COLUMN SUPPOSE NAME


What is the definition of the column in the table?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 30, 2010 8:11 pm
Reply with quote

Hello,

Is this a person's name rather than a database column name?

What if the value is not x'0000000000. . .' but rather multiple non-printable characters (i.e. x'122334. . .'? A test for "low-values" will be not-equal, but i suspect you would want these identified.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Aug 30, 2010 8:37 pm
Reply with quote

Okay, based on a pure guess, please try this:
Code:
SELECT NAME FROM TABLE
WHERE LENGTH (NAME) > LENGTH (REPLACE(NAME, X?00?,'') ;
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Aug 30, 2010 8:42 pm
Reply with quote

Hi Anuj,

Why is LENGTH mentioned?

Devidas, if you want help, you have to participate. . .
Back to top
View user's profile Send private message
pdevidas12

New User


Joined: 28 Feb 2010
Posts: 3
Location: Pune

PostPosted: Tue Aug 31, 2010 6:45 pm
Reply with quote

First Sorry to Moderator,,,, Next time onward I will post queries in small letters only.

I have faced this question in interview, It may possible he/she may have confused me with LOW-VALUES of DB2 and COBOL. But if at all there wont be any "LOW VALUES" in DB2?

thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 31, 2010 6:50 pm
Reply with quote

low-values is a COBOL figurative constants that means binary-zeroes.

and no, it is conceivable to find binary-zeros in char data type columns.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top