TO_date problem

Hello
I have a problem that I need to get between the dates, but I can't use the command BETWEEN
I was hoping that I could solve it like this

and activity.send_date < to_date('2015/12/01','yyyy/mm,dd') - date is later than the date of entry as 1/12/2015 <
and activity.send_date > to_date('2015/12/03','yyyy/mm,dd') - DATE is less than a date entered as 12/3/2015 >

But it does not work.
Can someone help me to understand how I could get this working to get like this example: all data between 20/11/2015 until 25/11/2015

BR,
Melx

Q1. Why you cannot use between

Try this

Activity.SEND_DATE > = to_date('2015/11/20','yyyy/mm/dd') and activity.send_date<=>

Search the =, operator, I used both

Tags: Database

Similar Questions

  • Unique / separate to_date problem

    Hey guys,.

    I am doing a project on feedback forms.
    There is a query that is bothering me in oracle...

    I used this application in the generation of reports in VB .NET.

    This is the query:

    SELECT unique (to_date(a.fdate,'dd-mon-yy')), t.teacher_name, s.subject_name, q.question_id, q.question_desc, q.opt1, q.opt2, q.opt3, q.opt4, count (a.opt1), count (a.opt2), count (a.opt3), (a.opt4) count of feedback f, answers, teacher t, s of subjects, questions q where A.FEEDBACK_ID = 'FF1' AND fdate as 5 January 09 ' and the group a.question_id = q.question_id and t.teacher_id = f.teacher_id and f.feedback_id = a.feedback_id and f.subject_id = s.subject_id by a.fdate t.teacher_name, s.subject_name, q.question_id, q.question_desc, q.opt1, q.opt2, q.opt3, q.opt4 order of q.question_id

    But this query gives ambiguous data as output.

    When I delete the attribute a.fdate to the query, it works fine.

    Select t.teacher_name, s.subject_name, q.question_id, q.question_desc, q.opt1, q.opt2, q.opt3, q.opt4, count (a.opt1), count (a.opt2), count (a.opt3), (a.opt4) count of feedback f, answers, teacher t, s of subjects, questions q where A.FEEDBACK_ID = 'FF1' AND fdate as 5 January 09 ' and the group a.question_id = q.question_id and t.teacher_id = f.teacher_id and f.feedback_id = a.feedback_id and f.subject_id = s.subject_id by t.teacher_name s.subject_name, q.question_id, q.question_desc, q.opt1, q.opt2, q.opt3, q.opt4 order of q.question_id

    But I need this area in my report. Can somone please help me out here!

    I tried to use SEPARATE, to_char, but in vain!

    Thanks a load!

    Kind regards

    Adijo

    Now,.

    If fdate is of type char or varchar2, then you can use this->

    select trunc(to_date(a.fdate,'dd-mon-yy')),
           t.teacher_name,
           s.subject_name,
           q.question_id,
           q.question_desc,
           q.opt1,
           q.opt2,
           q.opt3,
           q.opt4,
           count(a.opt1),
           count(a.opt2),
           count(a.opt3),
           count(a.opt4)
    from feedback f,
         answers a,
         teacher t,
         subjects s,
         questions q
    where A.FEEDBACK_ID = 'FF1'
    AND trunc(fdate) = '05-JAN-09'   -- As discussed earlier you can use between here
    and a.question_id=q.question_id
    and t.teacher_id=f.teacher_id
    and f.feedback_id=a.feedback_id
    and f.subject_id=s.subject_id
    group by trunc(to_date(a.fdate,'dd-mon-yy')),
             t.teacher_name,
             s.subject_name,
             q.question_id,
             q.question_desc,
             q.opt1,
             q.opt2,
             q.opt3,
             q.opt4
    order by q.question_id
    

    Or, if that is the date the reference->

    select trunc(a.fdate),
           t.teacher_name,
           s.subject_name,
           q.question_id,
           q.question_desc,
           q.opt1,
           q.opt2,
           q.opt3,
           q.opt4,
           count(a.opt1),
           count(a.opt2),
           count(a.opt3),
           count(a.opt4)
    from feedback f,
         answers a,
         teacher t,
         subjects s,
         questions q
    where A.FEEDBACK_ID = 'FF1'
    AND trunc(fdate) = '05-JAN-09'     -- As discussed earlier you can use between here
    and a.question_id=q.question_id
    and t.teacher_id=f.teacher_id
    and f.feedback_id=a.feedback_id
    and f.subject_id=s.subject_id
    group by trunc(a.fdate),
             t.teacher_name,
             s.subject_name,
             q.question_id,
             q.question_desc,
             q.opt1,
             q.opt2,
             q.opt3,
             q.opt4
    order by q.question_id
    

    N.B.: Not tested...

    Kind regards.

    LOULOU.

  • Problem in executing to_date

    Hello


    Under query is not executed: error: ORA-01858: a non-digit character was found here where was waiting for a digital

    Select to_date (SYSDATE, 'yyyyMMdd') of double;

    Published by: Balajiraam on February 28, 2011 10:05

    Balajiraam wrote:
    How do I get the date in the specified format without changing the NLS_PARAMETERS as shown below:

    Select double to_date('20090912','MMDDYYYY');

    As others have already pointed out, a date is not a format. You can't get a date in a specified format.

    If you want a character string that represents a date, you use the function TO_CHAR. In this case, it is not supposed to do since you already have the channel by hand. But you might

    SELECT to_char( to_date( '20090912', 'MMDDYYYY' ),
                    'MMDDYYYY' )
      FROM dual
    

    Justin

  • Problem in TO_DATE...

    Hello

    I need to display the date and time using the to_date function.
    EX:
    December 22 09 14:31:20
    I tried this way
    Select to_date (sysdate, "the HH24: MI: SS DD-MM-YYYY) twice;
    Released: 22-DEC-09

    But it does not get the date as that request.
    Can you help me pls how can I get data like this.

    Thanks in advance.

    Kind regards
    Leelakrishna.G

    When you view it? In SQLPlus? If so try this

    alter session set nls_date_format = 'DD-MM-YYYY HH24:MI:SS'
    /
    select sysdate from dual
    /
    
  • Potential problems with copy_table_stats.

    Guys,

    I have a table with the DDL below containing a huge number of records.

    CREATE TABLE APPEAL. CALL_DTL

    (

    DATE TIME STAMP,

    MSN VARCHAR2 (32 BYTE) NOT NULL,

    EVENT DATE NOT NULL,

    )

    PARTITION BY RANGE (EVENT)

    (

    CALL_P_01122015 PARTITION VALUES LESS THAN (TO_DATE (' 2015-12-01 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN ')),

    CALL_P_02122015 PARTITION VALUES LESS THAN (TO_DATE (' 2015-12-02 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))

    CALL_P_03122015 PARTITION VALUES LESS THAN (TO_DATE (' 2015-12-03 00:00:00 ',' SYYYY-MM-DD HH24:MI:SS ',' NLS_CALENDAR = GREGORIAN '))

    );

    We collect statistics for the 1st of the score of the month.

    BEGIN

    DBMS_STATS.gather_table_stats)

    ownname = > 'CALL. "

    tabname = > 'CALL_DTL ',.

    partName = > "CALL_P_01122015"

    estimate_percent = > 1,

    GRANULARITY = > 'APPROX_GLOBAL AND PARTITION,

    Cascade = > TRUE,

    degree = > 15);

    END;

    /

    And the stats will be copied in the rest of the partitions of the month.

    Start

    DBMS_STATS.copy_table_stats (ownname = > 'CALL')

    tabname = > 'PMS_CALL_DETAIL ',.

    srcpartname = > 'CALL_P_01122015 ',.

    dstpartname = > 'CALL_P_02122015');

    end;

    /

    Start

    DBMS_STATS.copy_table_stats (ownname = > 'CALL')

    tabname = > 'PMS_CALL_DETAIL ',.

    srcpartname = > 'CALL_P_01122015 ',.

    dstpartname = > 'CALL_P_03122015');

    end;

    /

    Start

    DBMS_STATS.copy_table_stats (ownname = > 'CALL')

    tabname = > 'PMS_CALL_DETAIL ',.

    srcpartname = > 'CALL_P_01122015 ',.

    dstpartname = > 'CALL_P_04122015');

    end;

    /

    ...

    ...

    Could someone advise if there could be potential problems with the copy of his stats?

    What I see, HIGH_VALUE and LOW_VALUE are the same for every single partition for the SQL below:

    Select nom_partition, HIGH_VALUE, LOW_VALUE from dba_part_col_statistics where table_name = column_name 'CALL' IN ("MSN");


    Will this result in CBO plan fetching suboptimal on SQL running on the table with predicate such as MSN and EVENT?

    Please suggest me resolution approaches.


    Thank you!!


    -Bibi





    It will depend on (among other things), how use you it as a predicate and unique how the column is.

    If you try to filter using predicates of beach in function with a range outside the stats then the CBO will be predicate weak cardinalities and therefore will promote the access of the index and nested loops which leads to this.

    If you are filtering on equality predicates and the key is unique there should be no problem really.

    It will depend also on whether the request knows which partition will be scanned, otherwise it will use global statistics, which will be probably the same as a partition, but they could easily change if you were to collect stats on any other partition.

    You have an environment you can use a test and see approach?

  • Problem I have TO solve with the query: PREV calculation to the current record

    Hi all

    My version of db:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    I have the problem to solve with a request (MUST BE a SELECT statement), but I do not understand how... I tried with the analytical function but... not just:

    I have this table:

    rownumKEY1KEY2A3PERCIMP
    1A123RISCP01/01/201410100
    2A123RISCP02/01/201411100
    3A123RISCP03/01/201415100

    Application of expected result:

    RESULTSKEY1KEY2A3PERCIMP
    90A123RISCP01/01/201410100
    80.1A123RISCP02/01/201411100
    68.085A123RISCP03/01/201415100

    Starts recording with rownum 1 (the lower date with the same KEY) I do: imp - (100 imp * perc), where imp = 100 and PERC = 10, so the first result of the calculation is: 90


    Now I have to go to record 2, so I do 90 - 11%: imp - (100 imp * perc), where imp = 90 and PERC = 11, results is 80.1

    Now I have to go to the 3d recording, so I 80.1 - 15%: imp - (100 imp * perc), where imp = 80.1 and perc = 15, results is 68 085

    So I have to use the previous to the current PERC.

    I'm sure it's possible through a combination of funcion analytical!

    Thanks to anyone who can help me!

    with

    data in the form of

    (select 1 rn "A123" key1, to_date('01-JAN-2014','DD-MON-YYYY') dat, 10 perc, 100 imp union double all the)

    Select option 2, 'A123', to_date (February 1, 2014 "," MON-DD-YYYY ""), 11, 100 of all the double union

    Select 3, 'A123', to_date (March 1, 2014 "," MON-DD-YYYY ""), 15, 100 double

    ),

    Solver (RN, Key1, DAT, PERC, IMP, result) as

    (select rn, key1, dat, perc, imp, imp * (1 - 0.01 * perc))

    from the data

    where rn = 1

    Union of all the

    Select d.rn, d.key1, d.dat, d.perc, d.imp, s.result * (1 - 0.01 * d.perc)

    s Solver,

    data d

    where d.rn = s.rn + 1

    )

    Select *.

    the Solver

    RN KEY1 DAT PERC IMP RESULT
    1 A123 01/01/2014 10 100 90
    2 A123 01/02/2014 11 100 80.1
    3 A123 01/03/2014 15 100 68.085

    Concerning

    Etbin

  • Data parameter problem

    Hello

    I am facing a problem with the parameter Data;

    I can't able to query the data for different dates in the range, but I am able to query the data for the same date in the range.

    Select the statement-

    Select RCT.GL_DATE in the RCT RA_CUST_TRX_LINE_GL_DIST_ALL

    where TO_CHAR (TRUNC (RCT.GL_DATE), 'DD-MON-YY')

    between TO_CHAR (TRUNC (TO_DATE(:P_GL_DATE_LOW)), 'DD-MON-YY')

    AND TO_CHAR (TRUNC (TO_DATE(:P_GL_DATE_HIGH)), 'DD-MON-YY');

    I am able to get the data for the date range - 05-JAN-2015/05-JAN-2015, 07-JAN-2015/07-JAN-2015 and so on...

    I'm not able to get the data for the date range - 05-JAN-2015/07-JAN-2015, 07-JAN-2015/09-JAN-2015 and so on...

    Can someone help me on this issue.

    Thanks in advance!

    Dilip Manon

    As John pointed out, use the date data type to compare dates:

    Select RCT.GL_DATE in the RCT RA_CUST_TRX_LINE_GL_DIST_ALL

    where RCT.GL_DATE

    (between TO_DATE(:P_GL_DATE_LOW)), 'DD-MON-YYYY')

    (AND TO_DATE(:P_GL_DATE_HIGH)), 'DD-MON-YYYY');

    Using TO_CHAR to compare dates, not only do you risk to make mistake and forget certain values, but also in this case stop you an index on GL_DATE may be used.

  • Trigger changing problem

    I've created a compound trigger that creates a trigger mutation error.

    Here are the trigger:

    DROP TRIGGER bi_fin_transaction
    /

    DROP TRIGGER ais_fin_transaction
    /

    CREATE OR REPLACE TRIGGER ai_fin_transaction
    FOR INSERT
    ON fin_transaction
    COMPOUND OF TRIGGER
    Number of TransactionNumber;
    TransactionAmount number (18.6);
    DiscountTakenAmount number (18.6);
    AfterBalanceAmount number (18.6);
    Number of InvoiceNbr;
    Date of MaxGlDate;
    number of v_count;
    date of gl_date;

    CURSOR operation IS
    SELECT invoice_nbr,
    gl_date
    OF gtt_ai_fin_transaction_work
    ORDER BY invoice_nbr;

    CURSOR recalculate IS
    SELECT transaction_nbr,
    transaction_amount,
    discount_taken_amount
    OF gtt_ai_fin_transaction
    ORDER BY gl_date,
    transaction_nbr;

    UNTIL EACH ROW IS
    BEGIN
    BEGIN
    SELECT ft.invoice_nbr,
    Max (COALESCE(ft.gl_date,ft.transaction_date))
    BY InvoiceNbr,
    MaxGlDate
    FT fin_transaction
    WHERE ft.invoice_nbr =: new.invoice_nbr
    GROUP BY ft.invoice_nbr;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END;

    IF: new.gl_date < MaxGlDate THEN
    INSERT INTO gtt_ai_fin_transaction_work
    VALUES (InvoiceNbr,
    MaxGlDate
    );
    END IF;
    PURPOSE BEFORE EACH ROW;

    AFTER EACH ROW IS
    BEGIN
    IF (: new.invoice_nbr IS NOT NULL) THEN

    UPDATE fin_invoice
    SET last_transaction_date =: new.transaction_date
    WHERE invoice_nbr =: new.invoice_nbr;

    END IF;

    IF (: new.payment_nbr IS NOT NULL) THEN

    UPDATE fin_payment
    SET last_transaction_date =: new.transaction_date
    WHERE payment_nbr =: new.payment_nbr;

    END IF;
    END AFTER EACH LINE;

    AFTER STATEMENT IS
    BEGIN
    SELECT COUNT (*)
    IN v_count
    OF gtt_ai_fin_transaction_work;

    IF v_count > 0 THEN
    CURRENT transaction;

    LOOP

    Get operation IN InvoiceNbr,
    gl_date;
    OUTPUT WHEN transaction % NOTFOUND;

    DELETE FROM gtt_ai_fin_transaction;

    INSERT INTO gtt_ai_fin_transaction
    SELECT transaction_nbr,
    COALESCE(gl_date,transaction_date),
    CASE transaction_type WHEN IN ('PAY', 'CON', 'CRD', 'PAD', "ADJ", "ACC", "NSF", "COR", "PADR")
    THEN transaction_amount *-1
    Of OTHER transaction_amount
    END,
    CASE transaction_type WHEN IN ('PAY', 'CON', 'CRD', 'PAD', "ADJ", "ACC", "NSF", "COR", "PADR")
    THEN discount_taken_amount *-1
    Of OTHER discount_taken_amount
    END,
    0.00,
    NULL VALUE
    OF fin_transaction
    WHERE invoice_nbr = InvoiceNbr
    AND payment_nbr IS NOT NULL
    ORDER OF COALESCE(gl_date,transaction_date),
    transaction_nbr;

    SELECT after_balance_amount
    IN AfterBalanceAmount
    OF fin_transaction
    WHERE invoice_nbr = InvoiceNbr
    AND payment_nbr IS NULL;

    Recalculate OPEN;

    LOOP

    FETCH recalculate IN TransactionNumber
    TransactionAmount,
    DiscountTakenAmount;
    OUTPUT WHEN recalculate % NOTFOUND;

    AfterBalanceAmount: = AfterBalanceAmount + TransactionAmount + DiscountTakenAmount;

    UPDATE fin_transaction
    SET after_balance_amount = AfterBalanceAmount,
    after_status = CASE WHEN AfterBalanceAmount = 0.00
    THEN 'C '.
    ELSE 'O'
    END
    WHERE transaction_nbr = TransactionNumber;

    END LOOP;
    Recalculate the RELATIVES;

    END LOOP;
    CLOSE transaction;
    END IF;

    END AFTER STATEMENT;

    END;
    /

    ENGAGE
    /

    Here is the statement of "insert" the origin of the problem:

    INSERT INTO fin_transaction (transaction_nbr, invoice_nbr, payment_nbr, transaction_amount,

    gl_date, transaction_type, discount_amount, transaction_date, reversed_transaction_nbr,

    discount_taken_amount, after_balance_amount, after_status, financial_source, add_by, add_date,

    remaining_onaccount)

    (SELECT 255793, invoice_nbr, payment_nbr, transaction_amount)

    , TO_DATE (' 03/05/2015-00:00:00 "," DD-MM-YYYY HH24:MI:SS'), 'VCHK,' discount_amount, TO_DATE (' 03/05/2015-00:00:00 "," DD-MM-YYYY HH24:MI:SS'),

    255416, discount_taken_amount, after_balance_amount + transaction_amount + 0.000000, 'o', financial_source, 'PLANGTON,'

    To_date (' 03/05/2015-12:31:44 ',' DD-MM-YYYY HH24:MI:SS'), remaining_onaccount

    OF fin_transaction

    WHERE transaction_nbr = 255416)

    Here is the table of the affected table definition:

    CREATE TABLE fin_transaction
    (
    transaction_nbr number not null,
    number of invoice_nbr null,
    number of payment_nbr null,
    transaction_amount number (18.6) not null,
    gl_date date null,
    transaction_type varchar2 (10) not null,
    discount_amount number (18.6) null,
    transaction_date date not null,
    number of reversed_transaction_nbr null,
    discount_taken_amount number (18.6) default null, 0
    after_balance_amount number (18.6) not null,
    after_status char (1) not null
    CONSTRAINT ckc_fin_tran_after_status CHECK (after_status IN ('O', 'C')),
    remaining_onaccount number (18.6) null,
    financial_source char (3) not null
    CONSTRAINT ckc_fin_tran_financial_source CHECK (financial_source IN ('A / P ',' has / R ""));
    reference_id varchar2 (10) null,
    add_by varchar2 (40) not null default user,.
    add_date date DEFAULT sysdate not null,
    number of payment_journal_nbr null,
    misc_amount number (18.6) null,
    misc_gl_acct_nbr varchar2 (75) null,
    pdu_payment_status char (1) default ' is not null
    CONSTRAINT ckc_fin_tran_pdu_paymentstatus CHECK (pdu_payment_status IN (', 'F', 'W', 'O', 'P')),
    remaining_onaccount_original number (18.6) DEFAULT 0 no no,.
    number of vc_register_nbr null,
    vc_register_addto_flag char (1) default ' is not null
    CONSTRAINT ckc_fin_tran_vc_reg_addto_flag CHECK (vc_register_addto_flag IN ('Y', ' don't)).
    additional_gl_transaction_flag char (1) default ' is not null
    CONSTRAINT ckc_fin_tran_add_gl_trans_flag CHECK (additional_gl_transaction_flag IN ('Y', ' don't)).
    gl_exchange_rate number (20,10) null,
    commodity_id varchar2 (10) null,
    CONSTRAINT pk_fin_transaction PRIMARY KEY (transaction_nbr)
    using index
    tablespace smartsoft_index
    )
    tablespace smartsoft_data
    /

    I can not (for the life of me) see this would cause a trigger of mutation.

    Any help would be appreciated.

    BTW Oracle 11.2.0.2 on Windows 64-bit server.

    Murray

    Problem has been resolved by upgrading to 11.2.0.4 and slight modification to trigger.

  • Equivalent OBIEE TO_DATE and SUBSTR functions

    I have the formula for the next column, which works correctly:

    SUM (CASE WHEN (TimeStampDiff (SQL_TSI_month, "Registration - College". "" Effective colleges F. ((("' Program Start Date ', current_date)) / 12 < 6 THEN 1 ELSE 0 END)


    I want to replace the current_date with scope of practice. Because the scope of practice is currently not in a date format (e.g. 201213, 201314, 201415), I need to use the TO_DATE and SUBSTR functions OBIEE equivalent to convert this field into a format that can be used by the TimeStampDiff function.

    The current (outside OBIEE) SQL for the conversion of the year at a date looks like this:

    To_date (substr (Fiscal_Year, 1, 4) |) '09', "YYYYMM")


    I tried to replace current_date in the column formula above by the following, but it didn't work:

    To this day (Substring ("registration - College". "D time". " "Exercise" FROM 1 to 4) | '09', "YYYYMM")

    TO_DATETIME (LEFT ("registration - College". "D time". " ("' Exercise ', 4) | ("/ 09/01 ', ' yyyy/mm/dd')

    Good course assuming that "registration - College". "D time". " "' Exercise ' is of type varchar, otherwise you will first need to cast as varchar or LEFT won't like it (but the error will tell you what the problem is exactly).

  • Problem with procedure

    Hello world

    I created a procedure that takes 2 dates as parameters, and inserts the values of dates between the parameters in the table.

    create or replace procedure ENTER_DATES(START_DATE IN DATE, END_DATE IN DATE) is
    V_ENTERED_DATE date := START_DATE;
    begin
    LOOP
    if V_ENTERED_DATE <= START_DATE then
    insert into TEST_TABLE(NEW_DATE)
    values(V_ENTERED_DATE);
    V_ENTERED_DATE := TO_DATE(V_ENTERED_DATE) + 1;
    EXIT when V_ENTERED_DATE = END_DATE;
    end if;
    END LOOP;
    END;
    /
    

    I have compiled the procedure and had no problem, but when I try to run the procedure. NEVER, THE EXECUTION ENDS.

    exec ENTER_DATES(to_date('01-OCT-14'),to_date('14-OCT-14'));
    

    It of like I started and loop infinite.

    Please help me understand my mistakes.

    This stated case seems confused.

    What happens if your end_date has a share after midnght? He will never leave me.

    Why not just write:

    EVERYTHING V_ENTERED_DATE<= end_date="">

    insert into TEST_TABLE (NEW_DATE)

    values (V_ENTERED_DATE);

    V_ENTERED_DATE: = V_ENTERED_DATE + 1;

    END LOOP;

  • the date conversion problem

    Hi friends,

    I have a problem with the conversion of the date in my PB.

    SELECT eff_dt, TO_CHAR (TO_DATE (eff_dt, 'Dd-mon-yy'), 'dd-mm-yyyy') DATE from une_table;

    It gives me o/p as -.

    DATE OF EFF_DT

    01.01.1950 00:00:00 01/01/2050

    as you can see here the year is wrong, while I convert the date that I use the substr() also to cut the year of first line, but it gives me the 50 i.e. onle last (YY)

    So, if someone can help me with this prob.

    If eff_dt is a column DATE, then stop calling to_date on it.

    If this is not the case, consider making it into a DATE column. If you are unable to do this, use the format mask appropriate when you call to_date

  • TO_DATE with invalid month value does not gicve of error

    I have a where clause that has a where clause of the query condition like this:

     where  Reynolds in ( '113' ) AND Rotomac in ( '418' ) AND (to_date(ins_date,'YYYY/DD/MM') >= to_date('01/90/2012','DD/MM/YYYY') OR del_date is null);
    

    ins_date is varchar2 which I convert it to a DATE using the to_date function.

    Why it does not work it only gives me error even if I put 90 MM?

    you have lines where this part:

    Reynolds ("113") AND Rotomac games ('418')

    and this part

    del_date is null

    is the problem?

    because you get only an error when the condition is evaluated is not the case if she didn't have to be evaluated...

    example:

    SELECT * FROM dual

    where 1 = 2 and sysdate > = to_date('01/90/2012','DD/MM/YYYY')

    will not return an error 1 is never equal to 2, so no matter what the condition after the and is...

    HTH

  • Problem with restore DB

    I backed up the database using sqldeveloper > tools > export databases > suckered into the sql file. But now I don't know how to restore, in particular tables, they contain important data. Database is 11g.

    I backed up the database using sqldeveloper > tools > export the database > suckered into the sql file. But now I don't know how to restore, in particular tables, they contain important data. Database is 11g.

    -Now you can have a bit of a problem. Developer SQL creates just one (or more) files SQL according to the options you have chosen.

    If you put everything in a SINGLE file restore you what you want by finding and running portions of the file that you want to use MANUALLY.

    Here it is just a SMALL example of an 'export' for a file ONLY the SCOTT dept and emp tables and data. You can see how everything (TABLE DDL, DATA) is just mixed:

    --------------------------------------------------------
    -File created - Monday-June-02-2014
    --------------------------------------------------------
    --------------------------------------------------------
    -The DOF for Table DEPT
    --------------------------------------------------------

    "CREATE TABLE"SCOTT" DEPT.
    ("DEPTNO" NUMBER (2.0),)
    VARCHAR2 (14 BYTE) "DNAME",.
    "LOC" VARCHAR2 (13 BYTE)
    ) CREATION OF IMMEDIATE SEGMENT
    PCTFREE, PCTUSED, INITRANS 40 10 1 MAXTRANS 255 NOCOMPRESS SLAUGHTER
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS USER_TABLES DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT 1)
    TABLESPACE 'USERS ';
    --------------------------------------------------------
    -The DOF for EMP Table
    --------------------------------------------------------

    "CREATE TABLE"SCOTT" EMP.
    ('EMPNO' NUMBER (4,0),)
    'ENAME' VARCHAR2 (10 BYTE),
    VARCHAR2 (BYTE 9) "JOB."
    "MGR" NUMBER (4,0).
    "HIREDATE" DATE,
    "SAL" NUMBER (7.2).
    NUMBER (7.2) "COMM"
    "DEPTNO" NUMBER (2.0)
    ) CREATION OF IMMEDIATE SEGMENT
    PCTFREE, PCTUSED, INITRANS 40 10 1 MAXTRANS 255 NOCOMPRESS SLAUGHTER
    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS USER_TABLES DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT 1)
    TABLESPACE 'USERS ';
    REM, INSERTING in SCOTT. DEPT
    TOGETHER TO DEFINE
    Insert into SCOTT. DEPT (DEPTNO, DNAME, LOC) values (10, 'ACCOUNTS', 'NEW YORK');
    Insert into SCOTT. DEPT (DEPTNO, DNAME, LOC) values (20, ' SEARCH * ","DALLAS");
    Insert into SCOTT. DEPT (DEPTNO, DNAME, LOC) values (30, ' SALES * ","CHICAGO");
    Insert into SCOTT. DEPT (DEPTNO, DNAME, LOC) values (40, 'OPERATIONS', 'BOSTON');
    REM, INSERTING in SCOTT. FM3
    TOGETHER TO DEFINE
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7369, 'new_SMITH', 'CLERK', 7902, to_date('17-DEC-80','DD-MON-RR'), 30, null, 20);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7499, 'ALLEN', 'SALESMAN', 7698, to_date('20-FEB-81','DD-MON-RR'), 1600,300, 30);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7521, 'WARD', 'SALESMAN', 7698, to_date('22-FEB-81','DD-MON-RR'), 1250,500, 30);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7566, 'new_JONES', 'MANAGER', 7839, to_date('02-APR-81','DD-MON-RR'), 2975, null, 20);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7654, 'MARTIN', 'SALESMAN', 7698, to_date('28-SEP-81','DD-MON-RR'), 1250,1400, 30);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7698, 'BLAKE', 'MANAGER', 7839, to_date('01-MAY-81','DD-MON-RR'), 2850, null, 30);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7782, 'CLARK', 'MANAGER', 7839, to_date('09-JUN-81','DD-MON-RR'), 2450, null, 10);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7788, 'new_SCOTT', 'ANALYST', 7566, to_date('19-APR-87','DD-MON-RR'), 3000, null, 20);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7839, 'KING', 'PRESIDENT', null, to_date('17-NOV-81','DD-MON-RR'), 5000, null, 10);


    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7844, 'TURNER', 'SALESMAN', 7698, to_date('08-SEP-81','DD-MON-RR'), 1500,0, 30);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7876, 'new_ADAMS', 'CLERK', 7788, to_date('23-MAY-87','DD-MON-RR'), 1100, null, 20);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7900, 'JAMES', 'CLERK', 7698, to_date('03-DEC-81','DD-MON-RR'), 950, null, 30);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7902, 'new_FORD', 'ANALYST', 7566, to_date('03-DEC-81','DD-MON-RR'), 3000, null, 20);
    Insert into SCOTT. Values of EMP (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO) (7934, 'MILLER', 'CLERK', 7782, to_date('23-JAN-82','DD-MON-RR'), 1300, null, 10);

  • '=' with to_date function fails to get results

    I have the table for more visits. my table has two fields survey_id (number) and visit_date (date).

    the visit_date also contain the time visiting hh.

    When I query the table to find information for a day and using the following qyery:

    Select survey_id, visit_date

    from my_table

    where visit_date = to_date('26/04/2010','DD/MM/YYYY');

    Therefore, no data found

    but when I used another query such as

    Select survey_id, visit_date

    from my_table

    where visit_date > to_date('25/04/2010','DD/MM/YYYY');

    There are records to date 26/04/2010.

    In other words, always when I query the table for a day using

    visit_date = to_date(:my_date,'DD/mm/YYYY');

    There is data in the table, I think there is problem of hh in the field of visit_date

    Oracle stores dates in digital form (I think 9-digit) format that includes both.

    When you use the operator = with a truncated string, it assumes zeros for the time elements.

    If your first query is looking for visits that have been at exactly midnight.

    Your options are to use the trunc function as suggested or use the syntax "between".

  • TO_CHAR fucntion problem with dates.

    Hi all

    I tested the following problem with 10g and 11g databases, and the problem is the same.

    create table aa (a date);
      insert into aa values('23-Mar-2014');
     commit;
    

    now the following query gives no results

    select count(*) from aa
    where to_char(a,'dd-Mon-yyyy') >='23-MAR-2014' and to_char(a,'dd-Mon-yyyy') <='23-Apr-2014';
    COUNT(*)
    ----------
     0
    

    and the following query gives the results

    select count(*) from aa
    where a>='23-Mar-2014' and a<='23-Apr-2014'
    
    COUNT(*)
    ----------
      1
    

    Why?

    We need the to_char working for our criteria of search dot net application.

    kindly guide us.

    Thank you

    You're hurting. Why convert a date into a string of characters and try to compare it to another string? This is false.

    Insert into aa values('23-Mar-2014');

    should be

    insert into aa values (to_date (March 23, 2014 ',' MON-DD-YYYY "");)

    and your selection should be:

    Select count (*) in aa

    where a > = to_date (March 23, 2014 ',' MON-DD-YYYY') and to_date (April 23, 2014 ',' MON-DD-YYYY "")

Maybe you are looking for

  • automatic update

    How can I get my updated 8-level victory to Win 10?

  • Does the HP 5500 - 24G - PoE + (JG541A) equipped with a power supply?

    The documentation is not clear. I need to know if a redeemable only in hot power supply is supplied with the JG541A switch. Documentation, says 'must select Min 1 Power Supply'. I guess there's one, but the image that HP has the back of the switch sh

  • error 1632

    When you try to install any game, now I get this error message 1632. I have emptied my temporary files and tried again but without success someone hav a clue what I can do.I'm running vista 64 on an asus 50 help please!

  • BlackBerry Z30 problems with everything!

    Just bought my z30. But I have problems with:-Blackberry world isn't download ANY application "an error has occurred processing your request" - the camera when flips horizontally do not reverse the camera image and use that half of the screen - the c

  • Error when updating of 5.0.0.1049 :(blackBerry Smartphones

    My blackberry "BOLD" 9000 has received an update from 4.6 to 5.0 YAY I thought how ever this is what happened...     I have connected my 9000 to my laptop, open the clicked Desktop Manager to install and it says first... "one or more error cannot be