Question about datatypes
Hallo, Maybe this sounds simple for all of you, but I have a table with the field PRICE and that is with datatype varchar2 I want the data in that field to be inserted in another table with field PRICE, but that field has the datatype NUMBER. How can I deasiest do this sql statement? I really have to have the Varchar dataype in table1. Thanks in advance Roland -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Antw: Question about datatypes
Hej Roland (Sverige?), I doubt that. If all the data is number in the varchar2 column, well, you don't need it to be varchar2. The easiest solution seems to be: INSERT INTO newtable SELECT TO_NUMBER(col) FROM oldtable; Premise: all your data in that column IS number. If you're not sure, do some pl/sql to identify the erroneous rows and track them in another table for correction purposes. hth, Guido [EMAIL PROTECTED] 03.11.2003 11.14 Uhr Hallo, Maybe this sounds simple for all of you, but I have a table with the field PRICE and that is with datatype varchar2 I want the data in that field to be inserted in another table with field PRICE, but that field has the datatype NUMBER. How can I deasiest do this sql statement? I really have to have the Varchar dataype in table1. Thanks in advance Roland -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Guido Konsolke INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Question about datatypes
Trigger using TO_NUMBER function would be the first thing that comes to mind. I have designs like that, which are used for parsing so calld Bloomberg files. Those files contain strings like N.A., -,|| ('|' is the field delimiter) and all of those strings mean NULL. Also, stock split ratio can be described as: 1:2, 1/2, 2 for 1, 0.5, which has to be mapped to a number field. I'm using perl to parse the input files and I'm using crontab to schedule perl script exectuion. On 2003.11.03 05:14, [EMAIL PROTECTED] wrote: Hallo, Maybe this sounds simple for all of you, but I have a table with the field PRICE and that is with datatype varchar2 I want the data in that field to be inserted in another table with field PRICE, but that field has the datatype NUMBER. How can I deasiest do this sql statement? I really have to have the Varchar dataype in table1. Thanks in advance Roland -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Mladen Gogala Oracle DBA -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Question about datatypes
Yes but how should I write the sql statement when to make the incoming varchar2 field into a number? Roland Mladen Gogala [EMAIL PROTECTED]To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] .netcc: Sent by: Subject: Re: Question about datatypes [EMAIL PROTECTED] .com 2003-11-03 13:19 Please respond to ORACLE-L Trigger using TO_NUMBER function would be the first thing that comes to mind. I have designs like that, which are used for parsing so calld Bloomberg files. Those files contain strings like N.A., -,|| ('|' is the field delimiter) and all of those strings mean NULL. Also, stock split ratio can be described as: 1:2, 1/2, 2 for 1, 0.5, which has to be mapped to a number field. I'm using perl to parse the input files and I'm using crontab to schedule perl script exectuion. On 2003.11.03 05:14, [EMAIL PROTECTED] wrote: Hallo, Maybe this sounds simple for all of you, but I have a table with the field PRICE and that is with datatype varchar2 I want the data in that field to be inserted in another table with field PRICE, but that field has the datatype NUMBER. How can I deasiest do this sql statement? I really have to have the Varchar dataype in table1. Thanks in advance Roland -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Mladen Gogala Oracle DBA -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
Re: Question about datatypes
If the data is really a number ( ie. no alpha characters ) you don't need to do anything, Oracle does an implicit conversion. insert into my_table_numeric( real_number_column ) select my_stupid_varchar2_col from I_hope_these_are_all_numeric_table / Jared On Mon, 2003-11-03 at 04:44, [EMAIL PROTECTED] wrote: Yes but how should I write the sql statement when to make the incoming varchar2 field into a number? Roland Mladen Gogala [EMAIL PROTECTED]To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] .netcc: Sent by: Subject: Re: Question about datatypes [EMAIL PROTECTED] .com 2003-11-03 13:19 Please respond to ORACLE-L Trigger using TO_NUMBER function would be the first thing that comes to mind. I have designs like that, which are used for parsing so calld Bloomberg files. Those files contain strings like N.A., -,|| ('|' is the field delimiter) and all of those strings mean NULL. Also, stock split ratio can be described as: 1:2, 1/2, 2 for 1, 0.5, which has to be mapped to a number field. I'm using perl to parse the input files and I'm using crontab to schedule perl script exectuion. On 2003.11.03 05:14, [EMAIL PROTECTED] wrote: Hallo, Maybe this sounds simple for all of you, but I have a table with the field PRICE and that is with datatype varchar2 I want the data in that field to be inserted in another table with field PRICE, but that field has the datatype NUMBER. How can I deasiest do this sql statement? I really have to have the Varchar dataype in table1. Thanks in advance Roland -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Mladen Gogala Oracle DBA -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Mladen Gogala INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services - To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services-- 858-538-5051 http://www.fatcity.com San Diego, California-- Mailing list and web hosting services