Varchar2 to the number conversion problem
I have some difficulty conversion strings to numbers. On my Oracle 9.2 server, it gives me an error ORA-1722:SELECT TO_NUMBER ('1.2') OF DOUBLE
Apparently, this is because my server is configured to use the Greek number format (comma instead of decimal point) and substitute "1.2' above with '1.2' will work correctly."
Is it possible for me to convert strings with decimal number type, independent of the culture so that my application will not have to depends on the locale setting of the server?
Thank you.
Hello
Welcome to the forum!
If you don't want to change the NLS settings for your session, you can specify what settings to use for a particular call to TO_NUMBER (and other features), like this:
ALTER SESSION SET NLS_TERRITORY = GREECE;
SELECT TO_NUMBER ('1.2') AS wont_work
FROM dual;
SELECT TO_NUMBER ( '1.2'
, '999999999.999999'
, 'NLS_NUMERIC_CHARACTERS = '',.'''
) AS n
FROM dual;
The output below shows the TO_NUMBER 1-argument fails, but the 3-argument TO_NUMBER works:
Session altered.
SELECT TO_NUMBER ('1.2') AS wont_work
*
ERROR at line 1:
ORA-01722: invalid number
N
----------
1,2
The actual format of the string (the first argument) should not match precisely the format mask (the second argument). You can include signs, or omit the decimal points, so '3', ' '-1,2. '-3', ' + 1.2 ' and ' + 3' will be all converted correctly.»»» "
Tags: Database
Similar Questions
-
String to number conversion problem
I have a VI that pulls in data from a device using VISA, and I got it on another computer to work a few weeks back. I had to transfer the VI to a laptop computer to run a few tests, and now I can't make it work. I am unable to put my VI because the laptop on it's is unable to access the network companies, I will do my best to explain it all, I apologize for the inconvenience! My problem is not however with VISA, it's with an exit VISA number conversion chain.
I have attached a painting drawing of VI to better explain it.
I use the block series Visa football match in baud rate and all that many good things to the unit and port settings set of device management. Then, a while loop is entered. The loop will run until you press the stop"" button. The next block of visa is the writing block, he asks for a reading of the device. The next block of visa is the first block of reading, he returns playback in the form of "NA-XXX. X' where x are numbers. The next block of visa is the second reading block, this block just echoes back the command sent to the device. Playback of the first visa read block, "NA-XXX. X' is going exponential/fractional chain to digital converter.
When you perform a run/debug to highlight run, the release of visa reports the correct value, is the value of the device reading - however the string to number converter generates a 0,000, no matter what channel number is. I am at a loss as to what may be wrong because it's the EXACT set up I had to work very well a few weeks ago!
I'm using Labview 10 on the laptop, the old computer was labview 7. I'm guessing that this is perhaps the rub... I Redid the VI from scratch, although I have not opened the old VI in labview 10.
Any help would be appreciated. Again, sorry I am unable to attach the VI.
DARB wrote:
I have attached a painting drawing of VI to better explain it.
Would it not have been easier to just post a screenshot? You might also have used the Tool of Capture of Code. (Which reminds me that I need to install it to my previous versions of LabVIEW, as evidenced by the screenshot I took. )
As to the question: you probably either:
- employee analysis of chain initially and when you rewrote the VI you used the regular string conversion functions.
- Wired an offset value in the string to the number function.
-
How to change the type of data of a varchar2 number pass? the pass is not empty
Assuming that the name of the column to change data type is orig_col follow the procedure below:
Add a new column to the table to say TEMP_COL with data like the NUMBER type
ALTER TABLE table_name ADD ( TEMP_COL NUMBER);
Update of the new column with the values of ORIG_COL
UPDATE table_name SET TEMP_COL = TO_NUMBER(ORIG_COL);
Delete the original column
ALTER TABLE table_name DROP ( ORIG_COL );
Rename the TEMP_COL to ORIG_COL
ALTER TABLE table_name RENAME TEMP_COL TO ORIG_COL;
Create all indexed/constraints that were present on ORIG_COL
Concerning
ArunPublished by: Arun Kumar Gupta on May 23, 2011 10:04
-
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
-
varchar2 to the date format conversion
I have converted the formats of date several times, but for some reason, I get an error invalid number when you try to convert a varchar2 column. I tried the to_char and to_date function and I get the same result. The column is a date and it is formatted like ME-DD-YYYY, but I want to change it to DD/MM/YYYY. My query is below:
Select to_date('fccpdate','MM/DD/YYYY')
of cc_class_scmast_v
When I try to_date I get this:
Error from the 1 in the command line:
Select TO_DATE ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
Error report:
SQL error: ORA-01858: a non-digit character was found here where was waiting for a digital
01858 00000 - "a non-digit character found here where was waiting for a digital".
* Cause: Input data to convert using a date format model has been
incorrect answer. The input data did not contain a number where is a number
required by the format model.
* Action: Fix the input data or the date format model to ensure that the
elements correspond to the number and the type. And then try the operation again.
When I try to_char I get this:
Error from the 1 in the command line:
Select TO_char ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
Error report:
SQL error: ORA-01722: invalid number
01722 00000 - "invalid number."
* Cause:
* Action:
I tried to remove the single quotes of my column and that does make a difference. Any help is appreciated.Hello
housetiger77 wrote:
I have converted the formats of date several times, but for some reason, I get an error invalid number when you try to convert a varchar2 column. I tried the to_char and to_date function and I get the same result. The column is a date and it is formatted like ME-DD-YYYY,If the column is a DATE, then it has the same format that all DATEs, which is nothing like 'DD-MON-YYYY '. Formats like which apply only to chains.
Conversely, if it is in the format "DD-MON-YYY", then it is a string, not a DATE.but I want to change to DD/MM/YYYY. My query is below:
Select to_date('fccpdate','MM/DD/YYYY')
of cc_class_scmast_vTo_date (x, "MM/DD/YYYY") tries to convert the string x in a DATE. Let's say it starts by taking the first 2 characters of x, for the month. The first 2 characters of 'fccpdate' are "fc", which is not a valid number (at least not in base 10), not to mention a number from 1 to 12, TO_DATE so will raise an error.
When I try to_date I get this:
Error from the 1 in the command line:
Select TO_DATE ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
Error report:
SQL error: ORA-01858: a non-digit character was found here where was waiting for a digital
01858 00000 - "a non-digit character found here where was waiting for a digital".
* Cause: Input data to convert using a date format model has been
incorrect answer. The input data did not contain a number where is a number
required by the format model.
* Action: Fix the input data or the date format model to ensure that the
elements correspond to the number and the type. And then try the operation again.When I try to_char I get this:
Error from the 1 in the command line:
Select TO_char ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
Error report:
SQL error: ORA-01722: invalid number
01722 00000 - "invalid number."
* Cause:
* Action:I tried to remove the single quotes of my column and that does make a difference. Any help is appreciated.
It's a good first step. Literals are enclosed in single quotes are not identifiers (including the column names). "fccpdate" is the literal string of 8 characters containing 'f', ' c; Another 'c', 'p' 'd', 'a', 't' and 'e'. " fccpdate (without the single quotes) can be the name of a column.
If fccpdate is a string, as July 18, 2012', then you can convert it to a DATE using TO_DATE.
TO_DATE (fccpdate, 'DD-MON-YYYY')
If you want to display a DATE in a particular format, use
TO_CHAR ( d , f )
where d is a DATE, and f is the format string. In this case, d is perhaps the TO_DATE expression above
TO_CHAR ( TO_DATE (fccpdate, 'DD-MON-YYYY') , 'MM/DD/YYYY' )
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using.
See the FAQ forum {message identifier: = 9360002} -
PL/SQL: digital or value error: character number conversion in the TRG error
Hello
I have a strange problem with a trigger that, during the update of the table of reports (DB is 9.2.0.8):
but the 345 line is:ORA-06502: PL/SQL: numeric or value error: character to number conversion error ORA-06512: at "UDR_LOG", line 345 ORA-04088: error during execution of trigger 'UDR_LOG'
END IF;
This kind of strange
error is raised by the update on a column.the code looks like 343 IF nvl(to_char(:old.PKD_ID),'''') <> nvl(to_char(:new.PKD_ID),'''') THEN 344 v_zmn := v_zmn || 'PKD_ID''' || to_char(:old.PKD_ID) || '''' || to_char(:new.PKD_ID) || ''''; 345 END IF; so its concatenation not to_number usage .
I'm sorry that I can't provide you with the code in the trigger everything.
So, if you could recommend only whole method of inquiry that would be great.
Concerning
GregHi, Greg.
When there is an error in a trigger, the line numbers in error messages are compared to the first statement DECLARE or BEGIN; often, it is a few lines after CREATE OR REPLACE TRIGGER. Post a few lines after what you have already posted.
If you do not find the error, then create another table to test this and create a small trigger on that table, who did just enough to cause the error. Then, you will be able to post the complete relaxation, and the code needed to recreate the problem.
-
Is the locale-specific number conversion chain?
I would like to know what effect the computer's regional settings may have on the string number conversion in AS3. Specifically, in locales that use a comma as the decimal separator instead of a period, different conversion methods (Number() function, parseNumber(), Builder of the Number() class) they treat the comma as decimal separator? None of the documents I've read resolves this problem and all the examples use periods as a decimal separator. I suspect periods in strings will always be handled as decimal separators (and this is the behavior I want), but I would like to know for sure.FTR, an Adobe employee comes to informs me on programmers list that the answer to this question is no. period is always interpreted as a decimal separator, regardless of the location of the BONE.
-
I have 22 SPSS for Mac. Since I upgraded to El Capitan, I have a number of problems. I checked the Web sites of IBM, but they only mention fixes for SPSS 23. Any thoughts would be greatly appreciated. Thank you.
I am running SPSS 23.0
You can upgrade to 23.0?
Also, have you looked here
-
Problem with the number of lines in the channel
Dear community LabView,
I'm relatively new to labview and I came across a problem that (I assume) can easily be resolved with your help.
I need to create a digital signal to trigger a camera, but I have a problem with the configuration of my lines or exit lanes. I would not use that line output to trigger the camera. (I use a card NI PCIe-6353). LabVIEW is telling me that the number of lines in the channel does not have the number of rows of data:
Possible reasons:
Specified read or write operation failed because the number of rows in the data of a string is not the lines in the channel.
If you use the digital waveform data type, make sure that the number of lines in the digital waveforms is the number of lines in the channel. If you are using Boolean data, make sure that the dimension of the array for the rows of the data is the number of lines in the channel.
Number of lines in the channel: 1
Number of data lines: 2Task name: _unnamedTask<11>
How and why the number of data rows is connected to the resolution of my analog digital converter?
I would appreciate your help! Labview code and a screenshot attached.
Thank you
Beff
I got it to work by changing the "data format" "binary not signed" OR by plugging is not the "offset" for the Square Wave VI. I think that the default "offset binary" data format works correctly if there is a negative value.
11> -
The decimal string to number Conversion, cutting necessary zeros
I'm new to the forum, but have been using labview for awhile. Finally found something that really puzzled me, hope I can find someone who is smarter than me! It may be something obvious too, but here goes. The attached vi is the cause of the error. I have a serial number I need to convert a decimal string into a number, I use later the number of "math" so he need as a number. The system always receives a serial number of 6 characters (ie. 123456), but today the system has received a serial number with two leading figures of the scale (ie. 003456) zeros. This compensation of all the bells of alarm stream (sent 4 digits), but the error found that started the 'intelligence' at the beginning of the monitoring program. I would like to know if there is a way to force the zeros in the decimal number in string to not shave off the coast of the 6-digit value above.
File is located in LabVIEW 2014
Ideas or comments, thank you!
The problem is not the string functions. This is the display format for your digital indicator. Change the properties on that.
-
Original title: reactivation.
I bought Office Home and Student 2010 when I bought a new laptop. Over time, I have had problems with laptop computer and had to reload Office several times. Now, I bought another laptop and when I try to load the office he told me that I have exceeded the number of times authorized to activate. Is there a way around this or should I buy again?
I'd probably use activation by telephone method to activate. At most, you talk to a customer service representative and explain the situation and you will be activated. But, it is usually resolved by using the automated system.
-
Problem with the number of files?
Hello guys,.
I have a problem with the compilation of some projects...
I realize that when my project 201 records in total (including the file config.xml, Active Directory and directory ext) they do not compile.
If I delete all the files (if the project has 200 files in total), the success of occours compilation.
See:
E:\BlackBerry WebWorks Plug - in Eclipse\plugins\net.rim.browser.tools.wcpc_1.5.1.201010291444-22\wcpc>bbwp.exe "C:\Documents and Settings\Softwell\Desktop\blackberryhtml5.zip".
[INFO] Parsing of the command line options
[INFO] Bbwp.properties analysis
[INFO] Validation of archive application
[INFO] The analysis of config.xml
[INFO] The application of filling source
[INFO] Compilation of application BlackBerry WebWorks
java.io.IOException: cannot run program ""E:\BlackBerry"(in the"C:\DOCUME~1\Softwell\CONFIG~1\Temp\widgetGen.4723774651307629071871.tmp"directory): error = 87, Parometro incorreto CreateProcess.
[ERROR] CAP exception has occurred
Can someone help
Hello tneil,
Well, I found the problem and a solution.
The thing is: my project was not limited by the size, this is the number of files (200).
I realized that BB has released an SDK 2.0 (I used 1.5) and I tryied to compile with the 2.0 and everthing works fine!
The problem is how bbwp.exe communicate with rapc.exe, maybe he tryies to send files by command line and it has a limit. With the new sdk, it uses a file temp with all orders. This is why it works.The maximum size of 7MB, I can't say anything, because my apps are about 3-4 MB. But good to know, if I can put in my documentation.
That's all.
CYA -
I bought a trial 30 Adobe BC and then enabled so I could have the product. An email is sent with the serial number. Problem is that I don't have the previous version and computer scientist was here, where he suggested I ask you to please provide me with the version complete.
Did you buy the full version or an upgrade?
-
I have a problem loading Illustrator CS4 on a second computer (laptop). It does not recognize the number, saying: it is not valid. Any suggestions on how to have the serial number recognized would be appreciated.
Please see: error of incorrect serial number
I hope this helps.
Concerning
Megha Rawat
-
Hi, I have adobe CC for teams, a member of the team has problems, opening indesign, asked for a serial number, ive checked on our admin account and it is one our our registrants 'members '. I was not the person who created this original so I'm a little lost, I can't seem to find the serial numbers on my account and it seems like we don't have the qualified products? can you help me?
Hello
We checked the details of your team, all seats are assigned correctly.
Now, there are a few details that we need in a private Message so that I can help you properly.
Name of the user:
User email:
In the meantime, try it out below mentioned links.
- Creative Cloud applications ask for serial number
- Log, activation, or connection errors. CS5.5 and later, Acrobat DC
[Note: the details we need is critical, make sure you send by private Message only.]
Thank you
Atul Saini
Maybe you are looking for
-
Hello I will be backpacking for a month or two and probably will not have enough room on my phone to store all of the photos I take. I intend to upload them to iClould whenever I had the chance to connect to the Internet. I would ask if I wanted to d
-
Satellite Pro P100: What is the part number for Toshiba for a 2 GB memory module
Unable to find any sort of emailing this issue so I posted on the forum. Of course this info should be more easily accessible without having to ask. What is the number of part of Toshiba for a 2 GB for a PSPA4E-00F007 memory module. It's a satellite
-
I need a Subvi to generate the user events that must be received by hand VI. Currently, I use the user event and would like to find how to send this event generated at hand VI? In other words the Subvi will generate events and if there is a listener
-
Proper display of Chinese characters for songs in the external SD cards
I can't get the Chinese characters good when I play songs with Chinese titles in my external SD card, but have no problem when you place them in the internal memory. Someone knows how to fix this?
-
When I boot my laptop with Vista, loads and gets on the desk on either primary or a guest account, a small box about 2 x 3 "appears for only a fraction of a second, but I can see there is a red X on the top right corner and two clickable buttons, but