Converting hex to number & date

Hi!
Im having a problem converting the hex code to the number & date.
select low_value,high_value from ALL_TAB_COL_STATISTICS;
Iv tried HEX_TO_CHAR and that works fine.
select column_name, UTL_I18N.RAW_TO_CHAR(low_value),UTL_I18N.RAW_TO_CHAR(high_value),low_value, UTL_I18N.RAW_TO_CHAR(high_value) from ALL_TAB_COL_STATISTICS where owner = 'user' and table_name = 'table_name';
if you type this statement you will see that numeric fields and date fields get caught up in (¿) type of fields.
Any solution for this?
BR / S-A
Edited by: SweAnderline on 2008-nov-14 12:58

Hi William!
Need your help again.
Iv taken your statement and alterd it a bit.
SELECT c.table_name table_name, c.column_name, c.data_type
, c.histogram
, CASE c.data_type
WHEN 'NUMBER' THEN TO_CHAR(UTL_RAW.CAST_TO_NUMBER(c.low_value))
WHEN 'VARCHAR2' THEN UTL_RAW.CAST_TO_VARCHAR2(c.low_value)
WHEN 'DATE' THEN
RTRIM(TO_NUMBER(SUBSTR(c.low_value,1,2),'XX') -100 ||
LPAD(TO_NUMBER(SUBSTR(c.low_value,3,2),'XX') -100,2,'0') || '-' ||
LPAD(TO_NUMBER(SUBSTR(c.low_value,5,2),'XX'),2,'0') || '-' ||
LPAD(TO_NUMBER(SUBSTR(c.low_value,7,2),'XX'),2,'0') || ' ' ||
LPAD(TO_NUMBER(SUBSTR(c.low_value,9,2),'XX') -1,2,'0') || ':' ||
LPAD(TO_NUMBER(SUBSTR(c.low_value,11,2),'XX') -1,2,'0') || ':' ||
LPAD(TO_NUMBER(SUBSTR(c.low_value,13,2),'XX') -1,2,'0'),':- ')
END AS low_val
, CASE c.data_type
WHEN 'NUMBER' THEN TO_CHAR(UTL_RAW.CAST_TO_NUMBER(c.high_value))
WHEN 'VARCHAR2' THEN UTL_RAW.CAST_TO_VARCHAR2(c.high_value)
WHEN 'DATE' THEN
RTRIM(TO_NUMBER(SUBSTR(c.high_value,1,2),'XX') -100 ||
LPAD(TO_NUMBER(SUBSTR(c.high_value,3,2),'XX') -100,2,'0') || '-' ||
LPAD(TO_NUMBER(SUBSTR(c.high_value,5,2),'XX'),2,'0') || '-' ||
LPAD(TO_NUMBER(SUBSTR(c.high_value,7,2),'XX'),2,'0') || ' ' ||
LPAD(TO_NUMBER(SUBSTR(c.high_value,9,2),'XX') -1,2,'0') || ':' ||
LPAD(TO_NUMBER(SUBSTR(c.high_value,11,2),'XX') -1,2,'0') || ':' ||
LPAD(TO_NUMBER(SUBSTR(c.high_value,13,2),'XX') -1,2,'0'),':- ')
END AS high_val
, c.num_distinct
, c.avg_col_len
, ROUND(c.density,1) AS density
, c.num_nulls, c.nullable
, round(((c.num_nulls*100)/decode(nvl(d.num_rows,1),0,1))) || '%' "Null % of total Rows"
, c.last_analyzed
, d.num_rows "Number of rows in table"
FROM all_tab_columns c, dba_tables d
WHERE c.table_name = d.table_name and c.owner like 'MDB%'
AND c.owner = d.owner
ORDER BY c.table_name asc;
What I cant get to work is my
-- round(((c.num_nulls*100)/decode(nvl(d.num_rows,1),0,1))) || '%' "Null %"
When I execute the statement I get divisor is equal to zero, so I tried to add a nvl if its null then 1, and if its 0 in number of rows then 1.
Iv tried multiple ways to do this but I cant get it to calculate. With the current statement I dont get any results.
I can get it to work if I create a view with this statement and add a specific table_name. But I need to get this to work in the whole schema/user without entering a specific table.
Any ideas what I can do else?
Thx in advance
Cheers

Similar Messages

  • Convert VARCHAR2 into NUMBER

    Hello everyone!
    I am having trouble in converting the variable.
    My original variable is as VARCHAR2. It has database value of
    100-1050-10101-001. How do I convert this into NUMBER data type?
    Thanks,
    Sonya

    SQL> create table test(col1 varchar2(20),col2 number);
    Table created.
    SQL> insert into test values('100-1050-10101-001',null);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from test;
    COL1 COL2
    100-1050-10101-001
    SQL> insert into test select null,replace(col1,'-','') from test;
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from test;
    COL1 COL2
    100-1050-10101-001
    100105010101001

  • How to convert amount data element to number data element

    Dear Gurus,
    I have a requirement to get the data by calling BRF+ and then pass them to BAPI 'BAPI_ASSET_ACQUISITION_POST', in the BRF+ export structure, there is a field 'AMOUNT', I bind it to DDIC element 'BF_ANBTR', the type is Number.
    In BRF+, I call another global function to calculate the value, I define a local variant LV_VALUE to get export value from this function, this local variant's type is Amount, now I need to move this local variant value to the export field 'AMOUNT'.
    But BRF+ doesn't allow to convert amount data element to number data element directly, and I find there is no formula function available. Only there is a function 'TO_AMOUNT' to convert number data element to amount data element.
    Please help to get a solution for above solution.
    Thanks.

    Hi,
    within the formula expression within the category "Mathematical functions" you will find the function "TONUMBER". This converts a data element of type currency to a number. According to the help of this function:
    "The following conversion rules apply:
    <Amount>: The number part is returned. The currency unit is omitted."
    This is what you are looking for.
    For the other way round you already mentioned the correct function "TO_AMOUNT"
    BR
    Christian

  • Help with converting hex to date and time

    Hi!
    I am using snmp4j libraries to walk the mib tree. The system date is getting returned in 11 hexadecimal octets. I require help in converting it to date and time. I looked up the RFC convention of what each octets represent. Require help with conversion.
    Eg: 07:db:06:0a:29:1d:00:2b:05:1e
    Thanks,

    Octets Contents Range
    1-2 year 0..65536
    3 month 1..12
    4 day 1..31
    5 hour 0..23
    6 minutes 0..59
    7 seconds 0..60
    (use 60 for leap-second)
    8 deci-seconds 0..9
    9 direction from UTC '+' / '-'
    10 hours from UTC 0..13
    11 minutes from UTC 0..59
    For example I just took the time an hour ago it came out as
    07:db:06:13:12:11:1a:00:2b:05:1e
    I have to convert this as a date long value to send it.
    Do I have to write an utility of my own to do it?

  • How to convert raw to number in oracle 8

    Does anyone know how to convert a raw data to number format ???
    If i do: select dump(50,16) from dual, it will return bytes c1 33.
    With this bytes in a raw variable, how can i convert it to a number variable in Oracle 8.
    PS: Oracle 8 doesn't have utl_raw.cast_to_number function...
    Thanx.

    Thanx for help... But...
    This examples are very usefull, but only converts a value in HEX to number.
    In my case, i need a routine that convert the bytes of value 50 (i.e. 2 bytes -> C1 33) into a number variable. If i only use hex to number, will return wrong value. I need to convert this bytes (C1 33) into original number, i mean, value 50.
    Using dump function for 50, will return C1 33...
    How can i make to convert C1 33 back to value 50??
    I think that is the same of the utl_raw.cast_to_number, but i'm using Oracle 8, and this function is in Oracle 9...
    Anyone have idea ??

  • Expression Builder: convert string to number

    Hi all,
    I'm having trouble building a field validation rule for bank account numbers.
    The numbers have 12 positions, so I cannot use a string or text number.
    The validation rule to be implemented is that the last two digits are calculated based on the first 10 (modulo 97).
    However, when I use the Mid function to pick the first characters, I am unable to do any calculations on it. Apparently, the string to number conversion doesn't work (it should work when I read the manual, as it says that when using an operator between two data types, the second type is converted to the first (cf. example of 1234+abcd (should result in 1234 as to the manual))). So I tried '1*Mid(...)' or '0+Mid(...)'. Syntactically the expression builder accepts it and I can save it. BUT when I change the particular value on the screen, it gives me an SSO error (not the Field Validation error message I entered).
    Why isn't there simply a function ToNumber (like ToChar)????? How could I workaround this?
    Any input very welcome!
    Frederik

    Apparently, I was a bit confused when typing the first sentence, it should be:
    The numbers have 12 positions, so I cannot use an integer or number data type, but have to use String.

  • Is there a way to convert skype online number cont...

    That was the general question, and here are my details:
    I have had a skype number for many years and it was great, around $5.5 a month to call all phones in North America from my laptop from any place in the world with internet. With time, I had a ccumulated a relatively large number of contacts (name of person or party & their phone number(s)). Now I decided that I finally need a regular "smart" cellphone with an AT &T 10c/minute and no data (that's the only way that I understand is not a rip-off, I'm counting on my really unlimited mobile hotspot to get wifi). Now, the company will have me purchase minutes every 30 days which doesn't look very bad considering that I don't have my wifi all the time.
    The problem I'm having is, how to transfer or convert the name/number list on skype to name/number list on my phone? so I can call the same numbers I used to call on slype with my AT&T minutes?
    Typing the numbers one-by-one to my phone may take days!! so, I figured out that there must be away to do it automatically, rather than manually.
    Any help is very appreciated

    Is there any answer skype people?????
    please!

  • Problem in converting the String to Date with time zone GMT

    Hi,
    When I tried to convert the string 12/05/2009 to Date, the time zone is set to BST.On the other hand, for the date 12/12/2009, the time zone is set to GMT. What should I do to get the time zone as GMT all the time.?
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    String dateString = "12/05/2009";
    System.out.println(myDate.toString());

    I think you are all missing the point. java.util.Date objects always alway always store the date as the number of milliseconds since 1/1/1970 UTC so the only TimeZone they have its the implicit UTC. When you use the Date.toString() method the toString() method gets the default time zone from your environment and formats the data accordingly. This means that the same Date object will, by default, produce a different result for France and Australia and the US.
    So, if you have the date "12/5/2009" as a String then to convert it to a java.util.Date you must specify what TimeZone is implied. If it is your system time zone then you can just create a SimpleDateFormat object with the correct format and then use the parse() method to create the java.util.Date object and this will automatically be converted to UTC. If the date String represents some other time zone then you must explicitly set the time zone of the SimpleDateFormat object before parsing the string.
    The same approach applies when converting a java.util.Date object to a String. If you want anything other than your system time zone then you must explicitly tell the SimpleDateFormat what time zone you want the result formatted for.

  • Ho to Comapre with Number Data Type

    hi
    My reqt is to do validation in ValidateEntity Method.
    How to compare the with Number Data type:
    For ex: Number a = gatAbc();
    If(a>10)
    throw new oaExcption...
    But while comapring i got compiler Error
    Error(218,17): method >(oracle.jbo.domain.Number, int) not found in class abc.oracle.apps.per.irc.pqr.schema.server.XxabcEOImpl
    So plz tell me how to compare the integer value with Number data type
    Thanx

    Check with float. It will work definitely.
    float number = Float.parseFloat(HrsPerDay); //HrsPerDay is a String and I am converting it to float
    if(( number <= 0) || (number >= 21))
                            throw new OAAttrValException(OAAttrValException.TYP_VIEW_OBJECT,
                                              "xxCopyResourceVO1",
                                              rowi.getKey(),
                                              "NoOfCopies",
                                              rowi.getAttribute("NoOfCopies"),
                                              "PA",
                                              "xx_xx_COPY_POSITIVE_NUM");
                       }Here in this code i am also checking that the Hours cannot be less then 0 and greater than 20.
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Convert time to number and number to time

    I'm using SAP 4.0b
    I'm looking for function that converts time to number and number to time.
    Any suggestion?

    Hi,
    Can you give an example of what number you want to give to get what time and vice-versa?
    There can be a direct conversion between an integer and a time variable in ABAP.
    For example -
    data: number type i,
          time type syuzeit.
    number = 3600.
    move number to time.
    write time.
    The time will be output as "01:00:00". That is because 3600 seconds make up one hour.
    Regards,
    Anand Mandalika.

  • About Number Data type

    Hi All,
    I have few issues with "Number" data type
    1) trying to convert string "0.0000007" to Number i am getting value with exponential (1e-7). This is only when we have more than 5 0's after decimal.
    2) If i try to do below calculation, i am not getting exact value:
    ex: 999999.999999+999999999999=1000000999999-999999999999 = 1000000(expected should be:999999.999999)
    0.3*6=1.79999998 (exact value: 1.8)
    Please let me know what might be the issue......
    Thanks in advance to all....

    That's standard behavior for floating point.  If you search the forum for
    past discussions of floating point and Number you'll see explanations why.
    To get displayable strings, use toPrecision or toFixed

  • How to convert exponent to number format

    Hi,
    how to convert exponent to number format.My column is in number and the data is in exponent format .for example  data is 2.44705130197009E18 .when i do field name haveing this data like
    select * from table name where filed name =2.44705130197009E18 ,field name  is of number (20) data type .but i am not getting any data fectched .
    your advice is at most appriciated .
    Regards,
    Suja

    Example of what I was saying...
    SQL> create table myexp (name number);
    Table created.
    SQL> insert into myexp values (2447051301970090001);
    1 row created.
    SQL> select name from myexp;
          NAME
    2.4471E+18
    SQL> col name format 9999999999999999999999999999999999999
    SQL> select name from myexp;
                                      NAME
                       2447051301970090001
    SQL>
    The number you are seeing as an exponent is not just the number that is stored with lots of 0's on it, there's other information you are missing, so you need to change your format to see the true value.

  • Converting hex to dec

    Hi everybody,
    I want to join this two numbers and convert them from hex to dec. I have tried using joint and conversion but I still couldn't work it. In the following screen shot I took it suppose to be 3E8 in hex which equals to 1000 in dec. I need suggestion from you how to approach this.
    Thanks
    Solved!
    Go to Solution.

    SOBGA wrote:
    As I was reading all the answers about converting Hex to Dec,I found out that many of you are making it so complicated.To make it easier for a learner or beginner,this is what it takes:
    Open a blank VI
    Click on numeric control
    Right click on the same numeric control
    Scroll down to "Representation"
    Click on "U8"
    Go to numeric indicator and repeat step 4 and 5
    Then right click again on numeric control
    Scroll down to "Properties" and click
    Click on "Data entry",if necessary,change the minimum and maximum
    Pass to "Display format" 
    Click on "Hexadecimal" then you are done.The rest is to go on the block diagram to wire the numeric control to the numeric indicator and it works.
    You can do the same process reverse for dec to hex.But you must know that what we did for "numeric control" on (Hex to Dec) will be done to "numeric indicator" on (Dec to Hex).This same process can apply to octal and binary without the use of complicated array,string while loop and so on...
    I'm a beginner in Labview and I understand that you need to explain more to understand better.
    If you really read all of the comments, you would see that Altenbach already stated this (saying it is just a cosmetic property for the indicator).
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to convert hex string to time stamp?

    Hello everyone..
    I am currently working on a project in which I have to read the data from a unit and display that data using LabVIEW. I am using serial communication for reading the data. The read data is in hex format. 
    Now, I want to convert this hex string to a time stamp value. I am reading total 16 bytes. How to convert this hex data to a time stamp value. I have developed a VI. But I want to know that the displayed time stamp is correct or not? Or suggest me some other solution. 
    I am using LabVIEW 2011.
    Thanks & Regards,
    Manisha
    Attachments:
    Test.vi ‏7 KB

    Hi mancan,
                      As Iam using LV2009 Iam unable to open your example.Anyway for converting hex to time stamp
    Thanks as kudos only

  • Migrate SqlServer BigInt DataType to Ora Number data type - customizable ?

    Hello,
    i'm trying to migrate a sql-server 2005 db to oracle 10 using Sql-Developer v 1.2.0.
    Every column having datatype bigint is converted to a Number(10,0) column.
    Is it possible to customize this convertion cause i would like to have a Number(19,0) column ?
    Thanks in adavance !

    SQL> desc emp_test;
    Name                                                                                Null?    Type
    EMPNO                                                                                        NUMBER(6)
    ENAME                                                                                        VARCHAR2(20)
    JOB                                                                                          VARCHAR2(9)
    MGR                                                                                          NUMBER(4)
    HIREDATE                                                                                     DATE
    SAL                                                                                          NUMBER(7,2)
    COMM                                                                                         NUMBER(7,2)
    DEPTNO                                                                                       NUMBER(2)

Maybe you are looking for

  • With draw... class

    i use swing to make applet. I use filloval, drawRectangle,..... to make draw. But i need the oval, rectangle taht i did to be movable (ex.: like when you move a shortcut on your desktop, you create it, but you can always move it on the desktop). I wa

  • Move iphoto library with albums from imac to a new macbook proac

    I have an approximately 7,000 photo iPhoto library that I want to move from an older iMac to a new MacBook Pro. I want to do it completely to that albums I have already structured are retained. Can I do this and if so, what is the best way. The older

  • Activated LabVIEW 8.6 and now Labview 7.1 won't run

    Hello folks, I have a development computer that has had LV7.1 and LV8.6 installed on it for several months; however, I have only used LV7.1 because LV8.6 was not activated...until yesterday.  Now LV7.1 will not run, and the symptoms are as follows: W

  • Using Automator

    Hi Guys I have been using Tiger for well over a year now and I still have no idea what 'Automator' really does and how it works. I was wondering is it possible to automate the following task: I want to be able to get an application called 'NetSherd X

  • Check box script help please

    I'm going to give this one more try. I have been trying to get the script below to work to have a check box make a text field visable and hidden when it's checked and unchecked. if (checkbox.rawValue==1)      textbox.presence="visable" else      text