SQL & PL/SQL :: How To Convert Decimal Number To A Character
Aug 14, 2013I want to convert decimal number 44 to character(" ' " i.e single quotation);
I have already tried to_char function but it's not working.
I want to convert decimal number 44 to character(" ' " i.e single quotation);
I have already tried to_char function but it's not working.
the basic salary has data type character.when i write
select basic_salary from table_name
it shows output.but when i need annul for that basic salary(basic_salary*12) it shows error. invalid number.
Actually I got a data in hex values and i want to convert it to datetime format. But before i convert the hex value into datetime format, i must convert the hex values into decimal val first for each 2 digits of hex values. This is an example of the input data:-
This is input data in hex value:-
STARTTIME : 080b1317021a
This is decimal value after convert from hex to decimal:-
STARTTIME : 081119230226
My problem is how could i convert hex to decimal in oracle? Below are my coding:-
case
when substr(LOAD_NGNSM.STARTTIME, 1, 2) not between '00' and '99'
or substr(LOAD_NGNSM.STARTTIME, 3, 2) not between '01' and '12'
or substr(LOAD_NGNSM.STARTTIME, 5, 2) not between '01' and '31'
or substr(LOAD_NGNSM.STARTTIME, 7, 2) not between '00' and '59'
or substr(LOAD_NGNSM.STARTTIME, 9, 2) not between '00' and '59'
[code]....
i have a column
NUMBER(13,4)
when i insert 234.000
in show only 234
where as when i insert 234.12
i shows 234.12
is there any setting by which i can show 234.0000
I have a small prob. I want an amount to be always 2 decimal places. I've used the Round function - Round(amount,2). the problem is that if the amount is only to 1 dp like 1.4. the above function will return 1.4. I want it to appear like 1.40
View 2 Replies View Related how to create a function that will multiply the number when the number has more than 3 decimal point.
Example.
123.012 - multiply by 10
123.0123 - multiply by 100
123.01234 - miltiply by 1000
Column A is the result of the number being multiplied according to decimal point.
Column B contains the multiplier used in column A.
I need to generate random numbers from the range 71 million to 90 million. While generatind the same iam getting the value with decimal places.
How to generate with out decimal places ?
SQL> select ABS(dbms_random.value(71000000,90000000)) from dual;
ABS(DBMS_RANDOM.VALUE(71000000,90000000))
-----------------------------------------
87283730.7
I would like to use the REGEX_LIKE to check a number with up to two digits and at least one decimal point: Ex.10.11.1112 This is what I have so far.
if regexp_like(v_expr, '^(d{0,2})+(.[0-9]{1})?$') t
I have a text field and if the text field has 5 consecutive numbers then I have to extract the number and the previous character from where the 5digit number starting
For example i/p asdfasfsdS251432dasdasd o/p should be S251432
I want to convert my database characterset from WE8MSWIN1252 from any UNICODE, because i have to transportable tablespace to the destination, the destination is unicode and source is WE8MSWIN1252. While importing transportable tablespace i was not able to do because of this reason, so i want to convert lets say source from WE8MSWIN1252 to unicode.
View 7 Replies View RelatedEnterprise Edition Release 10.2.0.5.0
SQL> SELECT * FROM NLS_DATABASE_PARAMETERS where parameter = 'NLS_CHARACTERSET';
PARAMETER VALUE
------------------------------ ----------------------------------
NLS_CHARACTERSET AL32UTF8
SQL>
There is table (VIN_TEMP) in my company database containing following records. It seems like this table should contain some greek language special chracter values instead of this weird data.
SQL> select * from vin_temp;
ATTR
--------------------------------------------------------------------------------
���9999
���9998
���9997
���9997
[code]....
Client are reporting these records as invalid and requesting us to fix. As i investigated i found out, this table was created and loaded few year back. Client sent us one time files which we loaded into this table. I was able to find the code which was actually used to load this table, but unfortunately i was not able to find the raw files where we load this data from...
It seems like Previous Developer specified character set "UTF8" statement, in his sql loader script, to load this data. It seem those file contain some Greek language special character data which was not support by "UTF8" charater set and result in creating those invalid data. My Job is to fix these invalid records and convert them back to its original values which were present in the raw file. I tried to contact client and see if i can find out the raw files but no luck. I tried to use convert function as mention to convert this data from "UTF8" to our current character set format but no luck.
SQL> SELECT attr, dump(attr), convert(attr,'UTF8', 'AL32UTF8') from vin_temp;
ATTR DUMP(ATTR) CONVERT(ATTR,'UTF8','AL32UTF8'
------------------ ---------------------------------------------------------------- -----------------------------
���9999 Typ=1 Len=13: 239,191,189,239,191,189,239,191,189,57,57,57,57 ���9999
���9998 Typ=1 Len=13: 239,191,189,239,191,189,239,191,189,57,57,57,56 ���9998
���9997 Typ=1 Len=13: 239,191,189,239,191,189,239,191,189,57,57,57,55 ���9997
���9997 Typ=1 Len=13: 239,191,189,239,191,189,239,191,189,57,57,57,55 ���9997
[code]....
Here is the script to create table with those type of invalid records.
create table VIN_TEMP
(
attr VARCHAR2(50 CHAR)
);
insert into VIN_TEMP (attr) values ('���9999');
insert into VIN_TEMP (attr) values ('���9998');
[code]....
Source Database: AMERICAN_AMERICA.US7ASCII
Target Database: AMERICAN_AMERICA.AL32UTF8
From the source database, the chinese characters are stored in some schema table. From the csscan result, there are convertiable, truncate, data lossy character. So, I have tried to use exp/imp for the conversion. However, all chinese characters are invalided and cannot be read anymore. How can I convert them from US7ASCCI to UTF8 database?
Also, I have tried build up another database with AMERICAN_AMERICA.ZHT16MSWIN950. The exp/imp is used for conversion again. The chinese characters are readable in AL32UTF8 database.
- source database (US7ASCII)
export NLS_LANG=AMERICAN_AMERICA.US7ASCII
export LANG=AMERICAN_AMERICA.US7ASCII
exp userid='/ as sysdba' file=export.dmp full=y
- target database (AL32UTF8)
export NLS_LANG=AMERICAN_AMERICA.US7ASCII
export LANG=AMERICAN_AMERICA.US7ASCII
imp userid='/ as sysdba' file=export.dmp full=y ignore=y
Result:
from US7ASCII to AL32UTF8:
the chinese characters cannot be read
from US7ASCII to ZHT16MSWIN950:
the chinese characters cannot be read
from ZHT16MSWIN950 to AL32UTF8:
the chinese characters can be read
How can I convert the chinese character from US7ASCCI to UTF8 database?
A column in a table contains the Numeric and Character. I Require the Numeric Value in that Column, if the Value is Character then null value is require to display.
View 4 Replies View Relatedcan we convert RAW to number in sql.because i have to bitand of one raw and number variable.
View 3 Replies View Relatedwould need to convert a number in this way:10.1 ---> 10101.90 ----> 190 How can i?
View 1 Replies View RelatedI've got a table with varchar records and I need to separate numerical value and convert into the number datatype.
create table tmp_mape
(remark varchar2(100) )
insert into tmp_mape values ('Dobitie zdarma 3,32EUR 0910105067 02/02')
insert into tmp_mape values ( 'Dobitie pravidelné 9,00EUR' )
I just need to get values 3.32 and 9 from that example into the new column.
The select below returns ORA-01722: invalid number
how to solve it?
select remark,
to_number( to_number(REGEXP_SUBSTR (remark, '[[:digit:]]+', 1) ) ||','|| to_number(substr(REGEXP_SUBSTR (remark, ',[^EUR]+', 1) ,2) ) )
from tmp_mape
How to convert varchar2 to number data?
View 8 Replies View Relatedhow can convert this number 00001021992 to this format
1-02-1992
i used thie query but no result
select substr(to_date('00001021992','dd-mm-yyyy'),(6,6)) from dual;
I want to convert below MS-SQL query in oracle 10g.
for eg:
Select numasdate,
Cast(numasdate / 60 as Varchar) + ' hours ' +
Cast(numasdate % 60 as Varchar) + ' minutes'
as [TotalHoursAndMinutes]
From
#SampleTable
Output:
9436 157 hours 16 minutes
537 8 hours 57 minutes
9323 155 hours 23 minutes
12525 208 hours 45 minutes
I need a query that convert number into time.
View 5 Replies View RelatedI have a value that I need in the number format, but without decimals. Is this possible?
TO_NUMBER(SY_KEY1,'9999999') AS SY_KEY1The result I get back is:
1114225.0So, I need a result of 1114225 and in the number format.
I have written a stored procedure that has started returning the error:
Error starting at line 1 in command:
call p_glpost('DSTUK', 'L', '2008-01-01', '2008-01-01', '2011-02-18', 1, 1, 1, 0, 'Hi there')
Error report:
SQL Error: ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "CLARITY.P_GLPOST", line 173
06502. 00000 - "PL/SQL: numeric or value error%s"
I can't seem to find a tool that will let me step into the actual stored procedure line by line to see where the error occurs. It mentions line 173, which seems to be a red-herring, as line 173 is simply one of the 'END IF' lines within this block:
IF NVL(r_dist.transtype,'wild') = 'wild' THEN
NULL;
elsif r_wip.transtype = r_dist.transtype THEN
v_matchCount := v_matchCount+1;
elsif r_wip.transtype <> r_dist.transtype THEN
[code]......
Tell me if it is possible to trace through a SP, and which tool is best (I am trying to use Oracle SQL Developer).
I got a string in the form 1+2+4.If we write select 1+2+4 from dual;then we get o/p as 7.but the same thing iam trying to do in a bit of pl/sql program by passing the string 1+2+4 value to a number variable as below.
COUNT_TASK := TO_NUMBER(TASK6_STATUS);
TASK6_STATUS value is 1+2+4 (this thing i got by replacing the string and lots of stuff) but i need the result after adding these 3 numbers in the string. and i declare COUNT_TASK as NUMBER;and i am very well aware that it gives me the error ORA-06502: PL/SQL: numeric or value error: character to number conversion error
how to add these numbers in my program to get the result 7.
1 error has occurred ORA-06502: PL/SQL: numeric or value error: character to number conversion error
I get the above error when I try to compare the below dates in a Pl/sql process in APEX environment.
Is there a work around for it? or (to_char(V_SERVFROM,'mm/dd/yyyy')) != (to_char(:P29_SERVFROM,'mm/dd/yyyy'))
I created table Contains then following columns
cheq varchar2(50)
date_due varchar2(50)
and data entry in this columns
cheq 500,1500,5000 all values numbers in this columns
date_due 1-1-2012 , 15-9-2010 all values in this columns date
i want sum the column "cheq"
when used this code but it's not working
select sum(to_number(cheq))
from table_name but the code not working
second column "date_due"
i want search between to date i used this code but also not working
select cloumn1,cloum2
from table_name
where to_char(date_due,'dd-mm-yyyy')
between to_char(date_due,'dd-mm-yyyy') and
(date_due,'dd-mm-yyyy')
but not work
One table ACCOUNT_T.CREATED_T is number (38). It is mapped to /ACCOUNT's PIN_FLD_CREATED_T, which is timestamp. ACCOUNT_T table has one record, CREATED_T = 1362063600. This field is displayed at the GUI (Customer Center) as Feb 28, 2013 So my question, how to convert the number value (1362063600) to a date value (Feb 28, 2013)?
View 4 Replies View RelatedI would like to convert a number to years & months.
e.g. 119 = 9 years and 11 months
This would be displayed as 9.11
Is there an oracle function or sql that can calculate this value,
I have to convert the following
3.3767E+14
4.40453E+15
4.40453E+15
into
337670137917014.00
4404530588226230.00
4404530588226230.00
Any function or formula for this one?
I want to convert a number to this format using below query but i'm getting error. how to correct the below query.
SELECT TO_CHAR(12345678, '99G9999D99') FROM dual;
error:-###########
I have year/quarter number field (200903 3-rd quarters of 2009) and I need to convert to data format.
View 5 Replies View Related