help with date column

I have a xyz of Table with the following columns:

sdate DATE
count_views NUMBER (20)

The table was created by someone about 1.5 years back. It contains data in comparison with June 2009 to date.

When I run a query on the subject:

SELECT DISTINCT sdate FROM xyz WHERE (sdate) BETWEEN TO_DATE('01-JAN-09') AND TO_DATE('31-DEC-09').

I get the output in form:

sdate
- - -
30 NOVEMBER 09
31 DECEMBER 09


However, when I change the query to:

SELECT DISTINCT sdate FROM xyz WHERE TO_DATE (sdate) BETWEEN TO_DATE('01-JAN-09') AND TO_DATE('31-DEC-09').

I get the output in form:

sdate
- - -
30 JUNE 09
30 JULY 09
30 AUGUST 09
30-SEP-09
30 OCTOBER 09
30 NOVEMBER 09
31 DECEMBER 09


Please can someone tell what maybe the problem with the table?

You can easily update the content of the table. Here's an example of how to do to convert a date:

with sample_table as (select to_date('13/12/0009', 'dd/mm/yyyy') dt from dual union all
                      select to_date('31/07/0010', 'dd/mm/yyyy') dt from dual union all
                      select to_date('24/12/2009', 'dd/mm/yyyy') dt from dual union all
                      select to_date('01/09/1998', 'dd/mm/yyyy') dt from dual)
-- end of sample data
select dt,
       case when dt < to_date('01/01/1900', 'dd/mm/yyyy') then
                 add_months(dt, 2000*12)
            else dt
       end new_dt
from   sample_table;

DT                  NEW_DT
------------------- -------------------
13/12/0009 00:00:00 13/12/2009 00:00:00
31/07/0010 00:00:00 31/07/2010 00:00:00
24/12/2009 00:00:00 24/12/2009 00:00:00
01/09/1998 00:00:00 01/09/1998 00:00:00

(Permanently update the table, you need to add the 2000 years on in an update, of course!)

Published by: Boneist on August 17, 2010 14:27

Tags: Database

Similar Questions

  • Help with date required

    Hello

    I have two columns with the date and the other with time, but both are vchart2.

    What is the best way to convert a column of actual date

    or add a column with the effective date and fill it with data from the first and second column

    in the format (12 October 2013 10:31:11 ', JJ 24HH:MI:SS)?

    Thank you very much

    Hello

    user9223521 wrote:

    ...  You're right, that a space between column1 and column2 is useful.

    I do not think that a space it is useful, but if you think it is, go ahead and add - we.  The important thing is that the data in the 1st argument to TO_DATE having match format in the 2nd argument.  If there is no space between the year and the time in the 1st argument, then do not use a space between the year and hour in the 2nd argument.

    This code is not convert the column or add a column? ...

    It's true.  Replace the 2 columns existing VARCHAR2 with a DATE column is a good idea.  Here's a way to do it:

    1. Use ALTER TABLE to add a new column (let's call it entry_dt.  You cannot use the same name as one of the existing columns.)
    2. UPDATE the table using TO_DATE as shown above, to set the value of entry_dt
    3. Use ALTER TABLE to drop the old column1 and column2
    4. If you want to rename entry_dt to one of the old names of columns, use ALTER TABLE to this

    If you have incorrect or invalid data, then step 2 fails.  See

    Re: How to select valid dates only

    of the means to detect bad data without triggering an error, then you can fix before the UPDATE, or ignore it all by doing the UPDATE.

  • Help with date code

    SRY about that amount of lines of code... but I really need help...

    I have to insert into a table, the date as 12/10/2009 and time, like 22:34:12... but, when I select a date picker date and insert into a text field... the time I got this result:

    If the inserted date was 12/12/2009 time 22:34:12
    The result is... 12/12/0922 34:12:00 < < < < < s get just the number two last year and by inserting the two number first time in the year, as the year 0922...

    I m using a javascript source to create a date picker...

    and this is the procedure to insert in the table...



    PROCEDURE set_atendimento)
    p_id_chamado_atendimento IN chamado_atendimento.id_chamado_atendimento%TYPE,
    p_id_chamado IN chamado_atendimento.id_chamado%TYPE,
    p_informacao IN chamado_atendimento.informacao%TYPE,
    p_datahora_inicio IN chamado_atendimento.datahora_inicio%TYPE,
    p_datahora_fim IN chamado_atendimento.datahora_fim%TYPE,
    p_hora_inicio IN VARCHAR2,
    p_hora_fim in VARCHAR2
    )
    IS

    v_inicio DATE;
    v_fim DATE;

    BEGIN
    --
    v_inicio: = TO_DATE (TO_CHAR(p_datahora_inicio || p_hora_inicio), "DD/MM/YYYY HH24:MI:SS");
    v_fim: = TO_DATE (TO_CHAR(p_datahora_fim || p_hora_fim), "DD/MM/YYYY HH24:MI:SS");
    --
    UPDATE
    chamado_atendimento
    SET
    Informação = UPPER (p_informacao)
    WHERE
    id_chamado_atendimento = p_id_chamado_atendimento;
    IF SQL % NOTFOUND THEN
    INSERT INTO
    chamado_atendimento
    (id_chamado_atendimento, id_chamado, id_operador, datahora_inicio, datahora_fim, Informação)
    VALUES
    (SEQ_CHAMADO_ATENDIMENTO.nextval, p_id_chamado, pkg_operador.get_id_operador, v_inicio, v_fim, UPPER (p_informacao));
    END IF;
    --
    END;

    -------------


    Here's the JAVASCRIPT
    ------------


    < script language = "JavaScript" type = "text/JavaScript" >
    $(function() {})
    $. datepicker.setDefaults({)
    showOn: 'button ',.
    ButtonImageGadget: ' / i/themes/fwsac/includes/jquery/images/calendario.gif',
    buttonImageOnly: true,
    closeText: 'can ', he said.
    prevText: "< previous ',"
    nextText: ' Pr & oacute; ximo > ',
    currentText: "Hoje,"
    monthNames: ['Janeiro', 'February', 'March & eacute; o', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
    monthNamesShort: ['Jan', 'Feb', 'Mar', 'Abr', 'May', 'June', 'July', 'There are', 'Set', 'Out', 'November', 'December'],
    dayNames: ["Domingo","Segunda-feira ',' Ter & ccedil;"] [' a - feira ","Quarta-feira","Quinta-feira","Sexta-feira","Saturday"],
    dayNamesShort: ["Dom", "Seg", "Ter", 'Quality', 'Who', 'Sex', 'Sab'],
    dayNamesMin: ["Dom", "Seg", "Ter", 'Quality', 'Who', 'Sex', 'Sab'],
    dateFormat: dd/mm/yy"."
    firstDay: 0,
    isRTL: false,
    showAnim: "creep".
    });
    $('#P5004_DATAHORA_INICIO,_#P5004_DATAHORA_FIM').datepicker ({beforeShow: fdateRange});
    });
    function fdateRange (input) {}
    return {}
    minDate: (input.id == 'P5004_DATAHORA_FIM'? $("#P5004_DATAHORA_INICIO").datepicker ("getDate"): null);
    maxDate: (input.id == 'P5004_DATAHORA_INICIO'? $("#P5004_DATAHORA_FIM").datepicker ("getDate"): null)
    }
    };
    < /script >


    what I need to change to get the 4 digits of the year and all the numbers of the hour and the conca "|" with the date?

    can anyone help with this, pls?

    Hello again,

    Yes, maybe you need to change them all to varchar2. You work with 2 different types of data, trying to concatenate them and then convert them. I would start with them all the same.

    Don.

  • Help with data &amp; Apps!

    I noticed on my friends phone all of its newspapers of 0bytes data, someone knows why?

    She was also very secret making a new icloud I found as well as the apple, where in addition to his phone can it ID to hide apps? Sorry to ask just so frustrated with him in support when she is not working she is just on a phone that 'I' pay for.

    jeff2965 wrote:

    I noticed on my friends phone all of its newspapers of 0bytes data, someone knows why?

    She was also very secret making a new icloud I found as well as the apple, where in addition to his phone can it ID to hide apps? Sorry to ask just so frustrated with him in support when she is not working she is just on a phone that 'I' pay for.

    We can not help you with your relationship problems.  If you are having problems with privacy and trust to your girlfriend, you may need that back with her.  We do not know any of you.

  • Compare sysdate with date column value

    Hello

    I need to compare the current_date (sysdate) with the value of column date in the sql below.

    Current_date is sysdate in the sql below.

    Can someone please let me know if the below sql is correct.

    SELECT ZZ. ZIP_CDE

    CC. CITY_NAM

    CC. ST_ABBR

    ZZ. ZIP_CDE_TYP_CDE

    ZZ. ZIP_CDE_STRT_DTE

    OF MDMGEO. T_CITY CC

    MDMGEO. ZC T_ZIP_CITY

    MDMGEO. ZZ T_ZIP_CODE

    MDMSTGGEO. T_USPS_DETAIL_RECORD_distinct T

    WHERE CC. CITY_GNRTD_ID = ZC. CITY_GNRTD_ID

    AND ZZ. ZIP_CDE = ZC. ZIP_CDE

    AND ZZ. ZIP_CDE_STRT_DTE = ZC. ZIP_CDE_STRT_DTE

    AND CURRENT_DATE BETWEEN ZZ. ZIP_CDE_STRT_DTE

    AND ZZ. ZIP_CDE_END_DTE

    AND CURRENT_DATE BETWEEN ZC. ZIP_CITY_STRT_DTE

    AND ZZ. ZIP_CDE = T.DTL_ZIP_CDE

    AND CC. CITY_NAM = PRFRD_LST_LINE_CITY_ST_KEY_NAM T.

    AND CC. ST_ABBR = T.ZIP_ST_ABBR_CDE

    Thank you!

    I want to sleep... maybe too ZZ

    In any case, apparently. What is the problem if necessary?

  • Need help with Data Bridge/DataAssist!

    Hi all

    So Ive recently brought Data Bridge I need to create a search box on a site I'm developing. I have a limited knowledge of Dreamweaver and so advised to buy Data Bridge to help me create my search box. This is what I would like as my Web page to do.

    The site is a funeral and I need to create a page for donations with a search box, so that donors can enter the name of the deceased and therefore a name (or names that are similar to what has been entered) will appear. Next to the name will be a URL.  Every deceased person will have a unique URL, used gift payments actually being taken on this site, the URL will link to a page of different gifts for that person on another site, the link will redirect them to this site (I hope all this makes sense!).

    Ive Setup MAMP on my computer, created a database table in phpmyadmin, deamweaver connected to this base with a Recordset, created a page php DataAssist Search Wizard automatically inserts the form on my donations.html page (see below - donations.html and php)

    But I'm stuck now what to do next. The results will appear on this page or do I create a html page appear on the results and a new php page for results? I'm confused as to what I should do?

    Any help REALLY appreciated!

    screenshot.jpg

    <? php require_once('Connections/milesdata.php');? >

    <? php require_once("webassist/database_management/wada_search.php");? >

    <? PHP

    (Copyright 2005, WebAssist.com) WA database search

    Recordset: milesdata;

    Advanced: donations.html;

    Form: form1;

    $WADbSearch2_DefaultWhere = "";

    If (! session_id()) session_start();

    If ((isset($_POST["WADbSearch2"])) & & ($_POST ["WADbSearch2"]! = "")) {}

    $WADbSearch2 = new FilterDef;

    $WADbSearch2-> initializeQueryBuilder("MYSQL","1");

    statements of keyword tables

    $KeyArr0 = array ('name');

    comparison list additions

    $WADbSearch2-> keywordComparison (' $KeyArr0, "".) ((isset($_POST["Name"])))? "$_POST ['Name']:" ") ."","and","includes",",%20","%20","%22","%22",0);"

    Save the query in a session variable

    If (1 == 1) {}

    $_SESSION ['WADbSearch2_search'] = $WADbSearch2-> whereClause.

    }

    }

    else {}

    $WADbSearch2 = new FilterDef;

    $WADbSearch2-> initializeQueryBuilder("MYSQL","1");

    get a session variable filter definition

    If (1 == 1) {}

    If (isset($_SESSION["WADbSearch2_search"]) & & $_SESSION ['WADbSearch2_search']! = "") {}

    $WADbSearch2-> whereClause = $_SESSION ["WADbSearch2_search"];

    }

    else {}

    $WADbSearch2-> whereClause = $WADbSearch2_DefaultWhere;

    }

    }

    else {}

    $WADbSearch2-> whereClause = $WADbSearch2_DefaultWhere;

    }

    }

    $WADbSearch2-> whereClause = str_replace ("\" "," "", $WADbSearch2-> whereClause);

    $WADbSearch2whereClause = ";

    ? >

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via PHP_VERSION < 6) {}

    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;

    }

    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);

    Switch ($theType) {}

    case 'text ':

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "long":

    case "int":

    $theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';

    break;

    case "double":

    $theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';

    break;

    case "date":

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }

    @mysql_select_db ($database_milesdata, $milesdata);

    $query_milesdata = "SELECT url OF Don WHERE name = 'name' ORDER BY name ASC";

    setQueryBuilderSource($query_milesdata,$WADbSearch2,false);

    $milesdata = mysql_query ($query_milesdata, $milesdata) or die (mysql_error ());

    $row_milesdata = mysql_fetch_assoc ($milesdata);

    $totalRows_milesdata = mysql_num_rows ($milesdata);

    ? >

    <? PHP

    mysql_free_result ($milesdata);

    ? >

    DO NOT copy anything from the donation.php page is the reason why it probably doesn't just copy the code I pasted above and paste it into a new .php file - save as what you want BUT remember to point the scope of shapes on the page.

  • Help with Date Picker months classic display in 4.2.5.00.08

    Version: 4.2.5.00.08

    Topic: business 3

    Hello

    I have two selectors classical fields of dates that represent a Date "from" and "to this day".

    When you click on the calendar icon and change the month in the select list on the "Date from" and selecting a date, and then by opening the 'to Date' by clicking on the icon of the month calendar is displayed corresponds to the current month (sysdate) in the Select list.

    Demand for the user must have the month in the match of the calendar 'To Date' the month selected on the calendar "Date from" when you click on the calendar icon on "Date to the.

    Since this announcement, the current month is September. If the month is changed in October and a date is selected in the 'Date' then I click on the 'To Date' calendar icon the month displayed in the list select should be October not September.

    How can this be achieved?

    Thank you

    Joe

    Joe R wrote:

    Version: 4.2.5.00.08

    Topic: business 3

    I have two selectors classical fields of dates that represent a Date "from" and "to this day".

    The two dates selectors 'Business' and classic theme 3 are well beyond their expiration date. A modernization program for this app would be a very good idea...

    When you click on the calendar icon and change the month in the select list on the "Date from" and selecting a date, and then by opening the 'to Date' by clicking on the icon of the month calendar is displayed corresponds to the current month (sysdate) in the Select list.

    Demand for the user must have the month in the match of the calendar 'To Date' the month selected on the calendar "Date from" when you click on the calendar icon on "Date to the.

    Since this announcement, the current month is September. If the month is changed in October and a date is selected in the 'Date' then I click on the 'To Date' calendar icon the month displayed in the list select should be October not September.

    How can this be achieved?

    It can be done with dynamic action of executing JavaScript Code. I'd like to think that there is a better way to do it than that, which basically extract the picker of the year and month, then rewrites the JS code that triggers the date picker To use them as parameters month and year.

    Dynamic action

    Event: Mouse enter

    Selection type: jQuery Selector

    jQuery Selector: #P1_TO_IMG

    Real Actions

    Action: Run the JavaScript Code

    Fire on Page load: NO.

    Code:

    var from, d, y, m, button, href, js, p;
    
    from = $v('P1_FROM');
    
    if (from) {
      d = new Date(from);
      y = d.getUTCFullYear().toString();
      m = (d.getUTCMonth() + 1).toString();
    
      button = $('#P1_TO_fieldset.datepicker a');
      href = button.attr('href');
      js = href.match(/^(javascript:void\(\$p_DatePicker\()(.+)(\)\);$)/);
      p = js[2].split(',');
    
      p[8]  = "'" + y + "'";
      p[13] = "'" + ((m.length === 1) ? "0" + m : m) + "'";
    
      href = js[1].concat(p.join(), js[3]);
      console.log(href);
      button.attr('href', href);
    }
    

    Replace P1_FROM and P1_TO with the names of your items as needed.

  • Help with computing columns

    Hello

    I have a report that shows data person & phone as follows:
    Name             Emp No        Phone Type       Phone Number
    Joe Bloggs      12345          Home              01333 1111222
    Joe Bloggs      12345          Work              02222 7777777
    Joe Bloggs      12345          Mobile            0777777662
    It uses the layer sown end user so the name and the emp does not come from the HRMS - Administration - Oracle Human Resources (Core) / person, a type of phone and the number comes from human resources HRMS - Administration - Oracle (Core) / phone (HR).

    Is there a way I can create 3 calculated columns "Telephony", "Work phone" and "Mobile phone" to display output like that?
    Name             Emp No        Home Phone            Work Phone            Mobile Phone
    Joe Bloggs      12345          01333 1111222        02222 7777777          0777777662
    The calucation of (for example) home phone would need to be something like "select the phone number where the phone Type ="Home"". "

    I can't imagine a way to do it - I wonder if I need to use the RANK or similar analytical function, or maybe there's a way I can use DECODE, but I can't get out!

    Any suggestions would be greatly appreciated.

    Thank you
    Hazel

    Hello

    You need to MAX and DECODE. If you the calculations will be something like:

    MAX (DECODE (phone Type, 'original', phone number))
    MAX (DECODE (phone Type, 'work', phone number))
    MAX (DECODE (phone Type, 'Mobile', phone number))

    Rod West

  • Help with date calculation

    Need help to calculate a future date.  Right now I have it where he Calc. 25 days in the future.  But need 25 working days in the future.

    Form1. Page1.Button1::click - (JavaScript, client)

    var oNow = new Date();
    Add 25 days and subject to the new date
    oNow = new Date (oNow.getFullYear (), oNow.getMonth (), (oNow.getDate () + 25))
    view the new date information
    sMsg = "in 25 days, it will be" + util.printd ("mm/dd/yyyy", oNow);
    sMsg += "\n" + "the day of the week will be" + util.printd ("dddd", oNow);
    App.Alert (sMsg, 3, 0)

    Hello

    I have not tried this, but it should be close:

    var oNow = new Date();
    var oDay = util.printd("dddd", oNow);
    // add 25 working days and make new date object
    if (oNow == "Saturday")
    {
         oNow = new Date(oNow.getFullYear(), oNow.getMonth(), (oNow.getDate() + 35 + 2));
    }
    else if (oNow == "Sunday")
    {
         oNow = new Date(oNow.getFullYear(), oNow.getMonth(), (oNow.getDate() + 35 + 1));
    }
    else
    {
         oNow = new Date(oNow.getFullYear(), oNow.getMonth(), (oNow.getDate() + 35));
    }
    // dispaly new date information
    sMsg = "In 25 working days it will be " + util.printd("mm/dd/yyyy", oNow);
    sMsg += "\n" + "The day of the week will be " + util.printd("dddd", oNow);
    app.alert(sMsg, 3, 0);
    

    The 35 is seven days for each of the 5-day work weeks. The + 2 and + 1 grow a weekend in the next business day.

    Hope that works,

    Niall

    Ensure the dynamics

  • Need help with date EXIF for raw images

    I have a little more than 100 images (taken by 2nd shooter) EXIF (JPEG and raw) who have the wrong date.  They were taken with a 2nd camera which was extinguished by + 15hrs min 57.

    There are many programs that will easily edit the EXIF date/time on JPEGs, but they do not work with raw images.

    I read that Lightroom can compensate for incorrect dates on import, but after searching, I can't find any information on how to do it.  Can someone please?

    In library view, go to the section metadata/change the Capture time. You can pass the time by a number of hours, that would get you some 3 minutes anyway. Under Publishing/catalogue of the parameters in the metadata tab, you can choose to write the date and time changes raw int (check box below) files.

  • Need help with date + put social security in shape in PDF format...

    HI -.

    I m working on a form that must be filled from the internet...

    The design I made I have InDesign - and the formfields I did I have Acrobat Pro.
    and finally I m setting everything in LiveCycle...

    I met two problems...

    I need the date field to correct himself--if the choice of the user to use the wrong format...

    for example -.

    We want to have AAAA-MM-JJ
    and if the user writes JJ MM AA-
    It must be accepted and corrected...

    Also - in Sweden in any case always write us the number of social security in this way
    YYMMDD-NNNN (N = number between 0 and 9)

    How can I get the requgnize field and 'demand' this format...

    I´ll hope my Swinglish can be understandable?

    Idespiran

    Perhaps the LC can detect the AcroForm fields and convert them into fields of LC, but you may lose some things like formatting, validation, calculation, etc.

    Is that the two are not compatible. I find easier to handle, Acrobat forms personally, but you might disagree.

    If you decide to use the LC forms, then you should post your question in the forum Live Cycle Designer.

  • Date column updated with trigger update of the geometry

    Hello

    I have a column named "GEO_MOD_DATE" which is supposed to be updated every time that my geometry column is updated. My trigger code is below. Currently the trigger is fired when other than my column of geometry columns are updated. I searched the forum and many other sites. As far as I know, my trigger is written correctly. But I can't understand why it is taken when the columns except my geometry column are updated. You have any ideas? Thanks in advance! Note that the trigger fires when I update the geometry column. However, it is also SHOOTING when the other columns are updated. I have also tried adding 'OF GDO_GEOMETRY' from "BEFORE UPDATE" paragraph and which did not help.

    Jeff

    Triggering factor:

    CREATE OR REPLACE TRIGGER OPER_ZONE_VALVE_GEO_BU_T
    BEFORE THE UPDATE
    ON OPER_ZONE_VALVE
    REFERRING AGAIN AS NINE OLD AND OLD
    FOR EACH LINE
    DECLARE
    v_foo NUMBER (9);
    BEGIN
    -Comment from below if you do not want to assign GEO_MOD_DATE
    BEGIN
    IF the UPDATE ("GDO_GEOMETRY") and: NEW.gdo_geometry IS NOT NULL
    THEN
    : NEW.geo_mod_date: = SYSDATE;
    ON THE OTHER
    : NEW.geo_mod_date: = NULL;
    END IF;
    EXCEPTION
    WHILE OTHERS
    THEN
    raise_application_error
    (- 20013,
    "Cannot be autoassign field OPER ZONE VALVE".
    );
    END;

    /*****/
    NULL;
    EXCEPTION
    WHILE OTHERS
    THEN
    raise_application_error
    (- 20013,
    'error in executing BEFORE INSERT TRIGGER OPER_ZONE_VALVE_GEO_BU_T;'
    );
    END;
    /

    --------------------------------------------
    And here is my table structure:

    CREATE TABLE OPER_ZONE_VALVE
    (
    MSLINK NUMBER (38),
    VALVE_NUMBER VARCHAR2 (8 BYTE),
    ECM_NUMBER VARCHAR2 (8 BYTE),
    VALVE_SIZE VARCHAR2 (4 BYTE),
    CONNECTION_TYPE VARCHAR2 (100 BYTE),
    HEADER_STREET VARCHAR2 (100 BYTE),
    HEADER_FEET VARCHAR2 (8 BYTE),
    HEADER_DIR VARCHAR2 (4 BYTE),
    HEADER_PROP VARCHAR2 (4 BYTE),
    SUB_STREET VARCHAR2 (100 BYTE),
    SUB_FEET VARCHAR2 (8 BYTE),
    SUB_DIR VARCHAR2 (4 BYTE),
    SUB_PROP VARCHAR2 (4 BYTE),
    PLAT_MAP_NUMBER VARCHAR2 (4 BYTE),
    USER DEFAULT CREATED_BY VARCHAR2 (50 BYTES)
    CREATED_DATE DATE DEFAULT SYSDATE,
    MODIFIED_BY VARCHAR2 (50 BYTE),
    MODIFIED_DATE DATE,
    DATE OF GEO_MOD_DATE,
    NOTE VARCHAR2 (40 BYTE),
    MDSYS GDO_GEOMETRY. SDO_GEOMETRY
    )

    I read that FORWARD updated TO does not work with data as CLOB types

    Yes. But what does this mean for the SDO_GEOMETRY objects is that you cannot directly use a WHEN clause in the definition of the trigger and you cannot compare two geometries directly via If (: old.geom =: new.geom) then.

    So, in your trigger update of your business rules conditions require the trigger to implement are not enough.

    Try to check if the geometry column has actually changed.

    DROP TABLE oper_zone_valve;
    
    CREATE TABLE oper_zone_valve
    (
      mslink            NUMBER (38),
      valve_number      VARCHAR2 (8 BYTE),
      ecm_number        VARCHAR2 (8 BYTE),
      valve_size        VARCHAR2 (4 BYTE),
      connection_type   VARCHAR2 (100 BYTE),
      header_street     VARCHAR2 (100 BYTE),
      header_feet       VARCHAR2 (8 BYTE),
      header_dir        VARCHAR2 (4 BYTE),
      header_prop       VARCHAR2 (4 BYTE),
      sub_street        VARCHAR2 (100 BYTE),
      sub_feet          VARCHAR2 (8 BYTE),
      sub_dir           VARCHAR2 (4 BYTE),
      sub_prop          VARCHAR2 (4 BYTE),
      plat_map_number   VARCHAR2 (4 BYTE),
      created_by        VARCHAR2 (50 BYTE) DEFAULT USER,
      created_date      DATE DEFAULT SYSDATE,
      modified_by       VARCHAR2 (50 BYTE),
      modified_date     DATE,
      geo_mod_date      DATE,
      remark            VARCHAR2 (40 BYTE),
      gdo_geometry      MDSYS.sdo_geometry
    );
    
    CREATE OR REPLACE TRIGGER air_valve_geo_bu_t
      BEFORE UPDATE OF gdo_geometry
      ON oper_zone_valve
      REFERENCING NEW AS new OLD AS old
      FOR EACH ROW
    BEGIN
       IF ( NOT UPDATING('GDO_GEOMETRY') ) THEN
        RETURN;
      END IF;
      IF ( :old.gdo_geometry is not null and :new.gdo_geometry IS not NULL ) THEN
        -- Check if geometry has changed internally
         IF ( sdo_geom.relate(:old.gdo_geometry,'DETERMINE',:new.gdo_geometry,0.005) != 'EQUAL' ) Then
           :new.geo_mod_date := SYSDATE;
         End If;
      ELSIF ( ( :old.gdo_geometry is null and :new.gdo_geometry IS NOT NULL ) OR
           ( :old.gdo_geometry is not null and :new.gdo_geometry IS NULL ) ) THEN
         :new.geo_mod_date := SYSDATE;
      ELSE
        :new.geo_mod_date := NULL;
      END IF;
    END;
    /
    SHOW ERRORS
    

    Some tests

    SET NULL NULL
    INSERT INTO oper_zone_valve ( remark, gdo_geometry) VALUES ('remark', MDSYS.sdo_geometry(2001,NULL,SDO_POINT_TYPE(0,0,0), NULL,NULL)); COMMIT;
    1 rows inserted.
    commited.
    SELECT remark,  to_char(geo_mod_date,'YYYY-MM-DD HH24:MI:SS') as geo_mod_date, gdo_geometry FROM oper_zone_valve;
    REMARK GEO_MOD_DATE        GDO_GEOMETRY
    ------ ------------------- -------------------------------------------------------
    remark NULL                SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(0,0,0),NULL,NULL)
    
    update oper_zone_valve set gdo_geometry = sdo_geometry(2001, NULL,SDO_POINT_TYPE( 0,0,0),NULL,NULL) where remark = 'remark'; COMMIT;
    1 rows updated.
    commited.
    SELECT remark,  to_char(geo_mod_date,'YYYY-MM-DD HH24:MI:SS') as geo_mod_date, gdo_geometry FROM oper_zone_valve;
    REMARK GEO_MOD_DATE        GDO_GEOMETRY
    ------ ------------------- -------------------------------------------------------
    remark NULL                SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(0,0,0),NULL,NULL)
    
    update oper_zone_valve set gdo_geometry = sdo_geometry(2001, NULL,SDO_POINT_TYPE(10,0,0),NULL,NULL) where remark = 'remark'; COMMIT;
    1 rows updated.
    commited.
    SELECT remark,  to_char(geo_mod_date,'YYYY-MM-DD HH24:MI:SS') as geo_mod_date, gdo_geometry FROM oper_zone_valve;
    REMARK GEO_MOD_DATE        GDO_GEOMETRY
    ------ ------------------- --------------------------------------------------------
    remark 2012-10-16 09:24:53 SDO_GEOMETRY(2001,NULL,SDO_POINT_TYPE(10,0,0),NULL,NULL)
    
    execute dbms_lock.sleep(5);
    anonymous block completed
    update oper_zone_valve set gdo_geometry = NULL  where remark = 'remark'; COMMIT;
    1 rows updated.
    commited.
    SELECT remark,  to_char(geo_mod_date,'YYYY-MM-DD HH24:MI:SS') as geo_mod_date, gdo_geometry FROM oper_zone_valve;
    REMARK GEO_MOD_DATE        GDO_GEOMETRY
    ------ ------------------- --------------------------------------------------------
    remark 2012-10-16 09:24:58 NULL
    

    This seems to be the answer you are looking for or puts you on a path to achieve the correct execution of your business rules in the trigger.

    Shows please!

    concerning
    Simon

    Published by: Simon Greener on 17 October 2012 15:39, fixed a display issue does not

  • need help with xml data

    Hi all

    need your spiritual help once more!
    I have a table 'product' as below:

    create table product)
    product_id number (2),
    product_info varchar (4000));

    Select * from product:
    product_id product_info
    1 < ticketing > < product = 'TV' > < productservice = "shipping" > < / productservice > < / product = 'TV' > < / ticket >

    I need to get the column product_info information in a new table with 2 columns product and productservice product_details. as in: -.
    Select * from product_details:
    product_id product productservice
    1 expedition TV

    any suggestions on how to do it.
    PS-> for a product it can be several services and there may be several products for a ticket.

    Your XML file is not well formed at all (so many errors in there).

    However, if you had a valid XML code, you could do something like that...

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as product_id, '' as product_info from dual union all
      2             select 2, '' from dual)
      3  --
      4  -- end of test data
      5  --
      6  select t.product_id, x.*
      7  from t
      8      ,xmltable('/ticketing/product'
      9                passing xmltype(t.product_info)
     10                columns product varchar2(10) path '/product/@name'
     11                       ,service varchar2(15) path '/product/productservice/@name'
     12*              ) x
    SQL> /
    
    PRODUCT_ID PRODUCT    SERVICE
    ---------- ---------- ---------------
             1 TV         shipping
             2 VCR        delivered
    
  • Comparing converted text until then with the Date column

    I have a question where I need out of a text column in a date format and then compare this column against another column in the same table, which is already to date format. I tried to use a sub query to avoid doing this in two steps, but get a:

    "ORA-01858' a non-digit character was found here where was waiting for digital"

    error message that obviously has something to do with the date formatting in the subquery: the types do not match.

    Note: clock_num is a text column and contains the numbers are supposed to be dates like 070111 - where the need for conversion to a date type to match the stat_date which is the type of date column. I have no control over the data in this column. It is not my picture, is the picture of the society and I have to use!

    So my question is what syntax/function should I use to get the type of expression clock_nbr the type of eff_date.

    Or y at - it another way to do the same thing without using subquery?

    Any help is appreciated...

    SELECT
    me. SSN,
    Of
    member_enroll me
    WHERE me.ssn = '999999999'
    AND me.stat_date <
    (SELECT to_date (substr (me.clock_num, 1, 2) |)) » /' || substr (me.clock_num, 3, 2) | '/' || substr(me.clock_num,5,2), 'mm-DD-yy') as clock_nbr
    OF member_enroll me
    WHERE me.ssn = '999999999')

    I have no experience with PL/SQL Developer. Any chance you could launch SQL * more and copy / paste of a session where you run this code?

    You should only run the DDL to create the function once. If the second query runs, you have managed to successfully create the function. My hypothesis is that whatever 'window SQL' you are talking about and what you mean by 'run' is the cause only the function must be created. Most of the IDEs have a function to execute current SQL statement, without taking into account other statements that can be registered in the same window, and a separate function to execute all instructions in the current window. Different iDEs have different requirements to separate several SQL statements if you want to run all of the SQL statements in a window. You may need to do something like the added statement a / after the CREATE FUNCTION as a separator.

    Justin

  • APEX_UTIL. IR_FILTER with BETWEEN operator for date columns

    Hello

    When I run my application, I can put a filter BETWEEN date columns. I can't find a way to use it with the APEX_UTIL. Function IR_FILTER. Maybe I missed something?
    Documentation: http://download.oracle.com/docs/cd/E17556_01/doc/apirefs.40/e15519/apex_util.htm#CHDDDFBF

    Tobias

    Tobias,

    If you think about it, "between the" is nothing else than a way of the single line to say

    WHERE: X > =: Y
    AND: X<=>

    Then you should be able to apply two filters of the report using the operators LTE and GTE

    Hope this helps

    Doug Gault
    www.sumneva.com

Maybe you are looking for

  • can I switch my URGE 4 sleekbook RAM

    my laptop model is HP ENVY 4 1212TU sleekbook [ http://support.hp.com/us-en/document/c03619719] which comes with 4 GB of RAM. can I upgrade the RAM to 8 GB?

  • Conversion of a driver to labview labwindows

    http://sine.NI.com/apps/UTF8/niid_web_display.download_page?p_id_guid=E3B19B3E9628659CE034080020E748... I try to convert the driver on the link above for labview labwindows (8.5) and I'm doing it via the tools--> instrumentation---> interface VI crea

  • error of hard disk failure, disk hard test result 0301, whatever that means?

    HP Envy 17 17-1190 ca,.Windows 7 64 bitFailure of HARD drive in windows error.Error reads:Windows detected a hard disk problemBack up files etc...-> Start the backup process -> Ask laterWhich drive is a failure The following hard disks are fault cond

  • New bundles "for sale" adding product

    I have submitted, approved and distribution on Blackberry App World application. Now, I want to add the build for a few more devices. Its the same application built for different screen size. How should I proceed with presentation of the app? How lon

  • Types of VPN Session

    I look at my ASA logs for VPN (ASA-4-113019% messages) connections. Some of the connections show a type of session of "IKE" and other "IPSecOverNatT". Why would it be? My users are using an IPSec client to connect. Thank you.