Need to validate the timestamp in sql

Hi,
I need to check whether the date column is having timestamp or not. Please give me the query to validate it.
Eg
row1 readtime
1 1/28/2012 4:00:00 PM
2 1/16/2012
I need to vaidate and find the record which is not having the timestamp. Please help me in finding the query for this.
If i use the to_char the value for the date which is not having the time is shown like this '16/01/2012 12:00:00 AM'.
So kindly help me in finding the query for this.
Thanks,
Suresh P

907893 wrote:
Hi,
I need to check whether the date column is having timestamp or not. Please give me the query to validate it.
Eg
row1 readtime
1 1/28/2012 4:00:00 PM
2 1/16/2012
I need to vaidate and find the record which is not having the timestamp. Please help me in finding the query for this.
If i use the to_char the value for the date which is not having the time is shown like this '16/01/2012 12:00:00 AM'.
So kindly help me in finding the query for this.Predicting you are storing the data in a Varchar column, below suggestion should help:
with data as
  select '26-Sep-2012 11:30:00' col from dual union all
  select '26-Sep-2012 11:30:00 AM' col from dual union all
  select '26-01-2012 11:30:00' col from dual union all
  select '26-SEPTEMBER-12 11:30:00' col from dual union all
  select '26-Sep-2012' col from dual
select *
  from data
where not regexp_like(col, '[[:digit:]]{1,2}-([[:alpha:]]{1,9}|[[:digit:]]{1,2})-([[:digit:]]{2}|[[:digit:]]{4}) [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}');If you are using a Date or Timestamp column, it will always have a Time Component stored and you would not be required to perform additional checks.
See below:
drop table test_table;
create table test_table
  col       timestamp
insert into test_table values (to_timestamp('26-Sep-2012 11:30:00', 'DD-Mon-YYYY HH24:MI:SS'));
insert into test_table values (to_timestamp('26-Sep-2012', 'DD-Mon-YYYY'));
select *
  from test_table;
COL                      
26-SEP-12 11.30.00.000000000 AM
26-SEP-12 12.00.00.000000000 AMEdited by: Purvesh K on Sep 26, 2012 11:47 AM

Similar Messages

  • What will be the peoplesoft query to calculate voluntary termination count and involuntary termination count? I am working on OBIA HR analytics workforce deployment reports and need to validate the reports

    what will be the peoplesoft query to calculate voluntary termination count and involuntary termination count? I am working on OBIA HR analytics workforce deployment reports and need to validate the reports. I also want to know the tables involved

    Hi Andrew,
    Part A:
    I've done some restating of the question, and distributed the calculations among several fields, not all of which need to be included on the visible layout. Other than formatting the Date fields and moving the 'Completed Date' field and its label, I've left this in the default "Layout 1" produced by AppleWorks.
    Field List:
    Priority: Popup menu with six items: 00, J, D, 1, 2, 3  Defaults to 00
    TL (time limit in months): Calculation:  CHOOSE('Priority',0,1,3,4,6,12)
    Received: Date. Option: Automatically insert today's date (ie. Date Record created) (may be edited)
    Target Date: Calculation:
    DATE(YEAR('Received')+INT(MONTH('Received')+'TL')/12,MOD(MONTH('Received')+'TL', 12),DAY('Received'))
    Remaining (Days): Calculation: INT('Target Date'+1-NOW())  (see revision below)
    Completed: Checkbox. Set default value to Unchecked.
    Completed Date: Date: Entered manually
    OnTarget: Calculation: IF('Completed',IF('Completed Date'<'Target Date',"On Target","Over"),IF(INT(NOW())>'Target Date',"Over","On Target"))
    The On Target field shows the current status of the case while still open, and the state on the closing date when it was closed.
    Having done that, I was unhappy with the Remaining field continuing to calculate an ever larger negative number after the case had been closed. Hence this revision below:
    Remaining: Calculation: IF('Completed','Target Date'-'Completed Date',INT('Target Date'+1-NOW()))
    Shows the number of days remaining while the case is open, the days remaining at completion if the case has been marked Completed and the completion date entered.
    Rsults (and some further formatting of the Layout) below.
    Part B:
    You will need Subsummary parts when sorted on Completed and on On Target. Fields can appear on  a Layout only once, so each subsummary part will need a separate Summary type field for each field to be summarized.
    Regards,
    Barry

  • Pl help,i need to validate the data in UI with my database-mysql

    Hello All,
    pl help.
    i'm a newbie with jdbc and mysql
    i'll tell my requirment -i need to check whether the email id in the UI matches with the email id in the db,if the email id exists,i need to find its eid(eid is t priamary key,auto_increment),i've set my email id to be unique key...
    so if the email id matches with the email id in the db,i should get the eid,other wise ,need to insert the email id in the user_table...pl help me with the code.i'm working using exadel and java...need t code 2 do this in java
    pl..pl

    The user comes to the UI and enters the email address and he hits on submit button .... (if i am right)
    it is a simple task of passing the value from jsp to action class and do those operation.
    Can u provide the code that u have wriiten... so that i can help u !!!!

  • I need to covert the following MS SQL query to Oracle.

    The query is as follows..
    SELECT B.AL_DESCRIPTION,Count(C.TC_STATUS)
    FROM ALL_LISTS A, ALL_LISTS B, TESTCYCL C
    Where B.AL_FATHER_ID = A.AL_ITEM_ID
    And C.TC_STATUS = B.AL_DESCRIPTION
    And A.AL_DESCRIPTION = 'Status'
    And (C.TC_EXEC_DATE = @ExecutionDate@
    Or C.TC_STATUS = 'No Run')
    Group By B.AL_DESCRIPTION
    Union
    SELECT B.AL_DESCRIPTION,0
    FROM ALL_LISTS A, ALL_LISTS B
    Where B.AL_FATHER_ID = A.AL_ITEM_ID
    And A.AL_DESCRIPTION = 'Status'
    And Not Exists (Select 1 From TESTCYCL C Where C.TC_STATUS = B.AL_DESCRIPTION)
    Order By 1

    Is
    What does this below mean in MySql
    And (C.TC_EXEC_DATE = @ExecutionDate@Is ExecutionDate a variable name?
    Then replace it by..
    And (C.TC_EXEC_DATE = TO_DATE(ExecutionDate,'DD-MON-YYYY')If ExecutionDate is not a date datatype
    I guess you are trying to compare the value of TC_EXEC_DATE with some variable value.
    If you are using bind variable then you can substitute as
    And (C.TC_EXEC_DATE = TO_DATE(&ExecutionDate,'DD-MON-YYYY')check this,
    Here I am taking value at run time.
    SQL> select  empno,ename,hiredate
      2  from emp
      3   where hiredate > &dt;
    Enter value for dt: '22-MAY-1981'
    old   3:  where hiredate > &dt
    new   3:  where hiredate > '22-MAY-1981'
         EMPNO ENAME      HIREDATE
          7654 MARTIN     28-SEP-81
          7782 CLARK      09-JUN-81
          7788 SCOTT      19-APR-87
          7839 KING       17-NOV-81
          7844 TURNER     08-SEP-81
          7876 ADAMS      23-MAY-87
          7900 JAMES      03-DEC-81
          7902 FORD       03-DEC-81
          7934 MILLER     23-JAN-82
    9 rows selected.
    Using a variable
    SQL> declare
      2  eno number;
      3  name varchar2(50);
      4  edate date;
      5  dt date :='23-JAN-1982';
      6  begin
      7  select empno,ename,hiredate into eno,name,edate
      8  from emp where hiredate = dt;
      9  dbms_output.put_line(Eno||' '||name||' '||edate);
    10  end;
    11  /
    7934 MILLER 23-JAN-82
    PL/SQL procedure successfully completed.Twinkle

  • Need an API to Validate the Segment Values of an GL Code Combination

    Hi,
    I have a requuirement wherein i need to validate the semgent values of an GL Code Combination. I want to know is there any API to Validate the Segment Values. The API should be able to validate the segment values for existence in value set, enabled/disabled, Posting flag enabled or disabled (i.e Compiled Attributes Validation).Please provide me some pointers.
    Thanks & Regards,
    Siva

    look at FND_FLEX_EXT or FND_FLEX_KEYVAL
    FND_FLEX_KEYVAL.validate_segs

  • Validate the file from app. server before uploading

    Hi All,
    I am trying to upload the data from application server into an internal table.
    My requirement is I need to validate the data before I upload the data into internal table.(i.e I open the file from application server using FM Open_Dataset.Now before I upload the data into an internal table,I need to first validate each record in the file).I have some 7-8 lakhs of records in the file.
    Any input for the above requirement would be of great help
    Regards,
    nsp.

    hi Nsp,
      I guess validation of data will be only possible after uploading the data in to an internal table ...
    Regards,
    Santosh

  • Storing the Timestamp field in the Table

    Hi
    I have a Z program and we need to store the timestamp field in the Z table . I have created the table with the dataelement
    TIMESTAMP . Is there any system field that can be used to store the timestamp field from your program
    say for example we have declared a work area of the structure of the Z table and Appended through the Internal Table and Modified that Z table.
    My intention is store the Timestamp field in the Z table.
    Nadesh

    Hi,
        you can add as below..
    types : begin of st_output.
                             include structure ztaxinvoice.
                             FKIMG1 TYPE VBRP-FKIMG,
                             FKIMG2 TYPE VBRP-FKIMG,
                             types : end of st_output.
        or you can add this field to your structure 'ztaxinvoice'  as below
    'FKIMG1 TYPE FKIMG'
                                       'FKIMG2 TYPE FKIMG'
       Then you can declare internal table and work area as mentioned below..
    data: it_output type standard table of ztaxinvoice,
                            wa_output type ztaxinvoice.
    here in this case no need of types declaration also you can pass the same type (wa_output type ztaxinvoice) in smartform.
    hope this will help you,
    Regards,
    Renuka S.

  • Validate the XML tag value and display the Binding data in XDP

    Hi,
    I am new to Adobe Life Cycle.... and i am working on the following requirement and XML file is enclosed...
    1. Need to validate the XML value of <pp> with condition
    2. Basing on the value of <pp>, need to display the <ct> values in text field
    If i simply bind, it takes the values from top of array and display..
    Please suggest how to restrict the binding values basing on the condition.
    Thanks
    Madhu

    Hi Paul,
    Thank you for quick respose.
    The solution which you have give me not excatly looking for.... working for the solution in alternative methods...
    Regards
    madhu

  • How to validate the date in my class

    Hi
    In my project with jsp and struts I need to validate the date field.
    So in the action class I want to validate the date that is the date is in dd/mm/year format?
    can anybody please give some idea to do this?
    Thank you so much.

    Here is a method that validates day/month/year using the Calendar class.
         public boolean validateDate(int day, int month, int year) {
              try {
                   Calendar cal = Calendar.getInstance();
                   cal.clear();
                   cal.setLenient(false);
                   cal.set(year, month-1, day);
                   // need to call getTime() to make the calendar compute/validate the date
                   cal.getTime();
                   return true;
              catch (IllegalArgumentException e) {               
                   return false;
         }

  • Application Tuning to find the most expensive sqls

    I have a schema in oracel 9i Release 2 and I want to do a performance testing from application side. Application is developed in Java . There are many queries in java side and some stored procedures are called while running the application.
    So I need to find the most expensive sqls by running the application and tracing the top sqls
    If I set trace enable at database level the trace files will be generated for all the connected sessions right? I want the trace file for only one schema. If I enable trace for a session I will not be able to trap the sqls since the application runs from another session . connection pooling also is used. suggest some good approaches to capture the most expensive sqls?

    Does the answers in your application tuning not suitable for you ?
    Nicolas.

  • User exit name to validate the Trasactiopn type at t.code ABAON

    Hi,
    we need to validate the Posting date  and Transaction type at transaction code  ABAON (Enter Asset transactions).
    Please help me which user exit can we use to validate this?
    For T.code ABAON i checked the  packeage name as 'AA'
    based on the package, we found the  below User exit names. Which can i use out of the below.
    AAPM0001  Integration of asset accounting and plant maintenance
    AFAR0003  External changeover method
    AFAR0004  Determination of proportional values for retirement
    AINT0004  Change amount posted for certain areas
    AINT0005  Dummy for extended syntax check. Do not use.
    AISA0001  Assign Inventory Number
    AIST0001  Exchange number range in master data maintenance
    AIST0002  Customer fields in asset master
    AMSP0002  Determine relationship type for two company codes
    TRAN0001  User exit for asset transfer
    Please help us .
    Thanks in advance,
    Satya.

    Hi Satyanarayana,
    Why dont you try with Validations & Substitutions using GGB0.
    For more information on Validation & Sustitutions follow below link:
    Re: substitutions & validations
    Regards
    Abhii

  • How to validate the data in the table

    Hi Experts,
    My question is
    I am having a table control on my view. I need to validate the data entered by the user on the table
    and after validation i need to save the data into database table.
    Now my question is only related to Data Validation on table UI element.
    If the user enters 3 rows and if the 2nd and 3rd row are already existing,
    It should throw the message Entry already exists and the pointer should
    be at Row number 2 in this case.
    Similarly in the 2nd row i have a date field and if the user enters some character
    then it should throw an error message that Numeric values are only allowed and
    the pointer is placed in the 2nd row Date column so that it allows user to modify
    the wrong entry.
    Please advise.
    Regards,
    Chitrasen

    Hi,
    for validating user input in table , you have to get the entries inserted by user into an internal table using get_static_attribute_table and futher have your check using loop endloop.
    For date field, make the context attribute binded to date column as DATS. This would make sure the user inputs a valid date without your custom code.

  • FF67 - How can I validate the transaction FF67?

    Hello,
    I have the following problem. I need to validate the data entered on the first screen of the transaction FF67. The standard validation does not work. I need to check the dependencies between the dates on the first screen.
    The customer exit F40K0001 only allows to check the position entering on the next screen.
    Is there a customer exit for the first screen of the transaction FF67?
    Regards.

    Hi,
    There is no other user exit for FF67.
    However an alternative can be to define a custom selection screen and do checks whatever you want in it. Then pass the selections from this to the selection screen of FF67.
    Your ABAPer should be able to help you to develop this.
    Regards,
    Gaurav

  • Validate the input file against a given schema inside an orchestration and producing 2 different files based on the validation result

    HI All,
    I have a situation.
    I need to validate the input file against a given schema inside an orchestration and producing 2 different files based on the validation result.
    A predefined success schema in case of  validation success and negative schema structure for validation failure.
    any advice ?

    Hi Rachit,I following the blog
    http://dietergobeyn.be/validating-biztalk-messages-orchestration/ and stuck in few things
    I created a helper class with the name Validation and following code
    [Serializable]
        public class Validation
            private bool _isValid = true;
            public bool Validate(XmlDocument document, Type schema)
                XmlSchemaSet set = new XmlSchemaSet();
                if (typeof(SchemaBase).IsAssignableFrom(schema) && !schema.IsNested)
                    set.Add((Activator.CreateInstance(schema) as SchemaBase).Schema);
                ValidationEventHandler eventHandler = new ValidationEventHandler(HandleValidationError);
                document.Schemas = set;
                document.Validate(eventHandler);
                return _isValid;
            private void HandleValidationError(object sender, ValidationEventArgs ve)
                _isValid = false;
    public static bool ValidateMessage(XLANGMessage msg)
    XmlDocument xDoc = new XmlDocument();
    xDoc = (System.Xml.XmlDocument)msg[0].RetrieveAs(xDoc.GetType());
    Type t = typeof(Schemas.External.Invoice_v3_1);
    Validation validation = new Validation();
    return validation.Validate(xDoc, t);
    First thing, Do i need to write the ValidateMessage method inside the helper class or not ??
    If inside, how to add the reference of schema files in the statement (Type t = typeof(Schemas.External.Invoice_v3_1);)
     I tried adding the reference of my schema project but it is showing error.
    And what is to be written in the ValidateMessage expression shape in Orchestration ?
    Really appreciate your help.

  • Need To Create a table in Sql Server and do some culculation into the table from Oracle and Sql

    Hello All,
    I'm moving a data from Oracle to Sql Server with ETL (80 tables with data) and i want to track the number of records that i moving on the daily basis , so i need to create a table in SQL Server, wilth 4 columns , Table name, OracleRowsCount, SqlRowCount,
    and Diff(OracleRowsCount - SqlRowCount) that will tell me the each table how many rows i have in Oracle, how many rows i have in SQL after ETL load, and different between them, something like that:
    Table Name  OracleRowsCount   SqlRowCount  Diff
    Customer                150                 150            
    0
    Sales                      2000                1998          
    2
    Devisions                 5                       5             
    0
    (I can add alot of SQL Tasks and variables per each table but it not seems logicly to do that, i tryid to find a way to deal with that in vb but i didn't find)
    What the simplest way to do it ?
    Thank you
    Best Regards
    Daniel

    Hi Daniel,
    According to your description, what you want is an indicator to show whether all the rows are inserted to the destination table. To achieve your goal, you can add a Row Count Transformation following the OLE DB Destination, and redirect bad rows to the Row
    Count Transformation. This way, we can get the count of the bad rows without redirecting these rows. Since the row count value is stored in a variable, we can create another string type variable to retrieve the row count value from the variable used by the
    Row Count Transformation, and then use a Send Mail Task to send the row count value in an email message body. You can also insert the row count value to the SQL Server table through Execute SQL Task. Then, you can check whether bad rows were generated in the
    package by querying this table.  
    Regards,
    Mike Yin
    TechNet Community Support

Maybe you are looking for

  • Presentation Director automated scheme import

    Hi All, hope everyone is well. Does anyone know if its possible to somehow import Presentation Director schemes from the command line or if there is any other way to do it? I wanted to create a single scheme on one of my test machines, export it and

  • Unable to debug/correct the CMOD code for a variable used in a query

    unable to debug/correct the CMOD code for a variable used in a query i am using the data in a DSO in a query and using a custom coding variable in that query , but this data not coming in that query .. can anyone suggest how to debug that cmod code f

  • Updating a sequential file in Polling - DB adapter

    Hi, I am using DBAdapter to poll a table in the database and i have chosen 'Update a Sequencing File' option as the operation to be performed after the read. I was running the process on my local bpel server and was able to select a file on my system

  • Cross Domain Security Express - RAC configuration

    Hi All, Not sure if the general DB forum is the place for this but here goes. I am involved in designing a solution that wants to provide access to data from networks each trusted to a different level of security. The CDSE CDSS white paper look somet

  • Adobe Business Catalyst

    If I transfer my web hosting from yahoo will I lose any email addresses associated with that account?