Converts a string to a problem posed by the
Hello!I get an ORA-01861: "literal does not format string" when you try to convert a string
on a date.
Currently stored as VARCHAR2
14SEP11
Should beto_date(start_op, 'DD-Mon-YY HH24:MI:SS') AS FORMATTED
Date formatNLS_DATE_FORMAT DD.MM.RR
user545194 wrote:
Hello!I select the column name:
select to_date(start_op, 'DD-MON-YY') AS FORMATTED from table
Column name: start_op
A conversion problem?
SQL> create table otn(p_date varchar2(7));
Table created.
SQL> insert into otn values('14SEP11');
1 row created.
SQL> commit;
Commit complete.
SQL> select to_date(p_date,'DDMONYY') from otn;
TO_DATE(P
---------
14-SEP-11
SQL>
SQL> alter session set nls_date_format='ddmonyy';
Session altered.
SQL> select to_date(p_date,'DDMONYY') from otn;
TO_DATE
-------
14sep11
SQL>
Tags: Database
Similar Questions
-
String to the problem posed by the...
I'm a string (from Date of toSting method) and this shot is not supported by the httpparser how can I convert to sting? and the string I get Date toSting method could be in different formats depending on whether the zone is available or not... How can I handel it.. ?
Kind regards
Kedar
I use this date format because it is the default format you will get when you do date.toSting... and this was my requirement... that I get the date from the server in the from of a chain... I used the the substing and got a solution yet... but I would really appreciate if you could provide the solution so that I could make improvements in mine if necessary...
Thanking you,
Kaddy
-
Select the problem posed by the query?
Hello
I use 10g and here is my example query adds nothing. I know there are records in the database. It must be linked with my date conversions.
SELECT a.gm_cd, a.draw_cd, NVL (b.cpns, 0) cpns, NVL (b.clms, 0) SSAC, NVL (b.amn, 0) amn FROM (SELECT gm_cd, draw_cd, TO_DATE (draw_tm, ' DD/MM/YYYY') draw_tm TO draw WHERE gm_cd = 10105 AND TO_DATE (draw_tm, ' DD/MM/YYYY') = TO_DATE (sysdate-1, ' DD/MM/YYYY')) a, (SELECT SUM (DECODE (a.from_draw, a.to_draw, a.cpns * b.sing_ind 0)) cpns) (, SNSOT SUM (a.clms* b.sing_ind), amn SUM (a.amn* b.sing_ind) OF draw_sales a, ACC_TYPE b WHERE a.tp = b.cd AND a.DT = TO_DATE(sysdate-1, 'DD/MM/YYYY') AND a.gm_cd = 10105) b ORDER BY a.gm_cd, a.draw_cd
Any ideas?
Furthermore, draw_tm is a column DATE (05/11/2013 03:59:59) and the DT is also a column DATE (10/05/2013)raysefo wrote:
HelloI use 10g and here is my example query adds nothing. I know there are records in the database. It must be linked with my date conversions.
SELECT a.gm_cd, a.draw_cd, NVL (b.cpns, 0) cpns, NVL (b.clms, 0) SSAC, NVL (b.amn, 0) amn FROM (SELECT gm_cd, draw_cd, TO_DATE (draw_tm, ' DD/MM/YYYY') draw_tm TO draw WHERE gm_cd = 10105 AND TO_DATE (draw_tm, ' DD/MM/YYYY') = TO_DATE (sysdate-1, ' DD/MM/YYYY')) a, (SELECT SUM (DECODE (a.from_draw, a.to_draw, a.cpns * b.sing_ind 0)) cpns) (, SNSOT SUM (a.clms* b.sing_ind), amn SUM (a.amn* b.sing_ind) OF draw_sales a, ACC_TYPE b WHERE a.tp = b.cd AND a.DT = TO_DATE(sysdate-1, 'DD/MM/YYYY') AND a.gm_cd = 10105) b ORDER BY a.gm_cd, a.draw_cd
Any ideas?
Furthermore, draw_tm is a column DATE (05/11/2013 03:59:59) and the DT is also a column DATE (10/05/2013)
If draw_tm is a DATE data type, then you shouldn't do a TO_DATE on it, as you don't need to convert it to a date. If you try to remove any component "hour" of him, then you must use TRUNC (draw_tm).
Similarly, with sysdate, you must use TRUNC to truncate. Never use TO_DATE datatypes in other data you causes an implicit conversion in varchar2 who depend on your NLS settings and may fail.
-
case statement and the problem posed by the...
Hello..
Here is the code I use in my pl/sql anonymous block:
I want to do something like this:DECLARE X555 NUMBER; P1_X2 varchar2(10) := to_char(sysdate, 'dd.mm.yyyy'); BEGIN case when P1_X2 = to_char('sunday') then SELECT COUNT(*) into X555 FROM biwh.ORGANIZ Tbl WHERE SAM_FORMA IN ('16') and IDEN_N_TAR in to_date(/*:*/P1_X2, 'dd.mm.yyyy')-3; else SELECT COUNT(*) into X555 FROM biwh.ORGANIZ Tbl WHERE SAM_FORMA IN ('16') and IDEN_N_TAR in to_date(/*:*/P1_X2, 'dd.mm.yyyy')-1; end case; dbms_output.put_line(X555); end;
If it's Sunday, leave this part of the labour code:
can you tell me the correct syntax of the code? where did I did mystake?SELECT COUNT(*) into X555 FROM biwh.ORGANIZ Tbl WHERE SAM_FORMA IN ('16') and IDEN_N_TAR in to_date(/*:*/P1_X2, 'dd.mm.yyyy') -3;
SRY for my English...P1_X2 varchar2(10) := to_char(sysdate, 'dd.mm.yyyy'); BEGIN case when P1_X2 = to_char('sunday')
In the light of the foregoing, you set P1_X2 to a string value that resembles '05.10.2009' and then try to compare it to a string that looks like "Sunday".
I'd be tempted to define P1_X2 as a DATE, then check against that for example
p1_x2 DATE := trunc(SYSDATE); BEGIN CASE TO_CHAR(p1_x2,'fmday') WHEN 'sunday' THEN SELECT COUNT(*) INTO x555 FROM biwh.organiz tbl WHERE sam_forma IN ('16') AND iden_n_tar = p1_x2 - 3; ELSE SELECT COUNT(*) INTO x555 FROM biwh.organiz tbl WHERE sam_forma IN ('16') AND iden_n_tar = p1_x2 - 1; END CASE;
The above assumes that you store iden_n_tar as a 'date at midnight '.
You could go further and have a single query that moves from the "cause" of the where clause:
SELECT COUNT(*) INTO x555 FROM biwh.organiz tbl WHERE sam_forma IN ('16') AND iden_n_tar = p1_x2 - CASE TO_CHAR(p1_x2,'fmday') WHEN 'sunday' THEN 1 ELSE 3 END;
-
The above statement is missing a day as its display of October 14, 2008 results-October 27, 2008WHERE rpt_dt BETWEEN TO_DATE('14-Oct-2008', 'dd-Mon-yyyy') and TO_DATE('28-Oct-2008', 'dd-Mon-yyyy')
How can I solve this problem?
Thank youDates also have a time component, if you select actually all records where rpt_dt is between 14 October 2008 00:00:00 and 28 October 2008 00:00:00
To include all dates and not excluding a possible use of an index, use this technique:
WHERE rpt_dt BETWEEN date '2008-10-14' and date '2008-10-28' - interval '1' second
Kind regards
Rob. -
How to convert a string to byte array
Hello
I want to convert a string with a hexadecimal number in the array of bytes, this string includes a cutting-edge information, but I don't want to add this tip to arry bytes.
detailed information please see the photo. I hope someone can give me some instructions, thank you very much.
The accepted solution of Giedrius.S is not correct, based on the image shown in the first post. That the solution will not eliminate the spaces before the tip, and the string to byte array to convert individual characters '0', '8', 'space', '9', etc. for them to byte values. The right solution, based on the image below:
-
I want to assign a value to a global variable of the station (type: number) to the local variable (type: number).
The problem is, that knowledge straight from the global variable of the station at the time of execution.
I have a string like "StationGlobals.PARAMETER.SWITCH.xx.nRESISTOR_VALUE" - the characters 'xx' variable will be replaced when running...
Now I want to convert this string to a path variable to assign to the local variable (type: number) the value of the global variable of the station (type: number)
Do you know how I can do?
Greetz
Jonathan K.
Try
Locals.nCurrentResistorValue = Evaluate (Locals.sFunctionPath)
-
converting a string to some general engineering
Hello world
All know how to convert a string of engineering in a normal formatted string?
Thank you
Hi nem.
in your vi there is no 'CH2-01. Do you mean "DAQ21"?
See the attachment for a few minor changes (deleted sequence, its inhabitants, to build a better way). Why divide you your berries into 4 parts when you need to rebuild all the berries again?
Are you sure this isn't a problem of formatting Excel? You set all the numbers in the excel worksheet to display in the form of "numbers"?
When I try your vi I do not get any number in scientific format in Excel. (And I would say to transpose Excel import data...)
-
Converting a string to an array of integers (ints)
I need to do ot an app that will read in numbers, or data means, in a text file on an SD card and then convert them in a line graph. Currently I am able to read the contents of a text file and store it as a string with this code
private String readTextFile(String fName) { String result = null; FileConnection fconn = null; DataInputStream is = null; try { fconn = (FileConnection) Connector.open(fName, Connector.READ); is = fconn.openDataInputStream(); byte[] data = IOUtilities.streamToBytes(is); result = new String(data); } catch (IOException e) { System.out.println(e.getMessage()); } finally { try { if (null != is) is.close(); if (null != fconn) fconn.close(); } catch (IOException e) { System.out.println(e.getMessage()); } } return result; }
I am able to print the result of the chain of my test file so it prints something like "1 2 3 12 14 2 42.
What I want to do convert this string to an array of int that will look like int [] result = {1, 2, 3, 12, 14, 2, 42}.
I tried to use string.split("") as this seems to be what is generally done when I have the problem of google. When I try this however I get an error "the split (String) method is not defined for the String type.
I just want to know if there is a way to convert this string to an array of integers (ints), or maybe is it possible to change my readTextFile method so that it will display the data in a table or working with the array of bytes to get distinct integers.
Hi try this
-
Converting a string to a Date using an insert after trigger.
Hi people:
I have a table that has a column (called DATE_FED) that must be registered in the format string.
Once all data insertion after trigger is triggered that copies of some columns in another table.
The problem is that the insert after trigger will not work because the table is copied in stores DATE_FED data in a Date format.
I'm trying to understand how to use the TO_DATE function to convert the NEW. Data DATE_FED to a Date format and the trigger does not work.
Here is the trigger, as it is currently worded:
Create or replace TRIGGER "FARM". "' BALES_FED_PAST_TRIG ' AFTER INSERT"FARM ". ' ' BALES_FED_PASTURE ' 'OLD' NEWS like 'NEW' FOR EACH LINE REFERENCING OLD declare
BEGIN
insert into BALES_STORAGE (BALES_LOST_SUBTRACTED, HARVESTING, CUTTING, STACKYARD, DATE_MOVED, FED_ID, BALE_YEAR) values (: new.) BALES_FED,: new. CULTURE: new. CUTTING: new. STACKYARD,: new. DATE_FED,: new. FED_ID,: new. BALE_YEAR);
END;
This trigger worked until I had to change the column type of DATE_FED from the Date to a string.
I tried things like:
TO_DATE (DATE_FED): = GCNEW. DATE_FED; in a statement, but I don't get it.
Summary:
I need an insert after trigger to convert NEW. DATE_FED (a string) again. DATE_FED (a Date).
Tables:
BALES_FED_PASTURE is the table, the trigger to run.
BALES_STORAGE is the table the trigger is to copy certain columns.
I thank very you much for any help.
Matthew
FriendlyTooo wrote:
I have a table that has a column (called DATE_FED) that must be registered in the format string.
If you book the date in a format string. Bad design. In any case, what is this format? Register you as hh24:mi:ss dd/mm/yyyy or DD-me-YYYY, or... You what it is, you must use this format in your trigger:
insert into BALES_STORAGE (BALES_LOST_SUBTRACTED, HARVESTING, CUTTING, STACKYARD, DATE_MOVED, FED_ID, BALE_YEAR) values (: new.) BALES_FED,: new. CULTURE: new. CUTTING: new. STACKYARD, TO_DATE(:new.) DATE_FED, "whatever-format-is"),: new. FED_ID,: new. BALE_YEAR);
SY.
-
Converts a string to a 32 long
Hello, how to convert a string in the form of a figure with its real numerical value to format long32.
Please see the attachment.
Nevica
There is a function "decimal string.
-
Converts a string (float single precision) in decimal
Hello
I use reading series base and write vi to communicate with a device. The answer I receive (shown in hexadecimal format) is 4606 8D3B, which from what I understand (this discussion: http://forums.ni.com/t5/LabVIEW/string-to-number-conversion-a-very-interesting-observation/m-p/32170... ) the data is not actually hexadecimal but rather binary and appears just hex for the user.
My camera manual says that this information is "Float - 4-byte ANSII standard simple precision, low to high" and I'm trying to convert this string to a decimal value. (it should be 0.004 or e-3 xx 4) So far I've written a program that separates the bytes in a table of 4 bytes, each binary converts and then separate all binary bits and try to group return the binary bits in the exponent and the mantissa to calculate the value, but it seems rather convoluted and I hope that there is a more simple function in that all this is done automatically. Also, since the answer is low to high, I understand that I must first return the number of 3B8D 0646 make high to low, but I think I did that already, it's just the conversion that I do not know how.
Any help would be appreciated, thanks
Alex
Try this:
-
2 value sliders and convert to string
Hi, I'm still new to labview.
Can someone give me a snapshot or an image on how to extract 2 value of sliders & convert to string. And then I need to put the 2 values collected in the body of an email.
Any help please?
The Format based on the string grows downwards to take more than one entry.
-
Convert a single number to a hexadecimal string of 32-bit and exchange the high and low bytes
I need to convert a number single precision floating decimal to hexadecimal format of 32 bits, share the high and low bytes and that convert a hexadecimal string. I tried to use the 'Word of Swap' function but it seems to have no effect on the unique number.
Then
A single decimal number of entry: 100
Convert 32 bit hexadecimal string with the low byte first: 0000 42 8
Anyone have any ideas?
Thank you
Slightly lighter, try to cast U32 and exchange words. Same difference.
(apparently, exchanging words is a NOOP for SGL, but still accepts SGL without constraint. Interesting...)
-
Is there a way to convert a string in the following format:
1400010107070D0305006A01... ('Normal view' string)
by programming to:
1400 0101 0707 0D 03 05006A 01... (Striing "Hex display")
I need to calculate a CRC16 value.
See attached screws
Thank you.
Here is exactly what we have suggested.
Maybe you are looking for
-
I can't seem to be able to watch videos on any website more on firefox
I checked to see if all of my add has were aware that they are. Firefox is updated.
-
How to retrieve the default setting of my browser?
When I download all the files in the firefox browser, there is a small box that asks if you want your browser, the same operation for files as the file is downloaded automatically,I did and I used to pick up the old man sitting, I tried to reinstall
-
Is it possible to lock the zoom once you change it?
I have 24 "display. When using Firefox, fullscreen, most of the website pages open with about 5 '' of empty space on each side. It's like I opened a page and it is supposed to fit on a screen 15 ''. I can change the Zoom, but since I can't lock the Z
-
How to reinstall widows autocheck.exe on vista and xp
"The two PC's running XP a Vista when launchedcome upward with the message:" program not found. Skiping autochk.exe. " On two PCs, I tried to RUN autochk.exe on the BACK and the answer was: application can not run in Win32 mode
-
Printer error: remove and check cartridge on the right
One morning, beautiful (not so) my HP Photosmart 2610 printer showed this error on the screen. Since I can't print, scan, fax or copy. I removed the cartridge on the right, as shown in the error, but it looked very nice. Electronic contacts on the in