Oracle data type for a bit column

I want to add a new column to my table, but I can't seem to find any data type in oracle. the only data on the ground will be 1 or 0. What is the best type of data to use?

Also, is this correct SQL to add a new 'flag' titles to the table tblLocations:

ALTER TABLE tblLocations
Bit flag ALTER COLUMN

Thank you
Mark

user8721624 wrote:
Also, is this correct SQL to add a new 'flag' titles to the table tblLocations:

ALTER TABLE tblLocations
Bit flag ALTER COLUMN

It should be something like:

 ALTER TABLE tbllocations
 ADD  FLAG_BIT CHAR(1)

I guess you can use the char(1) data type to contain these data. Also, you can create a check on the flag_bit column constraint to ensure that only 0 and 1 can be stored in the column.

I hope this helps.

Kind regards
JO

Tags: Database

Similar Questions

  • Change data type for the column in a table - Oracle 8i

    Team,

    I need to change a VARCHAR2 column in number.

    ALTER table xyz change number abc;

    By giving the above statement, it says I need empty this column before you change.

    I can't change the data type before emptying this column.

    Please indicate any other solution. Give me some suggestions.

    Empty the column for me here BIG task.

    user11081688 wrote:
    I can't change the data type before emptying this column.

    Not according to the documentation:

    You can change the data type of any column or decrease the size of the entire column if all rows in the column contains NULL values.

    Please indicate any other solution. Give me some suggestions.

    You can add another column with the correct data type.

    ALTER TABLE xyz ADD COLUMN def NUMBER;
    UPDATE TABLE xyz SET def = TO_NUMBER(abc);
    ALTER TABLE xyz DROP COLUMN abc;
    ALTER TABLE xyz ADD COLUMN abc NUMBER;
    UPDATE TABLE xyz SET abc = def;
    ALTER TABEL xyz DROP COLUMN xyz;
    

    If I remember correctly, Oracle 8i does not support the change of name of column if this solution is a bit more complicated than 9i and above. Another option would be to create a new table with CREATE TABLE AS... SELECT, drop the old one and rename a new one to the old.

  • Create a table with all kinds of oracle data types?

    Hello
    who can give me a small example to create a table with all kinds of oracle data types? and the example to insert it?

    Thank you
    Roy

    Hello

    Read the fine manual. It contains examples at the end of the chapter.

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/statements_7002.htm

    I don't know if you know that you can also create your own data types using 'create a type '. So look for examples that are of your interest and not for all types of data.

    Concerning

    Published by: skvaish1 on February 16, 2010 15:33

  • Oracle data type: on storage data as NUMBER of versus BINARY_DOUBLE?

    My request did a lot of scientific computing. The calculation uses double-precision variables in C and Java (both based on IEEE 754).

    If my goal is to store these variables in Oracle 11.2 G database between the calculations, such as the value read FROM the database is an exact match with the value that is used to write to the database, would you recommend store variables as an Oracle Data Type of NUMBER of DOUBLE BINARY?

    And, why?

    Here, I am only concerned about the accuracy (speed or storage).

    918175 wrote:
    Same double precision in Java and C have figures largely exceeded 17 (decimal) (I forgot the exact number of digits, but he has more than 30 years). I guess what I mean is accurate with respect to the first 17 digits (decimal), as the others have little or no effect in calculations.

    If you care just the 17 first decimal digits being the same after the persistence of data, it should not matter if you use NUMBER or BINARY_DOUBLE (or RAW). I prefer strongly NUMBER or BINARY_DOUBLE because then, you can use data outside your application in the future if someone wants to write a report.

    Justin

  • What the best data type for storing jpeg/gif images?

    Hello
    What the best data type for storing jpeg/gif images?
    Idon't want to use the blob data type
    Ordimage is the best?
    Thank you.

    VDH says:

    What the best data type for storing jpeg/gif images?
    Idon't want to use the blob data type
    Ordimage is the best?

    Don't be stupid.

    If you do not want to use BLOBs then, or you can use the ordimage.

    It uses ordsys.ordsource for the storage of the image data type. This is a user defined Type of data in advance and has a property called LocalData that stores the actual image. And what is its data type? BLOB OBJECT.

  • Performance/Oracle data types

    Does anyone know how the data types can affect the performance of SQL queries? I would particularly like to know NUMBER, VARCHAR2, and DATE.

    You use the appropriate data type for the data being stored, end of story. Any hypothetical gains you are trying to do by using a data type 'faster' is deleted by bugs or performance issues using the data.

  • Data selection in UDB where columns were named after the oracle data types

    I have a couple of tables in UDB, I'm trying to reference on a HS db link.

    The first table on the side of the UDB has a column named 'number' (bought the software - not something we did)...

    Selecting this SEO column in this table and more specifically (i.e. Select number, col2, col3 etc) causes the error ORA-00936 (missing expression).

    Select * works...

    The second table also has a column called 'number', so the same problem above applies.  [However, sql errors when I do a select * from ORA-00600: internal error code, arguments: [HO set: look long], [], [], [], [], [], [], [], [], [], []]

    Our dba lean on it, - Oracle HS is new to us, so - I was hoping someone here might have an idea...

    Using oracle 11.2.0.3.0.

    When your DB2 database has column with reserved words in Oracle names, you must create a view of your DB2 side by specifying a different name for this column, and then use DG4ODBC to choose from the scoreboard instead of DB2.

    Another approach which would require an additional programming is to use the DBMS_HS_PASSTHROUGH that allows to make statements that they are to the DB2 database without be analyzed in Oracle.

    As for the ORA-600 error that you get this error is caused when your DB2 table contains certain character inspired columns that exceed the accuracy of the Oracle and are then mapped to the Oracle long data types. Normally in Oracle each table can have a long column. But to be able to select with the gateways of databases foreign this restriction has been slightly improved and more recent Oracle software can choose from the tables that contain more then a long.

    So, could you please be more specific what program you use to select using the gateway fails with ORA-600 and could you please post your description of the table as it is stored in your DB2 database as seen using the gateway in SQL * more: desc (your DB2 table > @)

    -Klaus

  • Data type for special characters

    Hi all

    I am working in Oracle 11 g r2 EE and Linux operating system. We need to insert special characters in table as! @# $.

    What type of data we use for the column.  I used varchar2 (100). .as data type... is this good or any other data type better we have for the storage of special characters.

    create table conv_defp (conv_id varchar2 (100));

    In the conv_id column we want to insert special characters.

    ! @$# are not more special than to abcd

    VARCHAR2 is fine

  • data type for astromical algorithms

    Hello everyone.

    IM using Oracle 12 g of data.

    I have to face a new application where I have to develop a large number of astronomical algorithms, normally calculated them on the speed of the planets, astronomical positions and so forth.

    These algorithms usually have a large number of decimal place, between 10 and 20.

    So, Im trying to find the best types of data, because the accuracy is a must. And these are my doubts...

    Read the tutorial of Oracle it say that the number data type contains all the other subclass of numbers. For example, as I understand it, the integer data type is only one type of data number with some restrictions.

    My question is:

    If I declare a variable as number, this variable will have the same accuracy as a variable declared as binary_double? For example

    Declare

    x number; -Without defining the decimal scale in this way, it can accept the range possible decimal

    x BINARY_DOUBLE:-that class will have the same accuracy as the number of x?

    What is the best way to declare these vars?  by order of accuracy, storage and speed is not so important in this application.

    Regards to all the world and thanks in advance.

    Use the NUMBER unless you have a specific reason NOT to use it.

    See the built-in data types in the doc of the SQL language

    http://docs.Oracle.com/CD/B28359_01/server.111/b28286/sql_elements001.htm#i54330

    2

    NUMBER[ (p [, s]) ]

    Number having precision p and scale s . Precision p may vary from 1 to 38. Wide s can vary from-84 to 127. Precision and scale are in decimal digits. A NUMBER value requires 1 to 22 bytes.

  • Dynamically find the Integer and the Data Type of a Decimal column

    Table: test (INTE number, DECISION number (7.2)) of the

    Try to dynamically determine the type of column.

    Use select user_tab_columns data_type. It returns only the NUMBER that does not indicate whether the column is an integer or a decimal data type.

    Is there a way to dynamically determine whether a column is around or type decimal?

    Thank you

    create table test (INTE, DECI number number (7.2));

    Select column_name, data_type, data_precision from dba_tab_columns where table_name = 'TEST '.

    COLUMN_NAME DATA_TYPE DATA_PRECISION
    ------------------------------ ---------------------------------------------------------------------------------------------------------- --------------
    NUMBER OF INTE
    DECI, NUMBER 7

  • Oracle data type

    In the DDL scripts, I found the NUMBER(*,0) data type. Can someone tell me exactly what that means?

    >
    In the DDL scripts, I found the NUMBER(*,0) data type. Can someone tell me exactly what that means?
    >
    Of course - Oracle can.

    When you have a question like this, always start with the Oracle documentation.

    See "Overview of the numeric data types" in the Concepts Doc
    http://docs.Oracle.com/CD/B28359_01/server.111/b28318/datatype.htm#i16209
    >
    Oracle guarantees portability of numbers whose precision is equal to or less than 38 digits. You can specify no precision and a scale:

    column_name NUMBER (*, scale)

    In this case, the precision is 38, and the specified scale is maintained.
    >
    In the future when you post always ensure your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).

  • determination of the data type of an existing column in a table

    Hello
    I did some googling on this, and I know I've done it before, but I can't find / remember how to determine the data type of a column in an existing table... I have tried select dump (column_name) table, but it didn't work.
    any suggestions?
    Thanks in advance

    data type field in

    select * from user_tab_cols where table_name= and column_name=
    

    Ravi Kumar

  • Conversion of the data type of a table column

    Hello

    I have a column with the varchar2 data type. I want to convert to number data type. But the data in the table are not lost. Can someone suggest me how to convert the column with the varchar2 data type to store the data in the table of number data type.

    Thanks in advance

    try something like this

    create table t(col varchar2(10));
    insert into t values('1');
    insert into t values('2');
    commit;
    select * from t;
    alter table t add  col1 number;
    update t set col1 = to_number(col);
    commit;
    alter table t drop column col;
    alter table t rename column col1 to col;
    select * from t;
    

    Published by: Karthick_Arp on April 6, 2009 12:32 AM

  • Data type for representing €

    Hello

    I want to create, a table, a field that represents money, specifically in €.

    looking on the net I found unfortunately that Oracle doesn't have a SPECIFIC type to represent money in euros or dollars.

    My idea was to use a NUMBER type, and then when I put the data try to concatenate the symbol €. But I think that's not possible.

    If I try to use the VARCHAR2 instead of the NUMBER type, but although functions for later converted to NUMBER, I have with that is not very professional and loses the functionality


    What would recommended you?

    Thank you. Concerning

    You can store your number, such as salary value.
    Show the euro sign is a problem with the output screen, and you can get it in the query that retrieve data from db: TO_CHAR (salary, 'L999G999D99')
    L as currency.
    To learn more:
    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions181.htm#SQLRF06130

    Nicolas.

  • How 2 call a procedure with the data type for the parameter Ftree.NODE

    Hello

    in this link
    http://Andreas.Weiden.ORCL.over-blog.de/article-29307730.html


    Down in the page after you run the package, I created the procedure and it compiled successfully but when call PR_WTNS in trigger WHEN-TREE-NŒUD-SELECTED

    PROCEDURE PR_WTNE (i_ndNode IN Ftree.NODE);

    as

    PR_WTNE (i_ndNode Ftree.NODE);


    I got the error message; A wrong number or types of argument in the call

    pls I'm stuck can help any one?


    Kind regards

    Abdetu...

    Published by: Abdetu on October 24, 2010 02:36

    Published by: Abdetu on October 24, 2010 02:36

    YKou have to give a variable of type Ftree.NODE when calling this function. If called fromm a WHEN-TREE-NODE-SELECTED-trigger, use: SYSTEM. TRIGGER_NODE

Maybe you are looking for

  • Is there a way to globally disable the cache of Firefox?

    I run a computer lab with several linux PC (Ubuntu LTS 14.04 / latest version of Firefox). The users homedirectories are located on a file server central and limited by a diskquota. Unfortunately, Firefox takes an important part (if not all) of this

  • Watch is not sync old calendarposts

    I just took my watch and I love it, but there is a problem with the calendar synchronization. On the phone to my work, I have a Google Calendar and an Exchange calendar for work, but they do not synchronize right. The only things Google Calendar sync

  • deactivate the fn keys

    I can't go to my BIOS when I restart my computer. I have a laptop HP Pavilion 15, with windows 8

  • I have a printer wireless 5512 and after 6 months he left the impression of black. A tried

    Have 5512 model CQ 180 a. It stopped printing black. Changed the cartridge 2 times, done printhead cleaner, tried to print a form, nothing helps. I'm a novice at this but want to use my printer quickly.

  • I can't run chkdsk to check for a corrupted file

    I want to make it also a small message will appear every 10 seconds in the first minutes after I start my PC. It says "access denied as you have enough privileges." You have to invoke this utility running in elevated mode. "I don't know how to operat