How to retreive week days from bit mask value

Hi!
I have a column 'DOW' that store days of the week using bit mask value. Here is how it works:
SUN = 1
MON = 2
TUE = 4
WED = 8
THU = 16
FRI = 32
SAT = 64
All days of week is 127 which is cumulative of all the above. If user selects MON+FRI, then value would be 34.
I need to retrieve data from this column showing the actual day names, separated by a comma. For example, Monday, Friday
Is it possible in Oracle 10g to do this via SQL, if so how?
Any help is deeply appreciated..
Thanks,
Arti

Did you try that beautiful Query, Provided by Blushadow..?
SQL> select c1,rtrim(DECODE(bitand(c1, 1),1,'Sun,',NULL)||
  2            DECODE(bitand(c1, 2),2,'Mon,',NULL)||
  3            DECODE(bitand(c1, 4),4,'Tue,',NULL)||
  4            DECODE(bitand(c1, 8),8,'Wed,',NULL)||
  5            DECODE(bitand(c1, 16),16,'Thu,',NULL)||
  6            DECODE(bitand(c1, 32),32,'Fri,',NULL)||
  7            DECODE(bitand(c1, 64),64,'Sat,',NULL),',') days
  8  from test;
        C1 DAYS
         1 Sun
         2 Mon
        16 Thu
         9 Sun,Wed
       127 Sun,Mon,Tue,Wed,Thu,Fri,Sat
        34 Mon,Fri
6 rows selected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • How to subtract a day from the presentation variable @{system.currentTime}

    Hello,
    How can subtract a day from the presentation variable - @{system.currentTime}
    I use the above as a title in the report. However I want to subtract a day from the above variable. How can I accomplish it?
    Thanks.

    Hi,
    Did you try the steps which I mentioned above. You can use TIMESTAMPADD function in many places in your report but I think not in title section of the title view.
    Also you can try using Narrative view instead of title view to achieve this. Follow below steos:
    * Pull another column in the report and change its fx to TIMESTAMPADD(SQL_TSI_DAY, -1, @{system.currentTime})
    * Now go to the Narrative view and add the below text in Narrative section of the view.
    Active Person Report as of @1
    Here @1 assuming the new column created is placed before all the columns in the request.
    * Also set the 'Rows to Display' as 1.
    * Delete Title view from the report and this narrative view on top of your report.
    Hope this helps.
    Thanks

  • How do I calculate days from two different dates?

    Hi all,
    How do I calculate days from two different dates?
    my requirement is to pass the number of days to target field from two dates.
    Current date :  14/04/2010
    Standard date: 01/01/1957 is the standard = day 0
    Is it possible in graphical mapping with out  udf?
    Plz help me on this I have donu2019t have much knowledge on JAVA.
    Thanks

    Hi Yadav,
    Probably this is not the correct forum for XI / PI .
    You can post the same to...
    Process Integration (PI) & SOA Middleware
    Hope this helps.
    Regards
    Raj

  • How do I calculate days from two different dates in XI/PI?

    Hi all,
    How do I calculate days from two different dates in XI/PI?
    my requirement is to pass the number of days to target field from two dates.
    Current date : 14/04/2010
    Standard date: 01/01/1957 is the standard = day 0
    Is it possible in graphical mapping with out udf?
    Plz help me on this I have donu2019t have much knowledge on JAVA.
    Thanks

    Hi Yadav,
    Probably this is not the correct forum for XI / PI .
    You can post the same to...
    Process Integration (PI) & SOA Middleware
    Hope this helps.
    Regards
    Raj

  • How to recover weekly jobs from the past schedules

    How to recover weekly jobs from the past schedules

    Hi
    You may also need to check the 'Scheduled' option to check for jobs which were schduled but were never released.
    Regards
    Sandeep

  • Where is URL stored in CRM tables How to retreive URL address from table

    Hi,
    Can any one tell where URL address is stored in CRM.
    And how to retreive URL Address from CRM tables.
    As i'm not able to find exactly how to retrive the url form the tables. as the URL address is not visible.
    Thanks & Regards,
    Rajender.
    Edited by: Rajender k on Aug 12, 2008 6:37 PM

    I am not able to get you. Please rephrase or elaborate.

  • How to calculate week number from system date

    Hi experts,
    how to calculate week number from system date  ?
    thanks.
    SK

    hi,
    The above FM can be used for BADI or customer exit, if it is design level then you can use formula as well, under formula date functions you can use DATE_TO_WEEK.
    regards,
    Arvind.

  • How to retreive Thunderbird files from a hard drive backup due to having hard drive replaced.

    My hard drive crashed but I was able to backup to external drive the day before. Dell replaced the hard drive and I did a restore from back up but I can't find the Thunderbird profile files from the back up to put into my new Thunderbird on the new hard drive. Where can I find them on the backup and how can I import them to the new application of Thunderbird?

    See https://support.mozilla.org/en-US/kb/profiles-tb to locate your profile on the old hard drive.
    Then locate your profile on the new drive.
    Copy the xxxxxxxx.default from your old drive to the same folder that your new one is in; so now you have <old 8-char>.default and <new 8-char>.default in the same folder.
    See https://support.mozilla.org/en-US/kb/using-multiple-profiles to switch from the new one to the old one.

  • How to get week number from date

    Hi,
       please mention how to get the number of week from a particular date using fn module?

    Hi Debarshi,
                       Use FM <b>DATE_GET_WEEK</b>
    Reward points if helpful.
    Regards,
    Hemant

  • Get the date of a particular week day from given date

    I have a given date.
    from that date i want to get the date of sunday of that week
    wat is the best possible way to do the same.
    for eg:
    if i am given 03/11/2007 which is a saturday
    i want to get 27/10/2007 which is the sunday which falls in the same week as of 03/11/2007
    can anybody please help.

    hi,
    Here I am posting code for your requirement.
    Here I am hard coding the date value.
    import java.util.*;
    public class DateTest{
         public static void main(String ar[]){
              Calendar calendar =new GregorianCalendar(2007,7,4);
              System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
              calendar.set(2007,7,4-calendar.get(Calendar.DAY_OF_WEEK)+1);
              System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
              System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
    }

  • How to retreive a video from icloud

    I accidently deleted a video that was very important.  I had not synced it yet.  I have my icloud set to automatically send photos/videos to icloud.  I can always see the photos under the photo stream, but videos don't show there.  Can someone tell me how to check icloud and see if the video happened to be uploaded or how to download from it?
    Thanks.

    http://support.apple.com/kb/HT4859

  • How to retreive x/y from mdsys.sdo_geometry

    I need to retreive the coord pair for a point table. If I use:
    select p.id, p.shape.sdo_point.x, p.shape.sdo_point.y from pointdatastore p
    the returned result is null. Said table was created from ESRI tools via ArcSDE which I believe is the root problem. I'm a newbie to Spatial but a lot of years with ESRI tools.
    Any help.

    Neil,
    Are you certain ESRI is storing the points as a SDO_POINT type? Although I do not know for certain I expect they are not - which is why you would be coming up with NULLs. Rather ESRI is probably using the ordinate array which you can select vertices from using SDO_UTIL.GETVERTICES (which is found in Oracle Spatial). here's the corresponding documentation:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/sdo_util.htm#BABDEGIA
    I hope this helps.
    -Justin

  • How to retreive out parameters from function in sql statement

    hi dear,
    Suppose i have a fuction with two "out" parameters, i want to show the values of these paramenters in sql stm.
    like
    select my_function() from dual;
    Thanx

    Can't be done. To use a function in SQL it can only have a single return value.
    Try something like this changing the data types appropriately.
    var x number
    var y number
    var z number
    exec :x := my_function(:y, :z)
    print

  • How to find 90 days from today?.

    Post Author: cruser08
    CA Forum: Formula
    is this formula will do always?...i want a general formula.
    dateserial(year(currentdate)-1, month(dateadd("m", -3, currentdate)),Day (currentdate))

    Post Author: SKodidine
    CA Forum: Formula
    currentdate - 90 was my original proposed solution, but when I ran it on 03/04/2008, it gave me a result of 12/04/2007, whereas it should have been 12/05/2007.  Dateadd('d',-90,currentdate) also run on 03/04/2008 gave the correct result of 12/05/2007.  I believe currentdate - 90 was not taking the leap year into account.

  • How to retreive a record from access DB using Java?

    I have an access DB, I'm trying to get a record from the access DB, I need clue to keep going, please check my code belowpackage PermutPack;
    import java.sql.*;
    public class BD_Connection {
          public static void main(String[] args){
               try {
                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                  // set this to a MS Access DB you have on your machine
                  String filename = "C:/Dev-Java/Permutation/Lexiteria_US.mdb";
                  String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
                  database+= filename.trim() + ";DriverID=22;READONLY=true}"; // add on to the end
                  // now we can get the connection from the DriverManager
                  Connection con = DriverManager.getConnection( database ,"","");
                  Statement st = con.prepareStatement("SELECT word FROM Lexiteria_BD WHERE ID = 5688");
                  System.out.println("st: "+st);
                 /* PreparedStatement pstmt2 = con.prepareStatement(
                          "SELECT a, b, c FROM Table1", ResultSet.TYPE_SCROLL_SENSITIVE,
                          ResultSet.CONCUR_UPDATABLE);
              ResultSet rs = pstmt2.executeQuery();*/
               catch (Exception e) {
                  System.out.println("Error: " + e);
    }

    ronisto wrote:
    Good but if I do System.out.println("ps: "+ps); I'm getting "ps: sun.jdbc.odbc.JdbcOdbcPreparedStatement@13c5982"Right, that's the reference value of the Java object. Immaterial.
    Does the query work now?
    You realize, of course, that you have to call executeQuery() on the PreparedStatement and then get the results out of the ResultSet.
    Maybe you need a JDBC tutorial to brush up on the basics. Google for "Sun JDBC tutorial".
    %

Maybe you are looking for

  • App Store does not allow me to choose different Apple ID to sign in

    I have an iMac that is connected to a network, and has different accounts.  My account has admin rights and I am able to manage the computer settings, but for some reason when I open the App store window, and when I am trying to download some updates

  • Safari version? for 10.6.8

    I deleted Safari and now can't find a version that would install on my MacMini running 10.6.8. Where (website) should I go? Which version of Safari is appropriate? Any caveats?

  • MCOD Installation - Error ORA-1403 when accessing table SAPUSER

    Hello. We are in middle of a MCOD installation of 4.7 x 2.00 SR1 with BW 3.1 on Windows 2003/Oracle. BW 3.1 is up and running, while 4.7 fails on R3loads. Following are SAP000.log and SAPUSER.log files: SAP000.log =============================== D:\u

  • Upgrade to OS 6 took up all space on device memory

    I recently upgraded my Curve 9300 from OS 5 to OS 6. The upgrade has taken up over 144 MB of space of the DEVICE memory. leaving barely any space free on the device. can anything be done about it? Shouldnt an upgrade have removed the older s/w? Eithe

  • Contact info for customer service?

    I purchased a FormsCentral Teams plan for my nonprofit.  The product is great, but the customer service is the worst I've ever experienced.  I'm getting triple-billed and I seem to have also lost my Teams plan in the process.  The representatives on