Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2004
    Posts
    127

    Unanswered: Extracting all data from a table from a specific date

    Hi,

    Is it possible to carry out a CTAS from a specific date? For example I need to create a table that contains all data from another table from 10th December and prior only. My database is not in flashback mode.

    Is this possible, if so, how?

    Thanks in advance.

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    I might be missing something, but how about?

    create table new_table as
    select * from old_tablw
    where the_date_column <= to_date('12/10/2007','mm/dd/yyyy');
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Bill's solution might work; then again it might not if the column really contains datetime values.
    Otherwise use BETWEEN
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Jun 2004
    Posts
    127
    Hi,

    Is the 'the_date_column' specific to 10g, only I recieve the following error:

    ORA-00904: "THE_DATE_COLUMN": invalid identifier

    Thanks in advance!

  5. #5
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Quote Originally Posted by FAC51
    ORA-00904: "THE_DATE_COLUMN": invalid identifier
    By THE_DATE_COLUMN, Bill meant the column in your table that records the date of the entry - assuming it has one. It might be called THE_DATE_COLUMN, it might be called TRANSACTION_DATE, it might be called MY_DT_COL, ...

    If there are no dates recorded in your table then unless you have a backup copy of the data as at 10th of Decemember you are stuffed!

  6. #6
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    restore backup from BEFORE 10th december
    set until 10th december
    recover database

    Flashback mode doesn't allow you to query a table back in time, Flashback query does. (different technology alltogether).

  7. #7
    Join Date
    Dec 2003
    Posts
    1,074
    Note that JMartinez's suggestion will send the entire database back in time, not a single table. There's Tabespace Point in Time Recovery (TSPITR), but I could never get it to work. Plus, it also probably means more than 1 table in your case. --=cf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •