conversion of the date string
HelloI've recently become involved with databases, and I hit a little snag.
I have strings that represent a date, they are very oddly formatted and need to store them as dates. the format string looks like this:
"Monday, May 13, 2001"
How can I effectively convert DATE type?
I hope it's more simple I think.
Thanks in advance
/* Formatted on 2012/06/26 04:31 (Formatter Plus v4.8.8) */
SELECT TO_DATE (REGEXP_REPLACE ('SUNDAY,May the 13th of 2001', 'the|th|of',
''),
'DAY,MONTH DD RRRR'
)
FROM DUAL;
Tags: Database
Similar Questions
-
Channel of String conversion to the data channel
I have a problem I tried to accomplish through a. The URI of the file but can seem to make it work good for me. I have an original data channel are in TEXT format and the data in the channel are the phone number in the format 6667779999 or 4343. Can someone help me with a suggestion of script to convert this. Most of my ATTEMPTS end with a 66.67779e5. Can be simple but I can just figure it out.
Thank you J
Hello J,
A number such as 66.6778888e5 can be shown as 6667778888 in a DISPLAY box or table or text REPORT or a axis of REPORT graph by using the display correct format string - in this case "d". Where do you 6667778888 number appears like this in DIAdem, exactly? If you want to see in a BULLETIN Board, you will need to choose the option button 'Selected channels' first in the configuration dialog box, and only then will you be able to choose a format string to display such as "d" for this column.
Brad Turpin
Tiara Product Support Engineer
National Instruments
-
problem with implicit to the conversion of the date in oracle
Next date functions will work fine as long as string confirms for the next model of the date
D MY separator2 R separator1
the separator can be any sign of punctuation (/ $ % & *, ^) sapces, tabs...
as
Select ADD_MONTHS('21$MAY*2010',2) from DUAL;
SELECT MONTHS_BETWEEN (23 ^ FEB & 2010', ' 11% jan(2011') FROM DUAL;)
the two works perfectly, but it does not work in the ROUND functions (date) and TRUNC (date);
SELECT ROUND('12-FEB-2010') FROM DUAL; -gives error
It needs explicit conversion using TO_DATE();
My question is why what is happening?
Is it because we have two functions ROUND (NUMBER) and ROUND (DATE)?Hello
Welcome to the forum!
user650693 wrote:
Next date functions will work fine as long as string confirms for the next model of the dateAll of the built-in functions will work fine as long as use you them as directed; in particular, pass arguments that have the correct data type. If a function requires a DATE for an argument, always place a DATE, not a VARCHAR2 you hope will be be implicitly converted to DATE.
the separator can be any sign of punctuation (/ $ % & *, ^) sapces, tabs...
This applies to explicitly call the functions where a format string is used, for example, TO_DATE.
as
Select ADD_MONTHS('21$MAY*2010',2) from DUAL;SELECT MONTHS_BETWEEN ('23 ^ FEB & 2010', ' 11% jan(2011') FROM DUAL;)
the two works perfectly,
As the respondent previous said, the two work may , depends on several factors, such as your NLS parameters. It's a very bad habit to rely on such things. The 1st argument to ADD_MONTHS and two arguments to MONTHS_BETWEEN, are supposed to be DATEs, so always call these functions with the DATEs.
but this does not work in the ROUND functions (date) and TRUNC (date);
SELECT ROUND('12-FEB-2010') FROM DUAL; -gives errorIt needs explicit conversion using TO_DATE();
My question is why what is happening?
Is it because we have two functions ROUND (NUMBER) and ROUND (DATE)?No, it's because there is no ROUND function (VARCHAR2).
The use of strings which are expected of the DATEs is simply asking for trouble. Sometimes, you get what you're asking. -
Need help for the conversion of the Date
Hi all
Your expert input is much appreciated.
Have a problem where it is my master table structure, whenever there is an update/delete/insert on the main table
There's a trigger that insert an entry in the Audit table.
SQL > cpp_Master Desc;
Number of Ent_id
Date of Ent_date
SQL > Desc Cpp_Master_Audit
Number of Ent_id
Date of Ent_date,
Insert_type varchar2 (1)
The problem is that when we insert the Sub record in the table, the ent_date column appears in this way.
SQL > INSERT INTO CED.cpp_Master (ENT_ID, Ent_date)
VALUES (6030902, TO_DATE (1 JANUARY 01 00:00:00 ', ' HH24: PUT DD/MM/YYYY "));SQL > SELECT * FROM CED.cpp_Master;
6030902 01/01/0001
SQL > SELECT * FROM CDS. Cpp_Master_Audit;
6030902 01/01/0001
But when I update the date is coming up as below
SQL > update ced.cpp_Master set Ent_date = to_date (' 1 March 01', ' dd-mon-YYYY "") where ent_id = '6030902';
SQL > commit;Tried under updates so
(
Update ced.cpp_Master set Ent_date = ' March 1 01' where ent_id = '6030902';
Update ced.cpp_Master set Ent_date = to_char (' 1 March 01', ' dd-mon-YYYY "") where ent_id = '6030902';
)
Whenever the output below always. (Insert has no problem, just update a problem)
I wonder why when there is an insertion of the date value is "01/01/01" in (Cpp_Master_Audit), but when I update the date value is "01/01/2001" ".
I need the value to insert as "01/01/01", as all that was updated in Master table (Cpp_Master)
SQL > SELECT * FROM CED.cpp_Master;
6030902 01/01/2001
My request to trigger:
CREATE OR REPLACE TRIGGER CDS. CPP_AUDT
AFTER INSERT OR UPDATE OR DELETE
ON CED.cpp_Master REFERENCING OLD AS OLD AGAIN AS NEW
FOR EACH LINE
DECLARE
l_action_code VARCHAR2 (1);
BEGINIF THE INSERTION
THEN
l_action_code: = 'I ';
ELSIF UPDATE
THEN
l_action_code: = 'U ';
ON THE OTHER
l_action_code: = ';
END IF;IF (l_action_code = 'I'
OR l_action_code = '
OR (l_action_code = 'U'
AND (NVL (: OLD.)) ENT_ID, 0) NVL <>(: NEW.) ENT_ID, 0)
OR NVL (TO_CHAR (: OLD.)) Ent_date, ' mm/dd/yyyy'),
'X') <>
NVL (TO_CHAR (: NEW.)) Ent_date, ' mm/dd/yyyy'),
« X »)
)))
THEN
INSERT IN DEC. () Cpp_Master_Audit
ENT_ID, Ent_date, Insert_type
)
VALUES (DECODE (: OLD.ent_id, NULL,: NEW.ent_id,: OLD.ent_id),)
DECODE (l_action_code, 'I',: NEW.) Ent_date, 'd', NULL, 'U', DECODE (: NEW.) Ent_date,: OLD. Ent_date, NULL,: NEW. Ent_date)),
Insert_type l_action_code);END IF;
END;
/You wrote that ent_date is of type DATE
SQL > cpp_Master Desc;
Number of Ent_id
Date of Ent_date
so DO NOT fill with a chain, but with a date, and you have correct data in it.
This:
Update ced.cpp_Master set Ent_date = 1 March 01 ' where ent_id = '6030902';
is simply wrong that fill you your column DATE with a string and your NUMBER column with a string filter too.
Use
Update ced.cpp_Master
Set Ent_date = TO_DATE('01-MAR-0001','DD-MON-YYYY') where ent_id = 6030902;
and you will have no problems (as long as the NLS_DATE_LANGUAGE parameter is set correctly to support abbreviations English months)
HTH
-
Suspend the data string decoder
Does anyone know how the data in the suspension data maps?
Example: A00000000001000BY 7%
I know that the first character is the last visited slide.
Thanks, DaleI found my own answer. BTW on page 27 of the first character is a lowercase 'a', page 28 'b' what happens on page 53.
Captivate doesn't use lesson_location to take you to the page where you were last on.
Data just after the letter of the last page, is a string of Boolean variables, 0, the page has not been visited, 1 page. The first is the last page of the course. I am putting together this information on a website, I'll send it later.
A00001000BBB
On that last one - page, you were
00001 - the number of pages visited 1 = 0 = not visited
based on the above 5 pages in progress, only page 1 visted (the order is at the back of the order of the pages)Hope that help anyone.
-Dale -
Download data - problems with the conversion of the date
Hello
I have a picture that I downloaded from a database of oracle using SAS. It has a column with dates in the following format: 10/31/2012 11:00
When I download the data (via workshop SQL-> utilities-> data workshop-> load data) by categorizing my dates as varchar2, everything works fine... but fails when I choose my type in the Date column.
Please advice how to fix this
Thank youK I import my data with other tools. Looking at the workshop of data utility, no doubt you would put MM/DD/YYYY HH: mi: SS AM in the 'Format' field for this column.
-
Conversion of the data type of a table column
Hello
I have a column with the varchar2 data type. I want to convert to number data type. But the data in the table are not lost. Can someone suggest me how to convert the column with the varchar2 data type to store the data in the table of number data type.
Thanks in advancetry something like this
create table t(col varchar2(10)); insert into t values('1'); insert into t values('2'); commit; select * from t; alter table t add col1 number; update t set col1 = to_number(col); commit; alter table t drop column col; alter table t rename column col1 to col; select * from t;
Published by: Karthick_Arp on April 6, 2009 12:32 AM
-
Problem with the conversion of the date
Hello
I have a column called period_name which is of type varchar which contains data as jan-02 Feb-03 and 05-02, now my requirement is I want convert month names number say jan-02 to 01-02.
I tried to use to_char (to_date(period_name,'mm/yy'), 'mm - yy') which gives good results to the selection, but when I use the same creation then Sunrise error
[Error] Run (58:24): ORA-01858: a non-digit character was found here where was waiting for a digital
Query:
create the table dumm1 as
(
Select to_char (to_date(period_name,'mm/yy'), 'mm - yy') in the period_name of xx_alll
)
Concerning
Published by: 862807 on June 13, 2011 03:30862807 wrote:
Here when I write a select statement which I produced earlier works fine, but when I write the same create in her statement generates an error.
No it's not.
You're not extract all lines, you use Toad or some other GUI to confuse you. Enter the results data grid and type CTRL + end to fetch the last row. Or use sqlplus. The selection will fail too.
-
Help with the conversion of the date
Hello my table contains the sample_date of the column that contains values for the format: 12/09/2010 00:00:00.
I want to read the lines more than two years, so I used the following query:
"SELECT * FROM TEST_TABLE WHERE TO_CHAR(SAMPLE_DATE,'DD/MM/YYYY') < 6 February 2009;
However this will not get the required lines.
Can you please?
Thank you in advance.Use this
SELECT * FROM TEST_TABLE WHERE SAMPLE_DATE<>
Concerning
Arun -
Reliability of the data in the conversion to &; from a Variant...
It is possible to convert any data type to a variant, and then turn it back on. In doing so, are there data types who will lose information during the conversion process? If so, why?
Yes, you can convert any type to a variable ranging and back. There is a VI called "Variant data" which will have a type as input. He continued to convert the variant the correct data. The side variant must know what type of data to expect. He can pull of the Variant. However, you can use a cluster of generic data that consists of a username and a Variant. Then you can have different types of data which can handle the side reception. It is a two-step process. One of conversion the variant of general type (data type and Variant cluster). The second would be a case statement uses the type then covert the internal variant to the specified type. This approach is used for generic messaging systems. The upper levels of the code will know what to do with the data. The lower levels are just generic data passing around.
I'm not aware of any information that get lost during the conversion of the data to and from a variant. Of course, I not had no problem using them.
-
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
-
Play with the date format TO_CHAR
Hi all
I'm learning how function TO_CHAR date format and code using the table double, but I had a few difficulties:
How can I place an explicit function TO_CHAR date?SQL> select to_char(sysdate,'dl') test from dual; TEST ----------------------------- Monday, December 20, 2010 SQL> select to_char(sysdate) test from dual; TEST --------- 20-DEC-10 SQL> select sysdate test from dual; TEST --------- 20-DEC-10 SQL> select to_char('20-DEC-10','dl') test from dual; select to_char('20-DEC-10','dl') test from dual * ERROR at line 1: ORA-01722: invalid number
Best regards
ValerieValerie Debonair wrote:
Hi all
I'm learning how function TO_CHAR date format and code using the table double, but I had a few difficulties:SQL> select to_char('20-DEC-10','dl') test from dual; select to_char('20-DEC-10','dl') test from dual * ERROR at line 1: ORA-01722: invalid number
How can I place an explicit function TO_CHAR date?
Oracle converts implicitly your string to a date so that it can convert it to a string using your to_char function. Implicit conversion is based on your NLS_DATE_FORMAT settings, but you can never count on these implicit conversions.
You can be...
SQL> select to_char(to_date('20-DEC-10','DD-MON-RR'),'dl') from dual; TO_CHAR(TO_DATE('20-DEC-10' --------------------------- Monday 20 December 2010
or
SQL> select to_char(date '2010-12-20','dl') from dual; TO_CHAR(DATE'2010-12-20 ----------------------- Monday 20 December 2010
Note that this one used Oracle fixed-date internal format YYYY-MM-DD, so if ever you use this method, you must specify the date string in this format. It also only deals with dates, not the component "hour".
-
Hello world
Is there anything to get the date string that is actually a day late from the effective date of the PC. I am using format string minus 1 away from the day and time. But the problem occurs when the real is '1 '. My program will not be able to decide if the watch is "30,31,28 or 29.Etc.."
Please help me
Concerning
Ray.
-
TCP IP to receive and divide the data in real time
I'm using labview 11 and I have a computer send data via tcp ip. The data string is like this P 22 33 44 P 22 44 66 P 22 33 11 P and so on are numbers between P x y and z co - ord, I need labview to receive this and separate each x y and z as separate outputs
Two examples of analysis of some basic:
The upper part is by using a regular expression, which is a lot more forgving the lower part that uses parsing the string. The analysis of the chain will work only if there is a space between the elements. The regular expression will work will allow multiple spaces.
-
Can I use data string Web App (image) in a CSS hover function?
I'm developing a profile of employee of company "show and tell" using the Web application. I built my item in the list and details. Works very well. However, I have no hover function. So, I created a few css - one div id and added a background image then hover div with another image to hover. It worked. I moved the code of Dreamweaver in British Colombia - inside (the list template) Web application. I replaced the paths of the image with the data string Web App - image (e.g. {tag_employee photo}). Then I did the same thing to hover - I changed the image of the data string (e.g. {tag_employee photo2}). It does not work now.
All CSS is written inside the body, so it's not pulling to the outside path. I thought that a path from the outside may not understand the data string.
How can I get this to post a link with the chain of image data? Am I missing something?
How can I create an image using CSS switch and function WITH the BC Web App data strings hover?
Here's how I wrote the id of the DIV:
# {List_photo
height: 200px;
Width: 200px;
background-image: url("{tag_employee photo (200px)}" ");
position: relative;
margin-bottom: 10px;
Display: block;
}
# {List_photo:hover
height: 200px;
Width: 200px;
background-image: url("{tag_employee photo (hover)}" ");
position: relative;
margin-bottom: 10px;
Display: block;
}
Thank you!
Robert
Hi Robert,.
The concept of what you're doing works (as long as the)
Maybe you are looking for
-
MacBookPro wants to disconnect me
After 10 minutes of passivity, my MacBook Pro wants to close the session. How can I avoid this? I changed current sleep never to close the screen. Best regards, Björn
-
I find backgrounds colorful distracting with poor readability. You can simply choose ole B & W? How?
-
Replacement motherboard - DV9000. Tag #: DV9205US
I want to know if I can replace my old motherboard with the new motherboard 432945-001 432969-001? I am buying the spare part, but want to make sure that I can use the new motherboard in my laptop - DV9000. Any help would be useful before losing the
-
No audio device after re-installation of xp pro
I just reinstalled xp pro on an old pc Tower, everything works fine apart from no sound device?, I read a number of responses to this topic here, but none of the solutions seem to work: (, downloaded and installed the driver ac97 and Realtek codec, b
-
for some my windows is not activateed please some help me with this problem