[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to use bitand operator?

Posted on 2002-03-05
8
Medium Priority
?
674 Views
Last Modified: 2007-12-19
How can I use bitand so I can turn on TESTING only when the TYPE_NAME is SOFTWARE or S/W REQUEST

SQL> select * from state
  2  ;

   STATEID STATE_NAME    STATE_FOR PB_WEB_VISIBLE_TYPE
---------- -------------------------------- ---------- -------------------
         1 SCHEDULED    0                     0  
         2 DEFERRED     0                      0        
         3 TESTING      0                     0

SQL> select * from type;

    TYPEID TYPE_NAME
---------- --------------------------------
         0 SOFTWARE
         1 S/W REQUEST
         2 SYSTEM
         
Here's an example of what I found.. but I am not sure how to use it...
SQL> select decode(bitand( 24117, power(2,4)), power(2,4), '1', '0') from dual;

DECODE(BITAND(24117,POWER(2,4)
--------------------------------
1


Help please...
Thanks
0
Comment
Question by:sdesar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 

Author Comment

by:sdesar
ID: 6842895
I think I have to di someting like this-
SQL> select state_name from web_state  where decode(bitand(pb_web_visible_type,  power(2,0)), power(
2,0), 1,0) = 1;

But I get a ....no rows selected... message.



0
 
LVL 22

Expert Comment

by:DrSQL
ID: 6844098
sdesar,
   I'm having some trouble following your request.  Your examples show a bitand on PB_WEB_VISIBLE_TYPE which is 0 in the cases you have (from state).  And the table WEB_STATE isn't described anywhere.  Finally, your follow-up post changes your "power" from 2,4 to 2,0 (or, from 16 to 1).

   Could you try posting your requirement again, or at least more of what your dealing with?  Like, what does it mean to "turn testing on"?

Good luck!
0
 

Author Comment

by:sdesar
ID: 6845003
Oops sorry I meant STATE table.

I want to show STATE 'TESTING only when the TYPE is SOFTWARE or S/W REQUEST
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:sdesar
ID: 6845809

SQL> select * from web_state;

   STATEID STATE_NAME   TYPEID PB_WEB_VISIBLE_TYPE
---------- --------- ---------- -------------------
         1 SCHEDULED       0                   0
         2 DEFERRED        0                   0
         3 TESTING         0                   0
         5 CLOSED          0                   0
         2 DEFERRED        1                   0
         3 TESTING         1                   0
         5 CLOSED          1                   0
         0 OPEN            1                   0
         5 CLOSED          2                   0
Currently, web_state is a lookup table and I can tell what TYPES have what STATES.

Thefore, question is how can I use the 'bitand' to display only TESTING if 'TYPEID' is 0 or 1 ie software or software request.

I need to know what kind of select shold I use so I can modifiy the JSP to show only TESTING if type is 0 or 1.

I hope this clarifies it a bit.
Awaiting suggestions.
Thanks
0
 
LVL 22

Accepted Solution

by:
DrSQL earned 200 total points
ID: 6847274
sdesar,
   I'm not sure why you believe that the bitand is the answer.  To get a list of all of the web_state entries showing TESTING whenever it's a TYPEID of 0 or 1:


1) Assume there IS a "state" table and you want no cheating by using what's in web_state:

select w.stateid,w.state_name,w.typeid,w.PB_WEB_VISIBLE_TYPE,
s.STATE_NAME STATE_SETTING
  from web_state w, states s
 where s.stateid = decode(w.typeid,0,3,1,3,w.STATEID);

2) Assume there is no "state" table and you just want to override the state_name column value:

select stateid,state_name,typeid,PB_WEB_VISIBLE_TYPE,
       decode(w.typeid,0,'TESTING',1,'TESTING',
                                STATE_NAME) STATE_SETTING
  from web_state;

3) If you want to actually CHANGE the state in the table:

update web_state set stateid=3, state_name='TESTING'
 where typeid in (0,1);

I still don't feel like I know what you're trying to do (other than use bitand).  The relational design is a little confusing (do you have state_name in two tables, or one) and I'm not sure what the JSP is trying do do, but the first two selects will do what you asked.  Post again if this is still missing the point.

Good luck!
0
 

Author Comment

by:sdesar
ID: 6851747
I have a jsp that that a TYPE comboBox... this lists only SOFTWARE, S/W REQUEST, SYSTEM.

I want the STATE combox to display - OPEN, TESTING, CLOSED only if the TYPE is SOFTWARE or S/W REQUEST.  
else
display only OPEN CLOSED.

When I enter this JSP I know the TYPE of ticket it is .. ie SOFTWARE or S/W REQUEST or SYSTEM

therefore instead of hardcoding the logic in the jsp.. I am wondering how and if I can use the bitand operator to set the bits to true, false.

Thanks
0
 
LVL 2

Expert Comment

by:ddandekar
ID: 6885109
You can check asktom.com site.
There is an example of bitand operator.
0
 

Author Comment

by:sdesar
ID: 6891308
Awesome Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question