Query related to the data type 'Date '.

Hey experts,.

If my only of the column has data type like 'Date '.

It will be always retrun date in Date + time format... EX 02/07/2012 00:00:00

If I simply select this column in table_name

or is it depends on the setting of specific oracle?

while selecting the dual display in differnet format, why?

What tool do you use? It is not SQL * more? Is this TOAD or SQL Developer or...?
Looks like something is the substitution of / reactivate your format.

Tags: Database

Similar Questions

  • How to write a simple select query to get the data of the table as an XML.

    How to write a simple select query to get the data of the table as an XML. In the query, I'm just adding items below which i need be there in the XML document
    select '<test_tag>'||EMP_NAME||'</test_tag>','<date>'||sysdate||'</date>' 
    from temp_table where id_num BETWEEN 1 AND 10;
    I have need to add the root tag as well in the beginning and the end of < root > < / root > this xml file. Please advice if this is possible with the select query
    without using XMLGEN, XMLQUERY or any other packages built and function?

    I need to URL escapes with the UTF-8 code points that we have already achieved using the utl_http package. Please help how to do that without using the utl_http package.

    What is wrong with him?

    At present, the only way I can think of to avoid a call to UTL_HTTP. SET_BODY_CHARSET is to write your own little wrapper.
    In this way, you can specify the Boolean parameter or omit it if you choose to use named parameters:

    SQL> create or replace function my_url_escape (url in varchar2)
      2  return varchar2
      3  deterministic
      4  is
      5  begin
      6   return utl_url.escape(url, false, 'AL32UTF8');
      7  end;
      8  /
    
    Function created
    
    SQL> select my_url_escape('http://some.uri.com/param?lang=fr&text=contrôle') from dual;
    
    MY_URL_ESCAPE('HTTP://SOME.URI
    --------------------------------------------------------------------------------
    http://some.uri.com/param?lang=fr&text=contr%C3%B4le
     
    
  • Query related to the laptop purchase date

    Original title: Windows 8, update problem 14.99

    I bought a laptop of Jarir Bookstore in Saudi Arabia, Riyadh. I remember that I bought it in June but I forgot the date and reception was lost. So is it possible to check the date of my purchase?

    Hello Adel G,.

    Thank you for the question!

    It is disheartening to know that have problems you with the laptop computer purchase date. As I understand it, you have lost the receipt for the laptop computer purchase date.

    I need to ask you some questions to help you best.

    1. you have Windows 7 or Windows 8 operating system installed on the computer?

    2 may I know why you need to know the date of purchase?

    Unfortunately, there is no way to verify the date of purchase according to the information stored on the computer. You must contact Jarir Bookstore in order to get information from purchase date.

    Answer to us if you have problems with Windows Update or any other issue of Windows, and I'd be happy to help you again and try to correct the problem as soon as possible.

    Good day!

    Hope this informationm helps.

  • Query to get the data of the column and the metadata in the same set of results.

    Is it possible to build a query to get the values of the columns in a table and also be able to get some metadata (data type, data_length, data_precision, data_scale) for columns in the same set of results.

    If I use a join, have a common value to join on the two tables?

    you use a cross join, not requiring common values.

    create table T (n number, d date, v varchar2(30));
    insert into T values (1,sysdate,'ABC');
    commit;
    
    select C.column_name, c.data_type, c.data_length,
    case c.column_id
     when 1 then to_char(T.N)
     when 2 then to_char(T.D)
     when 3 then T.V
    end VALUE
    from USER_TAB_COLUMNS C, T
    where C.table_name='T'
    order by c.column_id;
    
  • Query to get the date from

    Hello everyone,

    How can I create a query having 2 date and 2 variable of the type:
    from 1 date 05/06/2004 
    to   2 date 15/06/2004 
    yes for 2 days
    no for  1 day
    that is, 
    
    i wish get the date with yes for 2 days and not for 1 day, this is, that I want
    
    05/06/2004 sabato
    06/06/2004 domenica
    08/06/2004 martedì
    09/06/2004 mercoledi
    11/06/2004 venerdi
    12/06/2004 sabato  
    14/06/2004 lunedi
    15/06/2004 martedi
    Thanks in advance

    Hello

    The WHERE clause controls the lines will appear.
    If your needs change, change the WHERE clause to reflect their.

    For example:

    DEFINE     from_date     = "TO_DATE ('05/06/2004', 'DD/MM/YYYY')"
    DEFINE     to_date          = "TO_DATE ('15/06/2004', 'DD/MM/YYYY')"
    DEFINE     yes_cnt          = 3
    DEFINE     no_cnt          = 2
    
    SELECT  &from_date + LEVEL - 1        AS dt
    FROM     dual
    WHERE     MOD ( LEVEL
             , &yes_cnt + &no_cnt
             )          BETWEEN  1
                       AND      &yes_cnt
    CONNECT BY  LEVEL <= 1 + &to_date
                         - &from_date
    ORDER BY  dt;
    

    This will work as long as you want the first & yes_cnt lines to display (assuming that there are many) and the following lines & no_cnt don't step to display, and then another & yes_cnt lines to display and the other & no_cnt lines not to display and so on.

    I guess & yes_cnt is a positive integer and that & no_cnt is a non-negative integer. (I.e. & no_cnt can be 0)

  • SQL query to represent the data in the graph bar

    Hello

    JDev 11.1.1.5.0

    We must create a dashboard to track the translation. We have created the ADF table with buttons 'Create', 'Update' and 'Delete' to manipulate the table.

    Our DB table structure is

    File_id (PK), File_Name, ToSpanish - ARE (YES/NO), beginning of the ToSpanish, ToChina(YES/No), ToChina-Date... etc.

    Once the translated file required language then user must update the DB table using the button "Update".

    So far, we have implemented the requirement above.

    We need represent the status of the translation in the graph bar with the language as X access and file count get access Ex: Spanish-100 China - 200 files files

    Please suggest the sql query to retrieve the necessary info from the DB table that can be represented in the graph bar. Also, it would be great, if you can provide a pointers to create a bar chart.

    Thanks in advance,

    MSR.

    If you set your major increment and minor than 1, then you won't not show decimal points.  You can try setting these 10 or 100 to reach your goal.

    Subtype = "BAR_VERT_CLUST" >

                 

  • SQL query to get the dates between two dates

    Hello

    We have a chart with start date and end date... Now I need to get all the dates between the start date and end date...

    Table looks to below...

    Create the table date_table (start_date, end_date date);

    The table data will be as below:

    start_date end_date

    January 1, 2013 January 4, 2013

    February 1, 2013 February 3, 2013

    ...............          .................

    ...............          ..................

    ...............           .................

    May 1, 2013 may 3, 2013


    I want a result like below...


    holiday_dates

    January 1, 2013

    January 2, 2013

    January 3, 2013

    January 4, 2013

    February 1, 2013

    February 2, 2013

    February 3, 2013

    .................

    .................

    .................

    .................

    May 1, 2013

    May 2, 2013

    May 3, 2013


    Can anyone help... ?

    Ramesh9158 wrote:

    Hello

    Your query will not work for our case...

    First... We do not know the number of rows in the table... If we cannot use the union...

    Second... hard coding of dates... but we do not know what could be that goes back in the table... it could be no matter what it takes not only as appearing to the interpreter...

    Hey riri.

    My code will work everywhere I use with with union all statement to create the example data.

    Try the query:

    -The main query

    Select d1 + row_number() over (partition by iden) - stopped by iden holiday 1

    Of

    connect by level<= d2="" -="" d1="" +="">

    and prior iden iden =

    and prior sys_guid() is not null

    ----

    Ramin Hashimzade

  • The model deployment - VM related to the data store model

    I have templates create in a data store, call datastor0 on a San in LUN0. I'm deployment of virtual machines in datastore1 in LUN1. The problem:

    • After the deployment of a virtual machine at datastore1, the summary of VM page datastore0 and datastore1 in the 'resources' tab.
    • If I go to view the data warehouse, the virtual computers tab, I can see that the VM listed in datastore0 and datastore1.
    • If I browse the data warehouses, the computer virtual folder is located in datastore1.
    • I'm not change hardware or anything else during or after deployment.

    I'm guessing there is a file in the model with information about the deployed virtual computer that it throws out. I don't see the problem when the dpeloying to datastore0, but the problem could still be there, with the virtual machine is somehow related to the model.

    I know that I have een that high in the past in other threads, but I think as those relating to make changes during the deployment. I'm not familiar with the editing of the VM reviewing files, it's been long that I had, so any ideas on the problem, what are the files that I should look through diagnosis and how I finished with this in the first place?

    The environment is:

    vCenter 4.1 Build 491557

    ESXi 4.1 Build 502767

    I opened a case with the help, but I won't hear from them before some time tomorrow and jump to get these deployed tonight.

    Thank you

    You happen to have the CD-ROM pointed an ISO on datastore0? Can you post the contents of the. VMX file for the virtual machine you just deployed?

  • Query to retrieve the data in a sort of pivot format.

    Hello gurus of PL/SQL,.
    I need to extract the data in a format some tables using the join condition. When I extracted using simple join then it turn around individual records based on condition, but want it in a particular format only.

    When run the query-

    Select sf. JOIN_DT_KEY, sd. CLS, sd. CLS_STATUS, sf. CLS_QTY, sf. CLS_FEES,
    SF. TOTAL_AMT
    of stud_det_fact sf, sd, cd class_dim stud_tag_dim
    where sf.stud_dim_key = sd.stud_dim_key
    AND sf.alloc_cls_dim_key = d.alloc_cls_dim_key AND sd. CLS_STATUS IN
    ("BA", "BSC", "MA", "MBA", "SMC")
    AND af. JOIN_DT_KEY between 20120404 and 20120410 ORDER BY sd. CLS

    That the data is returned in the following format:

    JOIN_DT_KEY CC CLS_STATUS CLS_QTY CLS_FEES TOTAL_AMT
    1 20120404 BA 1050000 12 875 WORK
    2 20120404 BA 125 12 150000 CAPITAL
    3 20120404 BA 1050000 12 875 WORK
    4 20120404 BSC 4 10 4000 CAPITAL
    5 20120404 BSC 3 10 3000 CAPITAL
    6 20120404 MY 1050000 12 875 WORK
    7 20120404 MY 1000 12 1200000 WORK
    8 20120404 MBA 1200000 12 1000 ALGO
    9 20120404 MBA 1200000 12 1000 ALGO

    But I want to in the format after using query itself.

    JOIN_DT_KEY WORK of CLS (Qty) WORK (Amt) CAPITAL (Qty) CAPITAL (Amt) (Qty) ALGO ALGO (Amt) NATURAL (Qty) NATURAL (Amt) GrandTotal (Qty) GrandTotal (Amt)
    20120404 1750 2100000 125 150000 0 0 0 0 1875 2250000 BA
    0 0 7 7000 BSC 0 0 0
    0 7 7000
    MY 1875 2250000 0 0 0 0 0
    0 1875 2250000
    0 0 0 0 2000 2400000 MBA 0
    2400000 2000 0
    3625 total 4350000 132 157000 2000 2400000 0
    0 6907000 of 5757

    How to change the query to get the hinge of the sort of result, kindly help me. I appreciate all your help in advance.

    Thank you and I really apperciate your help.

    Note:-attached, this is the example of excel sheet.

    Published by: user555994 on April 26, 2012 03:43

    I suggest that to take advantage of the Oracle version you have.

    To start, I took your first message and created a few sample data. This is not your original tables, but it allows us to compare the results.

    drop table T;
    create table T(JOIN_DT_KEY, CLS, STATUS, QTY, FEES, AMT) as select
    TO_DATE('20120404', 'YYYYMMDD'), 'BA', 'WORKING', 875, 12, 1050000 from dual union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BA', 'CAPITAL', 125, 12, 150000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BA', 'WORKING', 875, 12, 1050000 from dual union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BSC', 'CAPITAL', 4, 10, 4000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'BSC', 'CAPITAL', 3, 10, 3000 from dual union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MA', 'WORKING', 875, 12, 1050000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MA', 'WORKING', 1000, 12, 1200000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MBA', 'ALGO', 1000, 12, 1200000 from DUAL union all select
    TO_DATE('20120404', 'YYYYMMDD'), 'MBA', 'ALGO', 1000, 12, 1200000 from DUAL;
    

    To test the following against your data, is taken your SELECT in the right place or create a view and plug the display where I have the table "T".

    Now, here's how to get everything except the last line "Total":

    select *
    from (
      select JOIN_DT_KEY, CLS, STATUS, QTY, AMT from t
    )
    PIVOT(SUM(QTY) QTY, SUM(AMT) AMT
    for STATUS in('ALGO' as ALGO,'CAPITAL' as CAPITAL,'DMA' as DMA,'NATURAL' as natural,'WORKING' as WORKING));
    
    JOIN_DT_KEY        CLS ALGO_QTY ALGO_AMT CAPITAL_QTY CAPITAL_AMT DMA_QTY DMA_AMT NATURAL_QTY NATURAL_AMT WORKING_QTY WORKING_AMT
    ------------------ --- -------- -------- ----------- ----------- ------- ------- ----------- ----------- ----------- -----------
    2012/04/04 00:00   BSC                             7        7000
    2012/04/04 00:00   BA                            125      150000                                                1750     2100000
    2012/04/04 00:00   MBA     2000  2400000
    2012/04/04 00:00   MA                                                                                           1875     2250000
    

    To get the latest "Total" line, you need to do another GROUP after the pivot.

    select JOIN_DT_KEY, nvl(CLS, 'Total') cls,
    SUM(ALGO_QTY) ALGO_QTY,
    SUM(ALGO_AMT) ALGO_AMT,
    SUM(CAPITAL_QTY) CAPITAL_QTY,
    SUM(CAPITAL_AMT) CAPITAL_AMT,
    SUM(DMA_QTY) DMA_QTY,
    SUM(DMA_AMT) DMA_AMT,
    SUM(NATURAL_QTY) NATURAL_QTY,
    SUM(NATURAL_AMT) NATURAL_AMT,
    SUM(WORKING_QTY) WORKING_QTY,
    SUM(working_AMT) working_AMT
    from (
      select JOIN_DT_KEY, CLS, STATUS, QTY, AMT from t
    )
    PIVOT(SUM(QTY) QTY, SUM(AMT) AMT
    for STATUS in('ALGO' as ALGO,'CAPITAL' as CAPITAL,'DMA' as DMA,'NATURAL' as natural,'WORKING' as WORKING))
    group by grouping sets((join_dt_key, cls), join_dt_key);
    
    JOIN_DT_KEY        CLS   ALGO_QTY ALGO_AMT CAPITAL_QTY CAPITAL_AMT DMA_QTY DMA_AMT NATURAL_QTY NATURAL_AMT WORKING_QTY WORKING_AMT
    ------------------ ----- -------- -------- ----------- ----------- ------- ------- ----------- ----------- ----------- -----------
    2012/04/04 00:00   BA                              125      150000                                                1750     2100000
    2012/04/04 00:00   MA                                                                                             1875     2250000
    2012/04/04 00:00   BSC                               7        7000
    2012/04/04 00:00   MBA       2000  2400000
    2012/04/04 00:00   Total     2000  2400000         132      157000                                                3625     4350000
    

    Using "grouping sets", you group by join_dt_key and cls (which the PIVOT is already done, but you have to do it again) and then by join_dt_key to get the total line.

    Note: I suppose you want a total by date. If you want just a total general for all dates, then Group Rollup (join_dt_key, cls)).

    I hope it's accurate and useful.

  • Need of a query to retrieve the data

    Hello

    I have a table named person. It has two fields A_ID and B_ID. The table does not have a primary key
    The data in the table are the following

    A_ID B_ID_ _

    1 5
    1 10
    2 5
    2 10
    4 15
    5 20

    I need to select A_ID and B_ID data so that when you select a given allocation A_ID or B_ID is not for more choices

    For Eg: I select the first pair of 1 and 5. Then 1 and 5 is not in the selection of data from A_ID or B_ID

    The output of the query for the data in the table above should be

    Output

    A_ID B_ID_ _

    1 5
    2 10
    4 15

    Hope you understand the situation.
    Can someone help me to create a query for me

    Thanks in advance

    Published by: user599079 on August 12, 2009 21:40

    This done:

    Nope:

    SQL>  with t as (
     select 1 a_id, 5 b_id from dual union all
     select 1, 10 from dual union all
     select 2, 5 from dual union all
     select 2, 10 from dual union all
     select 4, 15 from dual union all
     select 5, 6 from dual union all
     select 6, 9 from dual
    ),
    union_data  as
    (
        select    a_id    as id
        ,    'A'    as col
        ,    row_number () over (order by a_id, b_id)    as r_num
        from   t
    union all
        select    b_id    as id
        ,    'B'    as col
        ,    row_number () over (order by a_id, b_id)    as r_num
        from    t
    )
    ,    grouped_data    as
    (
        select      id
        ,      min (col) keep (dense_rank first order by r_num)    as first_col
        ,      min (r_num)                                     as first_r_num
        ,      row_number () over ( partition by min (col) keep (dense_rank first order by r_num)
                                  order by        min (r_num)
                         )                    as out_num
        from      union_data
        group by  id
    )
    select      a.id    as a_id
    ,      b.id    as b_id
    from      grouped_data    a
    join      grouped_data    b    on    a.out_num    = b.out_num
    where      a.first_col    = 'A'
    and      b.first_col    = 'B'
    order by  a.out_num
    /
          A_ID       B_ID
    ---------- ----------
             1          5
             2         10
             4         15
    
    3 rows selected.
    

    I expect him back at the last row too much (like my request).
    In addition to change line 5 - 6 5-25 mess up completely:

          A_ID       B_ID
    ---------- ----------
             1          5
             2         10
             4         15
             6         25
    
  • Query related to the installation of hard drives

    Original title: hard drives
    I have two hard drives and I want to set up as
     
    1. a stand-alone hard disk that holds the operating system
    2. the second hard drive to keep the files like doc, files, photos, video, and downloads.
    How can I do this?
    Thanks in advance.

    It's just a matter of creating a partition on the 2nd HARD drive. Then you can use it for whatever you like.
    You can install programs, or just use it to store data.
    HARD drive with a speed lower than 7200 RPM are generally best left to the storage (Western Digital Black are
    7200 RPM. Their VelociRaptor is the record of 10 000 rpm).
    Software load a little slower and may run more slowly on the 5200 RPM HARD drive. Are the 'Greens' HDD
    usually about 5200 RPM.

    -If you run short on the HARD the OS disk space is a way to create more space
    move your music, photos and video to the other HARD disk records.

    A method to move the folders in your main user folder is to R / click the respective folder
    and go to Properties.
    Click the location , and then select the partition or folder on your HARD drive that you want to move
    This folder is a subfolder of.
    After data is transferred, it will be a new shortcut to this new location in libraries.

    -If you do not use the libraries you can simply move the data to a new folder on the other HARD drive
    (without using the 'rent' option) and pin a shortcut from the new folder to the
    Icon from the Windows Explorer in the taskbar.

    [If you also need information on how to set up partitions and otherwise manage the HDD-]
    The two HARD drives should show up in disk management. This is where you create or delete partitions on your
    HARD drives
    Go to control panel (or start menu) > administrative tools > computer management.
    Then click on disk management.
    -The HARD drive with the operating system will say - ( system, start...) Main partition). It could be either disk 0 or 1 depending on the port on which the HARD drive is connected to the motherboard.
    The other disk HARD would have "unallocated space" If no partition was made.
    If the disc already has data, then it must also propose in the Start Menu > computer and data
    should be accessible and ready for to add you more data.
    If the 2nd HARD drive has no data that you have just made a new Partition. With a drive of 80 GB HARD is a single partition
    generally the best option for the management of space.

    You can get more details on how to use the disk by typing disk management management in the
    Search box Start > Help and Support.

    .

  • Query related to the availability of the date and time of the email replied to the original e-mail in Windows Mail

    Original title: when you replied to a message.

    In Outlook, there is a feature... When you open a message, then answer it... If you pull up to the original e-mail message, it tells you when you have replied to this message.  Is it possible to do this in Windows Mail?

    Hello

    Yes, data search and mail time returned to the original e-mail is available in Windows Mail.

    Hope this information helps.

  • Can't open a PDF document: error related to the "data execution prevention".

    original title: data execution prevention

    I have a pdf file, I use to get in but can not now because of the prevention of execution of data and can not turn off because I don't know the name of the file

    Hello

    1 how long have you been faced with this problem?
    2 did you recent hardware or software changes to your computer before this problem?
    3. this happens with some file in particular?
    4. What is the full and exact error message?

    Please answer these questions that could help us help you better.
    See the bottom of the article for more information on data execution prevention.
    What is Data Execution Prevention?

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-data-execution-prevention

  • Query to display the date in a given interval for a date

    Hi gurus,

    I have a requirement like, need to show a date of date interval start.

    for example: I have 1 January 2015, I need to see the next 28th day 28/01/205 and so on for some 13 periods.

    Could someone help me to achieve this, thanks in advance.

    Kind regards

    Guru.

    A simple, similar to Frank approach:

    data (epoch_date, day_interval,))

    Select to_date (1 January 2015 ',' dd/mm/yyyy ""), 28, 13

    of the double

    )

    Select the period, start_date, start_date + day_interval - 1 as end_date

    de)

    Select wagneur, period level, epoch_date + (day_interval * (level - 1)) as start_date

    data d

    connect by level<=>

    )

    order by period

    PERIOD START_DATE END_DATE
    1 JANUARY 1, 15 28 JANUARY 15
    2 29 JANUARY 15 25 FEBRUARY 15
    3 26 FEBRUARY 15 25 MARCH 15
    4 26 MARCH 15 22 APRIL 15
    5 23 APRIL 15 MAY 20, 15
    6 MAY 21, 15 17 JUNE 15
    7 18 JUNE 15 15 JULY 15
    8 16 JULY 15 12 AUGUST 15
    9 AUGUST 13, 15 15-SEP-09
    10 15-SEP-10 7 OCTOBER 15
    11 OCTOBER 8, 15 4 NOVEMBER 15
    12 NOVEMBER 5, 15 2 DECEMBER 15
    13 DECEMBER 3, 15 30 DECEMBER 15

    13 selected lines.

  • Query based on the date of

    I have a request (I'll call him main_query) which returns a recordset that looks like this.

    PRODUCT_ID SALE_DATE QT

    1 1000 2014 - 10 - 01

    1 1500 2014-10-02

    2 300 2014-10-01

    For each product, I have a date of sale and the quantity sold.

    Now I have another table (BUY) with orders. It contains the product Id, id purchase and purchase date.

    PRODUCT_ID PURCHASE_ID PURCHASE_DATE

    1 9999 2014 - 09 - 17

    1 10000 2014 - 09 - 28

    2 10001 2014 - 08 - 10

    My goal is to find the Id of the last purchase BEFORE each date of sale.

    The result should be:

    PRODUCT_ID PURCHASE_ID SALE_DATE

    1 10000 2014-10-01

    1                    10000               2014-10-02

    2 10001 2014-10-01

    I tried something like this

    SELECT PRODUCT_ID, SALE_DATE

    (SELECT MAX (PURCHASE_ID) TO BUY WHERE TO BUY.) PRODUCT_ID = PRODUCT_ID AND

    PURCHASE_DATE < = SALE_DATE) LAST_BUY

    OF (main_query);

    But I still have the "ORA-00979: not a GROUP BY expression" error.

    Thank you for the help

    Hi Nuno,

    with things like BUY. PRODUCT_ID = PRODUCT_ID> I would you like to live dangerously... I suggest that you use ALIASES all initially, then see this error message you still or not...

    SELECT m.product_id

    m.sale_date

    (SELECT MAX (b.purchase_id)

    B buys

    WHERE b.product_id = m.product_id

    AND b.purchase_date<= m.sale_date="" )="">

    M (main_query)

    ;

    Best regards

    Bruno Vroman.

    P.S.: maybe a missing comma in your statement (between sale_date and (SELECT MAX)?

Maybe you are looking for