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)

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
     
    
  • Is it possible to see/get the data from the table to a dump file

    I have files dmp generated using expdp on oracle 11 g...

    expdp_schemas_18MAY2013_1.dmp

    expdp_schemas_18MAY2013_2.dmp

    expdp_schemas_18MAY2013_3.dmp

    Can I use a settings file given below to get the data from the table in the file sql or impdp the only option to load the data of table in database.

    VI test1.par

    USERID = "/ as sysdba".

    DIRECTORY = DATA

    dumpfile=expdp_schemas_18MAY2013%S.dmp

    SCHEMAS = USER1, USER2

    LOGFILE = user_dump_data.log

    SQLFILE = user_dump_data. SQL

    and impdp parfile = test1.par.

    No,

    DataPump cannot retrieve a dumpfile data in a flat file.

    Dean

  • Get the data from a virtual computer store

    I'm looking to get the data from a virtual computer store, but format to be used with vmrun.  My current vmrun statement is:

    vmrun t CR h < IPAddress > https://: 443/SDK u & lt; username & gt; Pei & lt; password & gt; runProgramInGuest "[& lt;. datastorename & gt;] & lt; datastorefolder & gt; / & lt; virtualmachinename & gt;. VMX' c:\myscript.bat

    The idea is to replace & lt; datastorename & gt; given with the name of the LUN that is running on a virtual machine.  In this case, I'm running my statement vmrun from inside a script PowerCLI.  I can use a variables powerCLI, if the vmrun instruction can take and use all escape sequences are needed to adapt the format vmrun to this argument.

    That is right.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • 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;
    
  • How to insert into a GLOBAL TEMPORARY TABLE and get the data from it?

    The requrement is
    Split the string ENTRY point on the base and store it in a Collection. And the values of the collection will be stored in a global temporary table. Then, I'm updating some other table based on the data from the temporary table.

    There is in fact no error message. But there is no data in the temporary table and also no change in the update statement

    First of all, I'm creatiing a global temporary table only once outside the procedure.

    CREATE GLOBAL TEMPORARY table GLt (data_element number)


    create or replace procedure test_proc (p_in_string VARCHAR2) is
    i the number: = 0;
    number of POS: = 0;
    CLOB lv_str: = p_in_string;
    p_delim VARCHAR2 (1): = ', ';

    TYPE t_array IS TABLE OF VARCHAR2 (20) INDEX directory.
    t_array channels;

    BEGIN

    -cutting of string input and store in the strings (i) collection

    POS: = instr (lv_str, p_delim, 1, 1);
    WHILE (pos! = 0) LOOP
    i: = i + 1;
    Strings (i): = substr(lv_str,1,pos-1);
    lv_str: = substr (lv_str, pos + 1, length (lv_str));
    POS: = instr (lv_str, p_delim, 1, 1);
    IF pos = 0 THEN
    Strings (i + 1): = lv_str;
    END IF;
    END LOOP;

    run immediately "drop table TWG;
    run immediately ' CREATE GLOBAL TEMPORARY table (data_element number) TWG on commit preserve rows ";

    FORALL i in strings.first... Strings.Last
    INSERT INTO VALUES TWG (strings (i));
    commit;

    Update first_tbl set PIN is "XXX" where first_col in (select data_element from TWG);.
    commit;

    END test_proc;

    Published by: cedric b on January 25, 2013 12:59

    Remove the two execute immediate line. They are wrong.

    And then use the table in your code that you created at the beginning. The name is GLT.
    And delete the first commit. This validation would empty the temporary table of GLT.

    You get an error? Or it does not work as expected?

    Also, show how you call the procedure.

    Published by: Sven w. January 25, 2013 14:45

  • How can I get the data from the drive of barcodes to forms

    Hi Experts,

    Forms 6i

    I would like to collect data from the barcode scanner.

    No idea if you got it please share.

    Thanks in advance.

    Hello

    I think that his works even as the keyboard.  You type the code manually or you can read it from a scanner.  With the help of the keyboard that you can able to type what anyone on the position of the cursor, in the same way the barcode scanner also works.  Just like a copy and paste the scanner copies the data from the physical device and paste it into your corrent cursor position.  There is no separate program encodings necessary for this work.

  • Get the data from the current quarter

    Hello

    I was wondering how I would go about getting data from a table that is in the current fiscal quarter?

    It's the simple query to get all the data:

    $q_calls_sql = "SELECT * FROM renewal_contact WHERE userid ='". "." ' $user_id. "'";

    $q_calls_query = $con-> query ($q_calls_sql);

    $q_calls_numrow = $q_calls_query-> num_rows;

    Here's what I currently show the quarterly data, but only shows do not all data:

    $q_calls_sql = "SELECT."

    OF renewal_contact

    WHERE the timestamp > = GETDATE(), DATEADD (qq, 1, getdate ()) & & timestamp < GETDATE(), DATEADD (qq, 2, getdate ()) ';

    $q_calls_query = $con-> query ($q_calls_sql);

    $q_calls_numrow = $q_calls_query-> num_rows;

    All I have to do is show the num_rows of the above query.

    MySQL QUARTER() function deals with calendar quarters rather than the fiscal quarters. In the United States, first by the federal Government's fiscal quarter begins October 1, dealing with MySQL as in the fourth quarter. The first fiscal quarter in California begins on 1 July, that MySQL considers (rightly) as of the third quarter.

    A way to get the quarter is to use a custom like this function:

    function getFiscalQuarter() {
      $month = date('n');
      $year = date('Y');
      switch ($month) {
          case 1:
          case 2:
          case 3:
              return ["$year-01-01", "$year-03-31"];
          case 4:
          case 5:
          case 6:
              return ["$year-04-01", "$year-06-30"];
          case 7:
          case 8:
          case 9:
              return ["$year-07-01", "$year-09-30"];
          default:
              return ["$year-10-01", "$year-12-31"];
      }
    }
    
    $quarter = getFiscalQuarter();
    
    $sql = 'SELECT * FROM renewal_contact
            WHERE `timestamp` BETWEEN "' . $quarter[0] . '" AND "' . $quarter[1] . '"';
    
  • How to get the data from more than 100 domains in bulk API V2.0?

    Hi all

    I try to get data from Eloqua by APIs in bulk because of big data.

    But my Contact 186 fields (more than the majority of export limitation 100). I think I need to get all the data by 2 exports.

    How could I corresponds to 2 parts of a line and join together?

    I'm afraid that any change of data between 2 relative to exports 2 synchronizations would make different order.

    FOR EXAMPLE:

    1. any document is deleted or modified (if it matches do not filter) after obtaining data of the first part and before getting the second part, then everyone behind it would have back in part result.

    2. the data in some fields (included in both parts) are changed between the 2 synchronizations, then the values of the second part are more recent but the values of the first part are old.

    All suggestions should.

    Thank you

    Biao

    bhuang -

    I don't know that you ever go to work around the fact that things will change in your database while you are synchronizing the data. You have to have a way to create exceptions on the side of the synchronization.

    If I pushed Eloqua data to a different database and had to contend with the problem of matches change while I'm syncing, I would create a few additional columns in my database to track the status of synchronization for this folder. Or create another small table to track the data map. Here's how I'd do.

    1. I would have two additional columns: 'mapped fields 1' and '2 fields' mapped. They would be all two datetime fields.
    2. I would do only one set of synchronization both. First of all, synchronize all records for email + 99 fields. Do the entire list. For each batch, the datetime value of the lot in 'mapped fields 1' column.
    3. I would then synchronize all folders of email + other 86 fields. Repeat the entire list. For this batch of the datetime value of each batch in their 'mapped the 2 fields' column to now().
    4. For all records that had only 'mapped fields filled, 1' but' fields mapped 2' was empty, I would be re - run the second query Eloqua API using e-mail as the search value. If no results were returned, I would remove the line. Otherwise, update and the value 'mapped fields in 2' now
    5. For all the records that were only "fields mapped 2', I re - run against the first email query API Eloqua, fill in the missing data and define 'mapped the fields of 1' of the current datetime object." If the record has not returned, remove the line because it is probably not in the search longer.
    6. Finally, the value 'mapped fields 1' and 'mapped 2 fields' empty for all records, since you know that data is synchronized. This will allow you to use the same logic above on your next synchronization.

    Who is? It is not super clean, but it will do the job, unless your synchronizations take a ridiculous amount of time and your great data changes often.

  • 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

  • How can I get the data from a range of AutoFilter in Excel?

    I have a spreadsheet with a large number of lines (5000) where I want to extract data.  I have opened the workbook successfully, configure an automatic filter and filtered the data to select the data corresponding to the criteria using the nodes property of the ActiveX Excel object and invoke.  I now have to enter the selected data in a table for later processing, and this is where I am stuck.  Help Excel online seems to suggest the creation of a Range object by using special cells with the xlCellTypeVisible type.  If I Range.Count I get the right number of cells, but Range.Value2 produces a variant which contains only the first block of data (a beach filtered automatically seems to consist of several non continuous blocks).  Anyone know how I can read the contents of the range in an array of strings?

    Thanks in advance

    Ken

    IT SOLVED!

    Found a calling areas of property which returns a collection of the areas of each of them continues a range object.  Simply cycled through these areas using the earlier technique, build the table I want.  See below

    Thank you

    Ken

    PS I can KUDOS

  • How do I get the date from a date. MinValue?

    How can I retrieve the value typed currently dated. MinValue FRONT to be submitted

       <af:inputDate value="#{bindings.When.inputValue}" label="WHEN"
                                shortDesc="#{bindings.When.hints.tooltip}"
                                contentStyle="width:240px;" id="it6" required="true"
                                showRequired="true">
                    <af:convertDateTime pattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ"/>
                  </af:inputDate>
    

    During my action button binding, I try to retrieve the value selected in this field and insert it in another column of the database called «deviceDate»

    I tried the code below, but I get an exception nullpointer to call inputText.getvalue)

    FacesContext facesCtx = FacesContext.getCurrentInstance();
    UIViewRoot root = facesCtx.getViewRoot();
    RichInputText inputText = (RichInputText)root.findComponent("it6");
    s = inputText.getValue().toString();
    

    Try this

    DCBindingContainer bindingContainer = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
            DCIteratorBinding binding = bindingContainer.findIteratorBinding("");
            Row newRow = binding.getCurrentRow();
            Timestamp dateVal = (Timestamp)newRow.getAttribute("When");
    

    Replace the iteratorname and the data type of the field, likely ones.

    See you soon

    AJ

  • SQL query to get the numbers from 0 to 99

    How can we write a sql query to get values from 0 to 99... This should not come from any table
    SELECT LEVEL - 1
      FROM  DUAL
      CONNECT BY LEVEL <= 100
    /
    

    SY.

  • get the data from the text box by clicking a button and display output text

    Hi all

    I have a task flow with two pages. On the first page, I have a text entry box and a command button.whenever I click the button, the data that is entered in the input text box should be displayed as output in the second page.please text after the code for this example.

    Thank you.

    Hello

    1. create a bean with a scope of application with any appropriate instance name: myBean_Request.
    2. create a property of the bean with any appropriate name. For example:

    private String textValue;
    

    3 generate the getters and setters in the bean for the text argument.
    4. set the value attribute of the text box to something like this.

    value="#{myBean_Request.textValue}"
    

    5. can insert setPropertyListener for the CommandButton as follows

                    
                       
                    
    

    6. in the next page set the value of the text output to the

    value="#{pageFlowScope.textValue}"
    

    I hope this helps.

    Kind regards
    Sicard.

  • BlackBerry smartphones, I don't know how to get the data from the phone to the computer

    I have the Desktop Manager and the telephone connected to the cable.

    He seems to have only coices I want. I don't want is a full backup or restore or synchronoizing or send anything to the phone.

    I want to just do a few simple things:

    (1) I want to copy pictures from my phone to my computer, that I can see with the standard Windows software.

    (2) I want to copy my address book from my phone on my computer, that I can see with some standard desktop application, any.

    (3) I want to copy my calendar so I can see it with some standard desktop application, any.

    How can I get them?

    Thank you

    Hi and welcome to the Forums!

    JustCurious wrote:

    (1) I want to copy pictures from my phone to my computer, that I can see with the standard Windows software.

    See this:

    http://supportforums.BlackBerry.com/T5/BlackBerry-Desktop-software/HOWTO-use-your-BlackBerry-as-a-us...

    JustCurious wrote:

    (2) I want to copy my address book from my phone on my computer, that I can see with some standard desktop application, any.

    (3) I want to copy my calendar so I can see it with some standard desktop application, any.

    See these:

    KB12268 Applications supported by BlackBerry Desktop Manager to synchronize

    KB17022 How to set up BlackBerry Desktop Manager synchronization settings

    Good luck and let us know!

Maybe you are looking for

  • The HP Pavilion 15-B168CA: USB - Pavilion 15 driver

    Hello I am looking for the drivers for Universal Serial Bus Controller of my new Pavilion 15 laptop says that the driver is missing. The hardware id is the following: PCI\VEN_8086 & DEV_1E31 & SUBSYS_2186103C & REV_04PCI\VEN_8086 & DEV_1E31 & SUBSYS_

  • change of sub vi pop up

    Is it possible that when clicking on a sub vi on my schematic, I get the sub block screws instead of its façade? Thank you

  • The keyboard does not work after installing Language Pack.

    Original title: where is my underscore? After you install an update for the language pack, my keyboard settings got screwed up and keyboard is not what he suppose to type. I can't type the line of underscores, @ is located next to p. ' is Maj + 7 and

  • Envy: Do not install Windows 10 laptops Envy before July 2015 models

    Do not update computers laptops Envy to 10 Windows before July 2015 models. Will hang with "do not turn off the PC. 1 installation of 1... Will last for hours. Reboot the button down until the laptop turns off. Put key on, should restart and restore

  • Navigation pad classic blackBerry

    the navigation pad is no longer on the side and upwards and downwards (it still works if you press it), any ideas? THX, david