Date Validation /Conversion as string to date

Hello Oracle experts

I'm trying to find the right date conversion/validation. The problem is that I get as string(dd-Mon-yy) format date in a text file. I need to load it into an Oracle table in the form of text, then post the text as a date is valid.

I can check the day and year. But how to check the month. If the date is * 1 April 11 * it's OK but if it is as * ODA / 01/11 * so how to check the string of months is one channel of 12 months. I mean from January to December.

If I use the conversion to this day, I get the error ORA-1843.

with t1 as
(
SELECT ' 01-CCA-11' stringdate FROM DUAL Union all the
SELECT 1 December 11 ' stringdate FROM DUAL Union all the
SELECT ' 01-Juk-11' stringdate FROM DUAL Union all the
SELECT 1st April 11 ' stringdate FROM DUAL
)

The first and 3 record is incorrect month.

Help, please.


I use
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options


Thank you

Rajesh

If you want to just check the month (and assuming that the month is English), you could do something like

SQL> ed
Wrote file afiedt.buf

  1  with x as (
  2  (SELECT '01-Apd-11' stringdate FROM DUAL union all
  3   SELECT '01-Dec-11' stringdate FROM DUAL union all
  4   SELECT '01-Juk-11' stringdate FROM DUAL union all
  5   SELECT '01-Apr-11' stringdate FROM DUAL ))
  6  select (case when regexp_instr(
  7                       x.stringdate,
  8                       '-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-'
) > 0
  9               then 'Valid'
 10               else 'Invalid'
 11           end) status,
 12         stringdate
 13*   from x
SQL> /

STATUS  STRINGDAT
------- ---------
Invalid 01-Apd-11
Valid   01-Dec-11
Invalid 01-Juk-11
Valid   01-Apr-11

Justin

Published by: Justin cave on July 30, 2011 19:32

Tags: Database

Similar Questions

  • inDesign SDK CS5.5 - deprecated conversion of string constant in "tank."

    Hello world

    I am just starting with the development of an inDesign plugin, and I can't get the examples provided as example by the SDK to build (DocWatch.sdk for example). Instead, I get multiple errors:

    Frowned upon the conversion of the string constant to ' *'

    Deprecated conversion of string constant in "tank."

    I also tried to follow the tutorial of 'WriteFishPrice' in the getting started document, but I get the same errors.

    I'm on Mac OSX10.6, from:

    XCode 4.0.2

    GCC 4.2

    base SDK: Mac OS X 10.6

    inDesign SDK CS5.5

    I think that the problem is due to the version of gcc. It seems that inDesign SDK is outdated.

    Someone at - he informed about the same problem and found a solution?

    -Bastien

    Hello

    You can try adding - Wno-writing-strings to CCG or put GCC 4.0

    Concerning

    Bartek

  • Conversion to String table

    Hi all...

    I'm doing a program to read data from the buffer of 2182A (nanovoltmeter) using VISA (SCPI Programming). Now, I can get the data in the buffer, but it is in the form of a string. Can you tell me how I can convert it to a (separate for each reading) table (screenshot of my test data is attached)...

    There is also a small scan only steps 10 and 11. Insofar, the scan may be more than 100 steps so please keep this in mind so...

    Found my solution... Post here for everyone perhaps it may be useful for someone

  • missing the conversion of string number of digits

    I have a quite unusual problem and cannot find any solution. The problem is the sequel.

    I get a multimeter string action, and it looks like this: '3.7260900E + 00. Then, I want to put this number on a waveform graph, and I need to convert them to numbers. Regardless of the VI to convert I use, everyone returns only the first digit in this case: '3 '.

    What should I do to get the complete number on the chart? I already tried to use more digits in the properties of the graph, but this has no effect.

    Thanks for help.

    Hello Marlon.

    You probably use a PC with the locale 'German', that is by using the comma as decimal separator. So, you should try this:

    The format code "%."; defines the point to be used as the decimal separator, however for your locale.

    This is the reason why I put all measurement systems using the English locale (atleast swap settings German point/comma).

    BTW. increasing the accuracy of the map does not change data related to it

  • Conversion of string in psobjects objects

    Hello everyone

    Can anyone help please?

    I have a small script that tries to read a text file and a list of "text strings" as output objects. I managed to get the relevant text strings, I want, but their output as objects seems to be the problem. If anyone can help that would be great. the script below

    $servers = (get-Content c:\servers.txt)

    {ForEach ($server in $servers)

    $Conn = (& racadm - u user_name password getsysinfo Pei $server r)

    $obj = New-Object psobject
    $obj | Add-Member Noteproperty-Hostname name-value (($conn | select-string "^ nom d'hôte" | foreach {$_.line}) - replace "hostname =" "")
    $obj | Add a member Noteproperty-SVCTag name-value (($conn | select-string "^ Service Tag" | foreach {$_.line}) - replace "Service Tag =" "")
    $obj | Add-Member Noteproperty-Date_Time name-value (($conn | select-string "^ RAC Date/heure" | foreach {$_.line}) - replace "RAC Date/Time =" "")

    Write-Host $obj

    }

    -The output I get is:

    @{Hostname = servername1; SVCTag = 532GY3J; {Date_Time = Thu Sep 20 09:51:56 2012}
    @{Hostname = servername2; SVCTag = 330GY2J; {Date_Time = Thu Sep 20 09:52:02 2012}
    @{Hostname = servername3; SVCTag = 230GY3J; {Date_Time = Thu Sep 20 09:52:10 2012}

    Thanks in advance

    Munster

    You may not use the Write-Host cmdlet. Change the line:

    Write-Host $obj

    in:

    $obj

  • Issue of conversion from string to DateTime to subtract the duration of 1 day in the XSLT file

    Hello

    I need to subtract the duration 1 day after the date of entry which is in the format "yyyy-mm - ddT00:00:00"(data type = String)
    I tried to use the available function: subtract-dayTimeDuration-from - dateTime () but this function expects the entry in the datetime data type and so on use of this I get Null as the result of the transformation.

    I used to convert the input string, dateTime() but it doesn't seem to work because I get the error "Invalid Xpath expression (null).

    Please help identify any other way I can convert the string to dateTime format and then subtract the duration. Or another way to subtract the length of the day 1 of the string itself.

    Thanks for the help!

    Hello

    It should work with the date in the format that you have... Look at the code, there may be a typing error... In addition, in BPEL, you must use the xp20 functions...

    Take a look at this...
    https://blogs.Oracle.com/Reynolds/entry/whats_the_time_mr_bpel

    I hope this helps...

    See you soon,.
    Vlad

  • Validation against a string in Apex

    I would like to find a way to validate this type of chain 3-3608016691. It should be only with 12 characters. It must be like that at the beginning of the chain: 3 - for example if the user insert 45667 he says is wrong. I tried with the name of validation: element 1 Expression contains only characters in the Expression 2 putting in the expression 2-1234567890, but it does not, because when I insert 23265 data is saved and it is wrong, it must follow this format: 3-3608016691. I wonder if is there a validation that contains the job LIKE? Perhaps with that validation would work. Thank you.

    Kind regards.

    I would like to know how I can validate that the user has always put 12 digits

    '12-digit' but '-3' not followed exactly 10 digits? An appropriate regexp is:

    ^3-[[:digit:]]{10}$
    

    Update your forum profile with a real handle instead of 'user13344939 '.

  • image file conversion to string base64encoding

    I tried conveting image base64 encoding stirng to send to the server... I am able to retrieve the file path with success using the file picker, but there are concerns the conversion of image to a string. I used base64outputstream n all that kind of stuff... But sometimes they work, sometimes they used... I want to have a snippet of code that performs my task... Some1 can help me?

    I suggest the developers who are coding of the image to resize the programitically image before encoding... This will allow to reach the time of 99 / 100 task coding ...

  • IMAQ JPEG image conversion problem string

    Hi, I'm using the format JPEG decode VI to decode an image string I get a camera at Black fins. It works fine when I run VI himself, but when I use it as a subvi the program crashes. Anyone have advice?

    This is a picture of my program

    It's the way the file is returned to the camera

    'I '. «#IMJxs0s1s2s3...» » Enter the JPEG compressed video image

    x = size of the frame in pixels:
    1 = 80 x 64, 3 = 160 x 120, 5 = 320 x 240, 7 = 640 x 480, 9 = 1280 x 1024

    s0s1s2s3 = size of the image in bytes (s0 * 256 ^ 0 + s1 * 256 ^ 1 + s2 * 256 ^ 2 + s3 * 256 ^ 3).
    ... = full frame JPEG

    Note that sometimes the 'I' command returns nothing if the robot camera is busy, then the 'I' command should be called as many times as necessary until a framework is returned

    I changed the format JPEG decode VI by changing the plans of red and blue color. I don't know if this caused the problem though.

    Hello

    This can be useful for you:

    http://forums.NI.com/NI/board/message?board.ID=200&message.ID=21845#M21845

    Andrey.

  • conversion binary string in a file

    I need help to decode a binary string. I get a binary string to a webserivce representing a .pdf file. I want to be able to view this file on my en somehow. I played with binardecode and what not but am having no luck. When I do a check to isbinary() on the channel it says that the file is not binary, but it is. (I coded the webservice file is sending me the same way and they are the same.) Anyone got any ideas?

    Normally, you do something like this:


    Then link to or display the PDF in the usual way.

  • Optimize the conversion of SGL data chain

    As the title indicates, I'm looking to pronounce on a more efficient way (as appropriate) to convert a string into an array of SGL.

    The detachment is just to get feedback on the best ways of doing things from a personal educational point of view. I don't actually have to improve performance... (Just keep improving my skills of codeing.)

    'More effective' here must take to be less cycles of CPU and low memory footprint, in that order. (That is, most small load on CPU is preferred, if smaller memory footprint is at the expense of the other cycles CPU, the hit on memory footprint is preferred).

    The length of the input string comes from a TCP read and contains only the raw bytes of the expected (in this case, SGL) format without any header/footer of meta-data.

    Currently, my implementation is very simple and given that the expected table size is known, I am relying on the loop being smart in his automatic indexation allowance.

    For the conversion, I do a right type-Gallery of 4 characters at once.

    The code below, the for loop is simply intended to give a 'real' output boolean if the string length is the length of expected as determined by the input string 'number of track points. No additional error handling is required or necessary.

    I suspect the "subset of string" combined with the iterations (for loop) are the two worst performance in this VI hits, but I can't think of a good way to do the conversion as a table, and if I could, then I should at least do a conversion in 'string to array U8' first.

    Thanks to all who took the time to read and watch. Your time and your contribution is appreciated as always!

    Q

    Hi Q,

    Why don't convert you directly in a table of SGL? No need of a loop FOR, nor for StringSubset...

  • * Exception text _ * __System.InvalidCastException: string Conversion 'You have an error in your SQL sy' to type 'Double' is not valid. -> System.FormatException: input string is not in the correct format.

    at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble (String Value, NumberFormatInfo NumberFormat)
    at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble (String Value, NumberFormatInfo NumberFormat)
    -End of the exception stack trace internal-
    at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble (String Value, NumberFormatInfo NumberFormat)
    at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble (String Value)
    at CPAX20.utilities.Dec (String strCode)
    at CPAX20. Form1.tmrOffer_Tick (Object sender, EventArgs e)
    to System.Windows.Forms.Timer.OnTick (ByVal e As EventArgs)
    at System.Windows.Forms.Timer.TimerNativeWindow.WndProc (Message & m)
    at System.Windows.Forms.NativeWindow.Callback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    Hi AnnBrod:

    Good news!
    I beat CPAX20.
    I found a solution and until now it works fine.

    Step 1.
    Perform the procedure on this site:

    http://support.Microsoft.com/default.aspx/KB/929135

    When you perform the sequence of boot, before defining the configuration of the computer to normal,
    go to this location on your computer:

    C:\Program Files\Fichiers Files\alg.exe
    (File is CPAX20.exe)
    It's your culprit.

    The boot he has stopped working; While it is not running, it may be deleted.
    Everyone please get rid of this pest as soon as you get this.

    Have a great day and be careful on the net; I still don't know how we are infected by it.

    See you soon,.
    Michelangelo
    (ITstudent)

  • IBRD read hexadecimal data

    using Bird reading data of the curve in SONY/TEK_370A test instrument, but the result is not correct.

    According to the Bird, the buffer is defined as type string, but the curve data are hexadecimal.

    CAN IBRD function hex reading using the buffer of type string.

    In the vbib - 32.bas module which is included in your GPIB project, calls all over I/O (ibrdi, ilrdi, ibwrti and ilwrti) are provided for users who need to perform arithmetic operations on data and want to avoid the overhead of conversion of strings required by the Bird and the ibwrt in the format of integer for arithmetic operations.

    ibrdi and ibwrti moved from the data in the form of an array of integers, instead of a string. Using these functions, you can access the data directly as integers instead of establish them as characters and then converting each pair of characters in a whole number. Internally, the ibwrti function sends each integer to the GPIB in the low, high-byte byte order. The ibrdi function reads a series of bytes of data in the GPIB and stores them in the array of integers in order of low, high-byte byte.

    Hope this information is useful.

    gpibtester

  • Receive octal data from InputStream - hexadecimal instead

    Hello

    I'm creating a Java SE 7 desktop application that should copy what makes an already implemented a PHP. To make sure that everything works as expected in the application Java, I've got this method:

    + public static void printValues (String string) {+
    System.out.println ("\nPRINTVALUES :");
    System.out.println ("length:"String.Length;) +
    for (int i = 0; i < string.length ();+) {+
    System.out.print ("x" ((int) string.charAt (i))); +.
    +}+
    System.out.Print("\n");
    System.Exit (-1);
    +}+

    which I use for debugging purposes. I have a similar method in PHP that does exactly the same thing, so I can use it as well for the outputs to compare and decide if all went well until methods are called. This method has been perfect since I started: I get the octal bytes in Java and PHP, and I can compare them. But there is a moment in the application where it sends data to a server and has in the process she responded. Using this method, I already checked that data sent in Java is exactly equal to one sent in PHP, but they may not receive the same response, and I can't even use the method above to make a comparison, because the Java application is printing the values hexadecimal ones rather octal. This is the method that I use to get the answer:

    private String readData() {}
    Buff of String = "", data;
    ubyte bytes [] = new byte [1024];
    InputStream input = null;

    try {}
    entry = this.socketChannel.socket () .getInputStream ();
    } catch (IOException ex) {}
    Exception handling unnecessary code
    }

    int howManyRead = - 1;
    try {}
    howManyRead = input.read (bytes);
    System.out.println (howManyRead);
    }
    } catch (IOException ex) {}
    Exception handling unnecessary code
    }

    Byte [] newBytes = new ubyte [howManyRead];
    System.arraycopy (bytes, 0, newBytes, 0, howManyRead);

    String ret = new String (newBytes));
    org. Main.printValues (ret);

    return ret; Currently unreachable stated, the output for the comparison is performed in the sentence above, which includes a call to System.exit(-1).

    Could someone help me please to retrieve data in the form of bytes actually octal if I get the data in the same format as in PHP (octal)?

    Thanks in advance.

    You receive a stream of bytes and you want to dispay their values. You expect to show that 0, 1, etc. up to 255. These bytes are not text. The conversion to string is useless and dangereous. Work with byte [] all the way. Converion of bytes to a string can lead to random, values that are represented by characters whose values exceed 255. This can also cause a loss of data if a received "character" is not mapped to a real character into your encoding platform.

    Published by: baftos on December 7, 2012 09:45

  • How to convert JAVA. SQL. Date the DATE in the format DD/MM/YYYY to DD/MM/YYYY

    I use an informix database that accepts the value of date as a DATE format...
    the other part of my app takes date from the field in the format DD/MM/YYYY... so I have to convert my java.sql.date in marker AAAA/MM/JJ JJ/MM/AAAA marker of the same type before inserting into db...
    but by using the parse method in SimpleDateFormat class can get the result format java.util.date...
    and also using method format may result in the conversion of strings...

    public class Dbop {
        static final java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat("dd/MM/yyyy");
        public static void main(String[] args) throws Exception {
            java.util.Date ud = fmt.parse("31/12/2010");
            java.sql.Date sd = new java.sql.Date(ud.getTime());
            String formattedSqlDate = fmt.format(sd);
            System.out.println("result:"+formattedSqlDate);
        }
    }
    

Maybe you are looking for

  • Confidence in the PSC - tc interval

    Hello We measure the temperature with thermocouples connected to a cFP-TC-125 module. I am interested in the accuracy of the measurement of this unit. Of course, I know the patterns in the manual, containing different measurement error curves for dif

  • HP Laserjet 2015... "Cannot find server".

  • Save &amp; reset

    Hi guys! I have a question. Let's say I want to do a reset or repair in factory system and I want to save my apps and my data through the backup and restore, will my apps AND restore the data on it? Because the previous time I did a reset on my Z and

  • trunk VSAN 6248 uplink interface

    Hi all I'm new to the UCS platform, I want to master multiple VSANs in FI 6248 on the single interface / portchannel. to 5548 upstream switch. Since the location of different heterogeneous storage 2. Ask let me know opportunities, configurations or a

  • Get the 0xc004f057 error code and that my copy of Windows is not genuine

    Hello Mr./Mrs, My real OS Window 7 Ultimate, after 12 months suddenly showed me (0xC004F057) notice that my copy is not genuine, and I have to validate, I tried but my desktop wallpaper went black, although the icons are always exposed. How can I fix