Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    205

    Unanswered: Unsigned datatypes ?

    Hi,

    Is there anything in Oracle for mysql's unsigned type .

    Eg :

    create table test(sno int(10) unsigned)
    can be given in mysql, wherein the column sno will take the value '0', if the insert value is a negative value.

    Is there any equivalen for the above in Oracle 'or' how the above can be achieved in Oracle ?

    Thanks,
    Sam

  2. #2
    Join Date
    Sep 2003
    Location
    CA
    Posts
    38

    negative number data type

    data type NUMBER(p,s)
    Numbers in an Oracle database are always stored as variable-length
    data. They can store up to 38 significant digits. Numeric data types require:
    One byte for the exponent
    One byte for every two significant digits in the mantissa
    One byte for negative numbers if the number of significant digits is less than
    38 bytes

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    I'm not familiar with this "unsigned" type. Do I understand correctly that it stores positive and zero values as given, but converts all negative numbers to 0?

    If so (how strange!), there is no Oracle equivalent. You could achieve the same with a trigger:
    Code:
    create or replace trigger mytab_mycol_unsigned
    before insert or update of mycol on mytab
    for each row
    when (new.mycol < 0)
    begin
      :new.mycol := 0;
    end;
    /

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •