String column with some formats from date to date
Hello!IM new in Oracle :)
I need to convert a string column {VARCHAR2 (70 bytes)} to this day. But this column have some type os dates... I found three types:
17/02/12 06:00:04, 403398 - 02:00
19 MARCH 12 06.00.07.936287 AM - 03:00
06:00:03:000 30/03/2012
How can I convert this column to date? I have hours, just need the date...
IM using Oracle 10 g.
Thank you very much!
EdStevens wrote:
Someone better than me can probably provide some ideas on exactly how to analyze the current value of VARCHAR_DATE
The fact is that any analysis fails for a date like 10/11/12.
You have only one chance if you know for sure that the order of the months of the year and the day is always the same. otherwise you can only guess.
If guess is good enough depends on the importance of the process of using it for the success of your business...
Good bye
DPT
Tags: Database
Similar Questions
-
Average of column with the format of date/time in the response of BI
Hello world
We working on the response of BI and training to get the average of the hours of work of departments. Work hours column is the Date in the database format, so we tried to converted to CHAR through the Cast function to modify columns in BI answers formula, and this gave us date "2007/09/01' as a result! We have also tried to throw the working hours for:
CAST (CHARACTER of WORK HOURS FORMAT AS 'yyyyMMdd-HHmmss')
NOTE: In working hours, we have null values...
work real hours to appear in the picture of the response is "01/07/2009-06:13.
How to get the column of working hours average on response BI?
Appreciate your help
Concerning
Published by: user817525 on July 21, 2009 23:15No, u do not attend the general tab. you need to go to the Data Type and click the button change. you will see a list of logical column. In your case, you will need to find the logical column when u used to store your WorkingHour and click on the button with three love (close your logical column). Now you have expression builder where you put formula: EXTRACTS ("Ain_Access" TIME. "" "" Fact_Access '. "" Hours of work)
I hope this helps?
all best
Phoenix
Belgrade -
List of all existing columns and then format and data format?
Hello gurus,
I'm new to OBIEE and I have an obligation to check the format of the column and the format of data for all of the existing column while generating an analysis report. Y at - it anyway I can enumerate all the columns that are exposed and there list column format and the format of data?
To check the column individual properties I know there is an option called 'Properties of the column' but want to know that all at once to go.
Kindly help me and thanks in advance.
Thank youI do not think that you have nothing in his answers to get this, go to the repository and utilities-> dictionary of metadata generate giving columns and the data type.
Assign points if it helps
~ Srix
-
Default value in the item with the format mask DATE: DD-MON-RRRR HH:MIPM
Dear all,
I created OF type date DATE and mask game format: DD-MON-RRRR HH:MIPM
and need to display the default code:
declare
v_start timestamp;
Start
BEGIN
Select FROM_DATE IN v_start of TOUR_MAS
where id =: P67_ID
EXCEPTION WHEN OTHERS THEN
v_start: = SYSDATE;
END;
RETURN v_start;
END;
But value display the DATE element is "11.02.00.000000 may 20, 15 h.
In the table FOLLOWING is the timestamp.
How to display the query result of default in the format ""HH:MIPM DD-MON-RRRR ". "
How can I do that.
Thank you
Hi Maxence,
Try this:
DECLARE V_START VARCHAR2(64); BEGIN BEGIN SELECT TO_CHAR(FROM_DATE,'DD-MON-RRRR HH:MI PM') INTO V_START FROM TOUR_MAS WHERE ID =:P67_ID; EXCEPTION WHEN OTHERS THEN V_START:=TO_CHAR(SYSDATE,'DD-MON-RRRR HH:MI PM'); END; RETURN V_START; END;
Kind regards
Kiran
-
Property of lines and columns with different forms of data
I have a form of planning data. I have a dimension of row and another in the column. The dimension of the column has the property of percent (%) and the column of the row has the property of Dollar value ($). How the value of the cell appear? What will be the property of cell?I'm glad you asked that :) I started to write articles a few days back, this is the first post of my blog, you can take a look, could help you. I actually needed a few more days to post some more before I make it public... but anyway... voila... !!
http://blogs.Oracle.com/HyperionPlanning/entry/evaluation_orderSee you soon... !!!
-
Concatenate columns with distinct values from oracle
Hello gurus,
My gaze of structure of table as follows:
TankListUS TankListCanada TankListIndia
---------- -------------- -------------
T111 | T222 T444 | T222 T555
Now when I run the query:
Select (TL. TankListUS | '||' || WLM TankListCanada | '||' || WLM TankListIndia) as "OverallSummary" of TankListTL
I get the output voltage
T111 | T222 | T444 | T222 | T555
But I do not need to duplicate tanks. I need my output like:
T111 | T222 | T444 | T555
Is this possible?
Hello
Try this
with t1 as (select ' T111 | ") T222 | T444 | T222 | T555' double collar).
T2 as (SELECT rownum, REGEXP_SUBSTR (col, ' [^ |] +', 1, RN) SPLIT)
from t1
cross join
(SELECT ROWNUM RN
FROM (SELECT (length (REGEXP_REPLACE (col, ' [^ |] +')) / 2) + 1 MAX_VALUE)
from t1)
connect by level<=>=>
T3 as (select distinct split as the t2 dis_col)
Select
RTrim (xmlagg (xmlelement (e, dis_col |))) '||')). extract ('/ / text()'), ' |') d_col
Of
T3;
Kind regards
Mohan.
-
How to use Photoshop with some Photos from Apple
How can I get Photoshop to be an external editor for the Apple Photos? I have CS5.1 and El Capitan.
Hi davidl,.
Photos App does not allow for any Publisher third interact with him directly (by design)
You need to export your images App Photos and then open them in Photoshop.
Refer to this article: How to use an external editor with Photos for OSX | IVous
Kind regards
Claes
-
How can I dynamically change the Format of Date of Application?
Hello world...
In my application (v 3.2) I let the user set the date format of app dynamically by a "preference" value, they can change on the road.
I then take the format they take and affect their value (ie: ME-DD-YYYY) and pad "Hh: mi" for it and use it as the PICK_DATE_FORMAT_MASK that works very well for most of the selectors of dates.
The problem I have is that some date picker, I use the application does not require the hh: mi, they need just the part of ME-DD-YYYY. I could use the NLS_DATE_FORMAT for this? I may be able to use the selectors of dates with the "format of date of application use? It doesn't seem to work for me.
In other words, I need essentially 2 date formats for my selectors of application dates; 1 for just the dates and 1 for dates, including time. And these 2 formats are selected by the user by setting a preference of app dynamically at run time.
Not sure if I feel here... any idea?
Thank you!
FrançoisYou must use the element of the application in the installation of your application, so when you select in your control, you would use the date format of application level. You can change the level application through code or control element.
Thank you
Tony Miller
Webster, TX -
Need to add a column with a default value
I need to add a column of type char (1) to a table and there should be a value default of'm '
I want to check first if this column already exists in this table.
If so, I still want to check if the default is am'
How can I do this?
I was able to all_tab_columns to query for the presence of column with the type of data and all, but not able to do the second part.
Thanks in advance.The DATA_DEFAULT field in dba_tab_columns stores information.
-
How publish data from the table with some data loss all post in the forum
I wonder how people are displayed the data in the table or the result of a query with losing them its format from Sqlplus display when they post in the forums of Oracle. I searched on the basis of knowledge of DB but I see no article about it. can you please help me or direct me to this link, I tried different options using code and other tags but nothing has worked, thank you for your help. Thank you.
Edited by: Ariean October 3, 2011 12:34You can click on the link to the FAQ at the top right: http://wikis.sun.com/display/Forums/Forums+FAQ.
-
column with the only format of loading time
My DB, 11 2 on OEL 5.5 GR
Hi all
I have a problem with the loading of the external table. I have a txt file with a format of columns HH24:MI:SS
And I don't know which data type use in external table because in the future, I'll have to do some calculations on this column, so I should load as a DATE, but miss me "mm/dd/yy" to the front. Any suggestion how to do properly?START_TIME 00:10:20 01:15:11 02:11:10
You could use a data type CHAR or date for the outer table and do your math with this column correctly.
The key is that convert a time string to a date data type will add the current date to it. For example:
SQL> alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss'; Session altered. SQL> select to_date('00:10:20', 'hh24:mi:ss') from dual; TO_DATE('00:10:20', ------------------- 01/02/2011 00:10:20
Some examples of code for both cases, by using the DATE and CHAR data type. I tested it on 11.2.0.1:
CREATE OR REPLACE DIRECTORY ext_tab_dir AS '/tmp'; -- /tmp/info.txt 1,00:10:20 2,01:15:11 3,02:11:10 alter session set nls_date_format='dd/mm/yyyy hh24:mi:ss';
(1) using the DATE data type
drop table tab_time_date; CREATE TABLE tab_time_date ( key VARCHAR2(5), start_time date) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir ACCESS PARAMETERS (FIELDS TERMINATED BY ',' (key char(5), start_time CHAR(8) DATE_FORMAT DATE MASK "HH24:MI:SS" ) ) LOCATION ('info.txt')); select * from tab_time_date; KEY START_TIME ----- ------------------- 1 01/02/2011 00:10:20 2 01/02/2011 01:15:11 3 01/02/2011 02:11:10
(2) using the CHAR data type
CREATE TABLE tab_time_char ( key VARCHAR2(5), start_time char(8)) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir ACCESS PARAMETERS (FIELDS TERMINATED BY ',' ) LOCATION ('info.txt')); select key, to_date(start_time, 'hh24:mi:ss') from tab_time_char; KEY TO_DATE(START_TIME, ----- ------------------- 1 01/02/2011 00:10:20 2 01/02/2011 01:15:11 3 01/02/2011 02:11:10
Kind regards.
-
Replace the string with the formatted text
Hello all - I'm back to my beloved project...
I want to replace a string by a TextSelction (formatted text) and began with the famous feature of Jang FindAndReplaceString.
Since my replacement comes from another document (sourceDoc), I edited to targetDoc activeDoc and introduced a second document (sourceDoc).
The replacePara actually comes from a stone where he had been placed to avoid switch backwards between the documents in a book (where to find and replace) and source documents. In another function, I learned that information on the table requires the sourceDoc must remain open.- Of course, everything works fine until I want to insert the replacelement:
erase line 26 is the string - Given that I do not insert a string, I skip lines 28 and 29 and try try line 30
- On line 30 DocumentSource is Document object and replacePare object TextSelection. However, sourceDoc.replacePara is not set and
- (as a result?) line 31 past the current contents of the Clipboard.
Of course, there is a fog around me... and I need some sunshine.
function FindAndReplacePara (targetDoc, findString, sourceDoc, replacePara, loopMax) { var tr = new TextRange(); var restoreTR, frame = 0, loopCounter = 0, replacementCounter = 0; var findParams = new PropVals(); var firstPgf = targetDoc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf; tr.beg.obj = tr.end.obj = firstPgf; // set up the starting text range as the very beginning tr.beg.offset = tr.end.offset = 0; // of the flow. We'll move straight from beginning to end. trSaved = tr // to come back after work findParams = AllocatePropVals(2); findParams[0].propIdent.num = Constants.FS_FindText; findParams[0].propVal.valType = Constants.FT_String; findParams[0].propVal.sval = findString; findParams[1].propIdent.num = Constants.FS_FindCustomizationFlags; findParams[1].propVal.valType = Constants.FT_Integer; findParams[1].propVal.ival = Constants.FF_FIND_CONSIDER_CASE; FA_errno = Constants.FE_Success; // errno global, to be used to track the progress of the find and replace tr = targetDoc.Find(tr.beg, findParams); // and do an initial find to get started. while(FA_errno === Constants.FE_Success && loopCounter++ < 2*loopMax) { //find and replace loop as long as we keep finding targetDoc.TextSelection = tr; // set up the text range to clear the original text targetDoc.Clear(0); // clear it // targetDoc.AddText(tr.beg, replacePara); // insert the new text at the original beginning of the text range // tr.beg.offset += replacePara.length; // lets jimmy the text range in memory to place it directly after targetDoc.TextSelection = sourceDoc.replacePara; // paste the whole replacement paragraph targetDoc.Paste (0); // <-- Current contents of clipboard is pasted !!!! if(FA_errno === Constants.FE_Success) { // increment our return counter replacementCounter++; } FA_errno = Constants.FE_Success; // ... find the next instance. We'll reset FA_errno again just in case tr = targetDoc.Find(tr.beg, findParams); // something screwy happened while we were replacing text. } targetDoc.ScrollToText(trSaved); // we're done. Restore the document to it's original area of display return replacementCounter; } // --- end FindAndReplacePara
Hi Klaus,
Thanks for the explanation. I remember something like that GetTabRange of the way back. You have been quite patient and persistent with this project, indeed.
So, as we are dealing with ranges of text here, I think that the only simple approach is to perform a copy and paste. There is no way to save a 'formatted' in a variable. The only super precise way would be to get a data structure of each text range TextItems in the sourceDoc, then meticulously recreate every element of the targetDoc. It would be very complicated, I think, so copy and paste seems the most logical. I wonder, though, if Miss me something, because I think that maybe you would have tried already so yes (?)
In any case, I would do something like that, from line 30 of your original code sample (code untested here):
App. ActiveDoc = sourceDoc;
sourceDoc.TextSelection = replacePara;
sourceDoc.Copy (0);
App. ActiveDoc = targetDoc;
targetDoc.Paste (0);
... etc.
Does make sense, or am I barking the wrong tree, as they say?
Russ
- Of course, everything works fine until I want to insert the replacelement:
-
help me create a column with the time format
Hi all
Please help me find the query to create a table with 3 columns and insert the following data
ENTITYID | CHGDATE | CHGTIME
======= ==================== ========
4214984 | 2 OCTOBER 06 12.00.00.000000 AM | 07:23:57
4214985 | 12.00.00.000000 11-SEP-08 AM | 10:52:19
and update of the first line of the above table as follows
---------------------
4214984 | 2 OCTOBER 06 07.23.57.000000 AM | 07:23:57
------------------------
you will need to update the CHGDATE column with the time of the CHGTIME column.Sorry, we need a new format around the to_date
select to_date(to_char(chgdate, 'mm/dd/yyyy') || ' ' || to_char(chgtime, 'hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss') from etime3;
This should telll Oracle to the format of the generated string. If this isn't the case, run select with the to_char two as separate columns to see that get us the data that we expect.
-
a date column, with timestamp... How to remove the timestamp
Hello
I have a table name WRESTLING, with one of its fieldnamed DATE, using the DATE data type.
The date format incudes timestamp, can someone help me how to remove the timestamp part.
I want only the part of date only. I tried this:
Update DATE is to_char(date,'DD-MON-YYYY') set of CATCH;.
but the result of all the date inside the table always have timestamp.
can I use this:
Update DATE is to_date(date,'DD-MON-YYYY') set of CATCH;.
and still the same result.
Can anyone advice on this? pls.
Thank youuser9353110 wrote:
Thank you very much.. If this is the case, we can remove the timestamp when creating view for this table?No, you can never remove the component "hour" of a DATE.
If you do not want to display a date in time (display purposes only!), use TO_CHAR to "transform" the DATE to a string with the format mask
SQL> alter session set nls_date_format = 'dd-mm-yyyy hh24:mi' 2 / Session altered. SQL> select sysdate 2 from dual 3 / SYSDATE ---------------- 17-03-2010 09:28 SQL> select to_char (sysdate, 'dd-Mon-yyyy') 2 from dual 3 / TO_CHAR(SYSDATE,' ----------------- 17-Mar-2010 SQL> select to_char (sysdate, 'yyyy-MON-dd') 2 from dual 3 / TO_CHAR(SYSDATE,' ----------------- 2010-MAR-17 SQL>
NOTE: the example of last two are not DATEs! They are STRING
-
How to remove tabs, several spaces, quotes from data in the column.
Hello
How can we remove legs, several spaces, quotes from data in the column.
Entry:
H ope you 'are' Ingo w ell
Output:
H ope do you everything - there is a tab in hope and double-spaced in the well. This should be replaced by space. (Tab and multi spaces)
I found myself with below:
REGEXP_REPLACE (REGEXP_REPLACE (Replace (col, Chr (9),' '), ' () {2,} ', ' '),'[' ""]', ")
Can we do more efficiently, your contributions are appreciated.
I tried
REGEXP_REPLACE (col,'[^ [a - z, A - Z, 0-9, Chr (0) - Chr (127) [: Space:]]] *', ") but the tabs still exist and that my data have German characters I can't go along with this.
Thank you
GVK.
Hello
Karthik417 wrote:
Hello
Thanks for your suggestion. In the above expression, we still missed to replace the double quotes.
So thought we must use another regular expression instead of REPLACE.
Select REGEXP_REPLACE (REGEXP_REPLACE (' H ope you "are" d "Ingo ell w ',' [' |])) CHR (9) | + ',' '),'["" "]') twice;
I suppose we must use at least 2 REGEXP to achieve and cannot get it with a single expression.
Thank you
Sorry, I removed single quotes, not double - quote. (This shows one of the reasons why having a few lines of sample data is very useful).
I think you don't need 2 separate functions. I do not think that the two must be REGEXP_REPLACE; You can use TRANSLATE to remove both types of quotation marks in a single function call:
TRANSLATE (REGEXP_REPLACE (col
, '[ ' || CHR (9) | ']+'
, ' '
)
, '?'''"',
, '?'
)
Of course, you can use use REGEXP_REPLACE to remove the quotes, if you really want to.
Powerful they are, regular expressions are basically only 1 thing, things not 2 or more different. Sometimes, he can watch as they do several things, because they can operate on character classes, like the series containing the
and the and a variable number of characters. For example, the REGEXP_REPLACE function, I used above is simply changing expression expression x y, where x is 1 consecutive or more characters of a given set. As we both demonstrated, we can have a separate function that changes from p to q, but I know not all built-in function which, in general, can change x to y at the time that it changes from p to q. TRANSLATE comes close, but TRANSLATE only works if x, y, p and q are single (or NULL), characters not expressions.
Maybe you are looking for
-
Impossible to mount a disk image
Hello world It is impossible for me to get any new or old picture disc. That is to say: all of a sudden none of all the files on my disk *.dmg can be opened. Anywhere on internet I can find a solution to this problem. Would you be kind enough to help
-
I have a HP mini 110-3130 and locked the touchpad.
I have a HP mini 110-3130 and locked the touchpad. A small icon with a line through it. Once this icon fades the touchpad mouse stops working. Suggestions for addressing anomaly welcomed. There is no light or switch around the touchpad unlike some
-
original title: Dotnet 4.0, cannot be upgraded. I need help on problem mentioned below, the error obtained when upgrading to 4.0 on XP with SP3 dotnet even machines with and without the dotnet 3.5 installed. "error: Setup cannot continue because a pr
-
Hello I have an old laptop running XP. It has clogged up big time and need to wipe and reinstall XP. I have no XP disc, but have a license number on the details of the system window. I can't find a recovery partitionand can not find anywhere to beg
-
Updated frm win7 starter to win7 pro and cannot access pics on 1 TB extern hrddrive because I did not hv permission. So far, the only way I can do it is one file at a time. This is not an option.