Query like Calendar

Hi, Expert
Can i used only select statement to find query ....
( If sysdate is '03-Jul-07' ) like calendar ...
Date_No Date_Name
01 SUN
02 MON
03 TUE
14 SAT
15 SUN
16 MON
30 MON
31 TUE
Select ... from dual;
Best Regard
First_Step

Problem only is that it is NLS dependent:
michaels>  alter session set nls_territory=germany
Session altered.
michaels>  with pivot as
     (select     trunc (sysdate, 'mm') + level - 1 as dt,
                 abs (to_number (to_char (trunc (sysdate, 'mm') + level - 1,
                                          'd'
                      - to_number (to_char (to_date ('03010001', 'ddmmyyyy'),
                                            'd'
                     ) down
            from dual
      connect by level <= (last_day (sysdate) - trunc (sysdate, 'mm')) + 1)
select   max (decode (down, 0, dt)) as monday,
         max (decode (down, 1, dt)) as tuesday,
         max (decode (down, 2, dt)) as wednesday,
         max (decode (down, 3, dt)) as thursday,
         max (decode (down, 4, dt)) as friday,
         max (decode (down, 5, dt)) as saturday,
         max (decode (down, 6, dt)) as sunday
    from pivot
group by trunc ((to_number (to_char (dt, 'dd')) + 7 - down) / 7)
MONDAY   TUESDAY  WEDNESDA THURSDAY FRIDAY   SATURDAY SUNDAY 
                                                      01.07.07
02.07.07 03.07.07 04.07.07 05.07.07 06.07.07 07.07.07 08.07.07
09.07.07 10.07.07 11.07.07 12.07.07 13.07.07 14.07.07 15.07.07
16.07.07 17.07.07 18.07.07 19.07.07 20.07.07 21.07.07 22.07.07
23.07.07 24.07.07 25.07.07 26.07.07 27.07.07 28.07.07 29.07.07
30.07.07 31.07.07                                            
michaels>  alter session set nls_territory=america
Session altered.
michaels>  with pivot as
     (select     trunc (sysdate, 'mm') + level - 1 as dt,
                 abs (to_number (to_char (trunc (sysdate, 'mm') + level - 1,
                                          'd'
                      - to_number (to_char (to_date ('03010001', 'ddmmyyyy'),
                                            'd'
                     ) down
            from dual
      connect by level <= (last_day (sysdate) - trunc (sysdate, 'mm')) + 1)
select   max (decode (down, 0, dt)) as monday,
         max (decode (down, 1, dt)) as tuesday,
         max (decode (down, 2, dt)) as wednesday,
         max (decode (down, 3, dt)) as thursday,
         max (decode (down, 4, dt)) as friday,
         max (decode (down, 5, dt)) as saturday,
         max (decode (down, 6, dt)) as sunday
    from pivot
group by trunc ((to_number (to_char (dt, 'dd')) + 7 - down) / 7)
MONDAY    TUESDAY   WEDNESDAY THURSDAY  FRIDAY    SATURDAY  SUNDAY  
02-JUL-07 03-JUL-07 04-JUL-07 05-JUL-07 06-JUL-07 07-JUL-07         
09-JUL-07 10-JUL-07 11-JUL-07 12-JUL-07 13-JUL-07 14-JUL-07         
16-JUL-07 17-JUL-07 18-JUL-07 19-JUL-07 20-JUL-07 21-JUL-07         
23-JUL-07 24-JUL-07 25-JUL-07 26-JUL-07 27-JUL-07 28-JUL-07         
30-JUL-07 31-JUL-07                                                 

Similar Messages

  • How to import or sync Exchange server data like Calendar, Contacts with a web application or web service

    How to import or sync Exchange data like Calendar, Contacts with a web application or web service.
    1. Is there any API to import contacts and calendar (tasks and events) from exchange server to my calendar in web application using web services or http request. the user would have provided the username and password for his exchange account.
    2. Is there any licensing involved to communicate with exchange server for its data.
    thanks in advance 

    I am bit lost here; i have my exchange credentials, how (or) can i use the above mentioned solution for windows application or web services. can you please point in the right direction. my requirement is this: how to sync exchange data with a third party
    app or webapp(my development) using EWS. how to start with, starting point and steps to do[just overview ;)].

  • Can we have a query like

    Hi friends,
    I would like to know if this could be possible
    we have some 20 business like bus_ind, bus_usa, bus_jap...
    I have to do the below query each of the business
    for bus_ind
    SELECT COUNT(*)
    FROM bus_ind
    WHERE
    workdate BETWEEN TO_DATE('01/01/2008','DD/MM/YYYY') AND TO_DATE('31/12/2008','DD/MM/YYYY') AND
    workid NOT IN (6,7) AND
    NOT EXISTS (SELECT 'X' FROM bus_ind WHERE somecol = workid);
    instead of having 20 such query i was trying to see if there is a possibility to have a table like
    shytest
    id, tbl
    1 bus_ind
    2 bus_jap
    3 bus_usa
    and a single query like
    SELECT COUNT(*)
    FROM (select tbl from shytest where id=1)
    WHERE
    workdate BETWEEN TO_DATE('01/01/2008','DD/MM/YYYY') AND TO_DATE('31/12/2008','DD/MM/YYYY') AND
    workid NOT IN (6,7) AND
    NOT EXISTS (SELECT 'X' FROM bus_ind WHERE somecol = workid);
    Thanks
    -vish

    According to your requirnment there should be only one table for all the bussinesses with different partitions for all the bussiness.
    For now you can also create one veiw for all the business.. & fire you all query on that
    create or replace view business_view as
         select 'bus_ind' as business_loc, col1, col2, ... from bus_ind union all
         select 'bus_usa' as business_loc, col1, col2, ... from bus_usa union all
         ...Or you can also use Dynamic sql as all other are suggesting.
    Regards
    Singh

  • CAn we write a query like this

    CAn we write a query like this?
    If not how can this be changed?
    select col1,col2,col3.col4
    from table 1
    where col1,col2 in(select col1,col2 from table2)

    Or it may be identical:
    SQL> CREATE TABLE t1 (c INT NOT NULL);
    Table created.
    SQL> CREATE TABLE t2 (c INT NOT NULL);
    Table created.
    SQL> INSERT ALL
      2  INTO t1 VALUES (rn)       
      3  INTO t2 VALUES (rn)
      4  SELECT rownum AS rn FROM user_tables WHERE rownum <= 15;
    30 rows created.
    SQL> BEGIN                                       
      2  DBMS_STATS.GATHER_TABLE_STATS(user,'T1');
      3  DBMS_STATS.GATHER_TABLE_STATS(user,'T2');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t1
      2  WHERE  EXISTS
      3         ( SELECT 1 FROM t2 WHERE c = t1.c )
      4 
    SQL> @xplan
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |    15 |    90 |     5 |
    |*  1 |  HASH JOIN SEMI      |             |    15 |    90 |     5 |
    |   2 |   TABLE ACCESS FULL  | T1          |    15 |    45 |     2 |
    |   3 |   TABLE ACCESS FULL  | T2          |    15 |    45 |     2 |
    Predicate Information (identified by operation id):
       1 - access("T2"."C"="T1"."C")
    SQL> SELECT * FROM t1
      2  WHERE  c IN
      3         ( SELECT c FROM t2 )
      4 
    SQL> @xplan
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |    15 |    90 |     5 |
    |*  1 |  HASH JOIN SEMI      |             |    15 |    90 |     5 |
    |   2 |   TABLE ACCESS FULL  | T1          |    15 |    45 |     2 |
    |   3 |   TABLE ACCESS FULL  | T2          |    15 |    45 |     2 |
    Predicate Information (identified by operation id):
       1 - access("T1"."C"="T2"."C")

  • Hihaving a query like that who has done the Transport? How can i trace who

    having a query like that who has done the Transport? How can i trace who has done the transport (Import).
    I have tried with following steps but unable to find the right person.
    1. Go to TMS and disply the appropriate queue.
    2. Select menu path: Goto>Import History.
    3. Select menu path: Edit> Dipaly More.
    4. This will give the the "User" column.
    But my problem is the transport has happened long back. is there any other way to find out old import request who has done the transport.
    Please someone help me out on this.

    Do this may it can help you.
    At the last step where you had given "diaplay more"
    do this inspite of that:
    Extras --> Personal Settings
    Check the option "Query Interval Time" and try again.
    Best of luck !!!

  • Every time I restart my mac air some applications like calendar and Microsoft word automatically starts, how can I stop such applications from starting when ever I restart my mac

    Every time I restart my mac air some applications like calendar and Microsoft word automatically starts, how can I stop such applications from starting when ever I restart my mac?

    One thing to check:  when shutting down or restarting, there is a checkbox in the shutdown/restart dialog which asks whether you want currently open applications to open at startup.
    charlie

  • HT204053 does the icloud service work in middle east(lebanon) area or just in USA?coz it isn't working on my mac;it logs in,but when clicking any category like calendar,mail or find my iPhone,it tells"service unable to load,send a report..."

    does the icloud service work in middle east(lebanon) area or just in USA?coz it isn't working on my mac;it logs in,but when clicking any category like calendar,mail or find my iPhone,it tells"service unable to load,send a report..."..... so, the problem is..????

    Wow, just posting and it seems that there is a solution that is working for me...
    What I've did is I turned off iTunes Match on my iPhone, then turned in on again. Now in my iTunes library on my mac I can get the duplicates to be matched or uploaded to iCloud with a right-click, add to iCloud. iTunes Match starts to check the songs and everything is done correctly. Pretty nice!

  • Login key chain password asked for several staff like calendar agent etc.. every ten minytes How can I stop this?

    Every so, they pop up some small icons like "calendar agent or several similar ones, asking me to wrute the login keychain password. in order to continue my work... How can I get rid of then and stop them from popping up ??

    Keychain - OS X Mavericks v10.9.1: Repeated prompts to unlock "Local Items"
    Try running Keychain First Aid and resetting the original keychain.
    Keychain Reset
    Keychain Issues - Resolve  see post by Kappy

  • LOV in query mode (calendar)

    Hello,
    i know it's possible to enter in query mode and then select a value for quwey from a LOV.
    but in case of a Calendar (date_lov.get_date(...) ) i got that 'Undefined control key... press Ctrl+K for a list of all keys'. something like this
    why the LOV does not appear in this case? get_date is a procedure, contained in DATE_LOV package
    so what i want is to enter in query mode and then call the calendar to choose a date as search criteria
    Thanks

    hai,
    Its not possible.
    Because the date control is actually a seperate block, and in Query mode, we cannot more to a separate block.
    Regards,
    Manu.

  • Content Query on Calendar does not show recurring events

    There are three views that come with a Calendar list.  One is the 'Calendar', second is 'All Events' and the other is the 'Current Events'.  The current events is a cool view because it expands out items that have a recurrence (such as yearly).  It also shows only the events that happen today or in the future by filtering out past items.
    I have a content query web part that looks to this calendar which is maintained by the HR area.  The calendar is a holiday schedule for the next 3 years or so.  I can not seem to get the recurring events to expand out like they do with the 'Current Events' view.  If I choose 'All Events' on the list then it will show only our recurring holidays and the holidays that can't be set up as recurring holidays.  The content query web part appears to show only the 'All Events' view.
    Is there a way to make the content query web part use the 'Current Events' view?  I know the view option is there when the list resides on the same site, but in that case it uses a 'List View' web part instead of the content query web part.

    I'm not sure the MOSS option will work for me for a couple of reasons.  First, it seems this would require that the list reside on the parent site and the subsite be the one to use CQWP.  I need to have the list maintained on our HR site where HR people have permissions to modify, and then displayed on the parent site where HR folks don't have permissions to modify.  Also, I have at least two different columns that I really need to display and I haven't found a way to keep a link between two fields in the master list, unless I maybe use a calculated field. 
    The CSS modification may be a solution but I have not modified webparts via css.  I really haven't done many modifications to the css anyway but I'm not afraid to try it out on my test system.  I have looked through the Calendar.css and core.css and I don't find anything with ItemStyles in it.  I have even done a search on the entire web server extensions folder and I still have not found ItemStyles.  Will you please let me know where to find ItemStyles.xsl?
    I found a codeplex project that might help with this.  I could at least display two columns.  However, it doesn't say anything about building out recurrence items so I'm not sure if it will fix my problem.  I'll post my findings once I try it out.
    http://www.codeplex.com/ECQWP
    Thanks for your help!

  • Help: How to create a query like this?

    I am working on a report and I am facing on a question like this:
    TABLE TEST has two columns A and B
    A B
    2 INFO21
    2 INFO22
    3 INFO31
    3 INFO32
    3 INFO33
    I'd like to create a query which will return
    A INFO
    2 INFO21, INFO22
    3 INFO31, INFO32, INFO33
    Please help.
    Thank you in advance
    Jimmy

    A lot of pretty fine examples here:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    Rgds.

  • Sync Calendars like "Calendar", "Home", and "Work" with Google Calendar

    When I go into the iCal program on my mac, I have three calendars that I assume iCloud/iCal creates automatically for you. The ones that are showing up for me include: "Calendar", "Home", and "Work". All of these three calendars are under the iCloud subheading. Under the Gmail subheading, I have my google calendar. I would like to be able to sync these three iCloud calendars with my google calendar, as when I create a new event in iCal, it does not show up in Google Calendar. How can I make this happen? Also, when I create an event from Google Calendar, it shows up on iCal and all of my iOS devices, however, it does not show up in iCloud.com's calendar. Why is this, and how can I fix it?

    theappleone wrote:
    How can I make this happen?
    You can't.  That's not how it works.
    In the iCal app, indiviudal calendars exist either locally on you Mac or in the "cloud" on a server like iCloud, Google, Yahoo!, Exchange etc.
    Logging on to your iCloud account at icloud.com will only gain you access to your iCloud calendars much as logging on your Google Calendars account will only gain you access to your Google calendars.
    Matt

  • Query about Calendar  usage in sample application

    Hi I’ve been using APEX since a month now and want to make a kind of a scheduling application, some kind of and agenda where u can store events, and associate them to a person, with and specific hour, person in charge, and some other fields.
    Revising the sample application we have a calendar example in the orders tab, on this tab we have the calendar (that I mentioned before) and on the day column we have linked items to a specific page, I would like to know how to do that.
    I looked over the application in the calendars attributes column and day link and apparently there is nothing.
    I will appreciate if someone knows anything about it.
    Best regards.
    Jaison José González Chaux

    Hi everyone,
    </br>
    I’ve been searching around my app and noticed that there is no source tab section on my region definition.
    </br>
    I created a new calendar and even so, it is not created.
    </br>
    I would appreciate if anyone can give me a hind about it.
    </br>
    Best regards.
    </br>
    JJGCH
    </br>
    P.D.: in the aplication theres is a link on that secction
    </br>select '<a title="Order Detail" href="f?p=&APP_ID.:29:' || :APP_SESSION || '::::P29_ORDER_ID:' || order_id || '">' || to_char(order_total, '$999,999') || '</a>
    ' ord, order_timestamp
    from demo_orders o, demo_users u
    where o.user_id = u.user_id and (u.user_name = :APP_USER or :APP_USER = 'ADMIN')

  • Query like google

    Hello,
    I want to write query to search from two columns of a table like google i.e. this is example query:
    *""I want to see rebar companies in china"*
    The following table has country and products ('rebar')
    My table:
    SQL> desc company;
    Name                                      Null?    Type
    CO_ID                                     NOT NULL NUMBER(9)
    R_DATE                                             TIMESTAMP(0)
    CONAME                                             VARCHAR2(140)
    ESTYR                                              NUMBER(5)
    COUNTRY                                            VARCHAR2(32)
    PRODUCTS                                           VARCHAR2(3900)
    SQL> /
         CO_ID COUNTRY                          PRODUCTS
           173 china                            pipe fitting,valves,tee,reducers,elbows
           174 china                            angle bar
           175 china                            formwork,wing nut ,rebar,spring clamp ,wedge bolt,top cup,tie rod,scaffolding
           176 belgium                          ferro alloy producer
           177 china                            skyjumper,sky jumper,poweriser,powerskip,power shoes,flyjumper,jumping stilts
    SQL> Thanks & best regards

    Google uses a very sophisticated search algorithm, so I think you'll be a little pushed to replicate that or get anyone on the forum to do it for you.
    You may be able to get something from using Oracle Text, if that suits your needs.
    Alternatively, if you're looking to write your own thing then you would need some way of parsing the question and ignoring certain common words that you're not interested in, picking out just the words you want and then searching the relevant columns for those words.
    Here's a very basic example:
    SQL> ed
    Wrote file afiedt.buf
      1  with company as (select 173 as co_id, 'china' as country, 'pipe fitting,valves,tee,reducers,elbows' as products from dual union all
      2                   select 174, 'china', 'angle bar' from dual union all
      3                   select 175, 'china', 'formwork,wing nut ,rebar,spring clamp ,wedge bolt,top cup,tie rod,scaffolding' from dual union all
      4                   select 176, 'belgium', 'ferro alloy producer' from dual union all
      5                   select 177, 'china', 'skyjumper,sky jumper,poweriser,powerskip,power shoes,flyjumper,jumping stilts' from dual)
      6      ,question as (select 'I want to see rebar companies in china' as q from dual)
      7      ,ignore_words as (select 'i' as wrd from dual union all
      8                        select 'want' from dual union all
      9                        select 'to' from dual union all
    10                        select 'see' from dual union all
    11                        select 'companies' from dual union all
    12                        select 'in' from dual)
    13  --
    14      ,question_words as (select lower(regexp_substr(q, '[^ ]+', 1, rownum)) wrd
    15                          from question
    16                          connect by rownum <= length(regexp_replace(q, '[^ ]'))+1
    17                          minus
    18                          select wrd from ignore_words)
    19  --
    20  select *
    21  from company
    22  where co_id in (
    23                  select co_id
    24                  from company c, question_words q
    25                  where c.country = q.wrd
    26                  intersect
    27                  select co_id
    28                  from company c, question_words q
    29                  where instr(c.products, q.wrd) > 0
    30*                )
    SQL> /
         CO_ID COUNTRY PRODUCTS
           175 china   formwork,wing nut ,rebar,spring clamp ,wedge bolt,top cup,tie rod,scaffolding
    SQL>

  • Select query like For all Entries

    Hi,
    I have a requirement like:
    I need to extract data (BKTXT) from table BKPF based on some criteria, into one internal table and I need to query on REGUP table for the above data, the selection criteria on REGUP as follows:
    BKTXT(Document Header Text with 25 Char) is a combination of DATE and character string.
    Ex: bkpf-bktxt = 20060710-PL02 (YYYYMMDD)
    it is like LAUFD + LAUFI (of table REGUP)
    i.e: LAUFD (REGUP) = 07/10/2006 (MM/DD/YYYY) and LAUFI(REGUP) = PL02
    here I am thinking to use a select query on REGUP using FOR ALL ENTRIES of table i_bkpf..
    How can I change the date format YYYYMMDD to MM/DD/YYYY for my requirement?
    ((    Run-on Date (REGUP-LAUFD) = the first 8 characters in the Document Header Text (BKPF- BKTXT) in MM/DD/YYYY date format (e.g. 07/10/2006)
       Run ID (REGUP-LAUFI) = the 10th character through the 15th character in the Document Header Text (BKPF- BKTXT)

    It is not possible to do in the way you are thinking of doing. "For all entries" requires you to have the itab table field and the database table field to have the same type and length. So something like below <u>will not work</u>.
    TABLES: regup.
    DATA: BEGIN OF itab OCCURS 0,
            text LIKE bkpf-bktxt.
    DATA: END OF itab.
    DATA: BEGIN OF itab_regup OCCURS 0.
            INCLUDE STRUCTURE regup.
    DATA: END OF itab_regup.
    SELECT * INTO TABLE itab_regup
             FROM regup FOR ALL ENTRIES IN itab
            WHERE laufd = itab-text+0(8).
    If you run this code, you will get an error as follows:
    <i>"When using the addition "FOR ALL ENTRIES IN itab", the fields "LAUFD" and "ITAB-TEXT+0(8)" must have the same type and length."</i>

Maybe you are looking for