How to disable Oracle table NUMBER column type auto round-up

Below is an example,
SQL> create table a
a_col1 NUMBER(8, 2)
SQL> update a set a_col1=1.999 where ...
I found column 'a_col1' of table 'a' value will be 2.00, but the application is for some financial calculation and doesn't allow any difference of the amount value (like, 1.999 <> 2.00), what I want to achieve is to disable the Oracle NUMBER type auto round-up and make above 'update' SQL fail with error, so I can trap the error and handle it in the program.
Could anyone advise me how to achieve above or any good suggestion ? Thanks.

user12317666 wrote:
Below is an example,
SQL> create table a
a_col1 NUMBER(8, 2)
SQL> update a set a_col1=1.999 where ...
I found column 'a_col1' of table 'a' value will be 2.00, but the application is for some financial calculation and doesn't allow any difference of the amount value (like, 1.999 <> 2.00), what I want to achieve is to disable the Oracle NUMBER type auto round-up and make above 'update' SQL fail with error, so I can trap the error and handle it in the program.
Could anyone advise me how to achieve above or any good suggestion ? Thanks.Oracle does not auto-round.
you have data presentation problem; not data storage problem.

Similar Messages

  • How to use Oracle Table Type values in Select Statement.

    Hi,
    I am fetching initial set of values into Oracle Table of Records Type and want to use list of values in the Select statement.
    For example, try something like the following:
    TYPE t_record IS RECORD (
    ID TABLEA.ID%type,
    NO TABLEA.NO%type,
    v_record t_record;
    TYPE t_table IS TABLE OF v_record%TYPE;
    v_table t_table;
    -- Code to populate the values in v_table here.
    SELEC ID,NO, BULK COLLECT INTO <some other table variabes here> FROM TABLEA
    WHERE ID IN v_table(i).ID;
    I want to know how to use the values from Oracle Table Type in the Select Statement.

    Something like this:
    create or replace type t_record as  object (
    id number,
    no number
    CREATE or replace type t_table AS TABLE OF t_record;
    set serveroutput on
    declare
      v_table t_table := t_table();
      v_t1 t_table := t_table();
    begin
      v_table.extend(1);
      v_table(1).ID := 1;
      v_table(1).No := 10;
      v_table.extend(1);
      v_table(2).ID := 2;
      v_table(2).ID := 20;
      SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
      from TableA
      FROM TABLEA
      WHERE ID IN (select t.ID from table(v_Table) t);
      for i in 1..v_t1.count loop
        dbms_output.put_line(v_t1(i).ID);
        dbms_output.put_line(v_t1(i).No);
      end loop;
    end;
    /Untested!
    P;
    Edited by: bluefrog on Mar 5, 2010 5:08 PM

  • How to export oracle table?

    Does anybody knows how to export oracle table into sql format? I know by using PL/SQL Developer can do it,but I have a table,it contains a column,it's type is LONG,PL/SQL can't export it! How to export long type table into sql format?
    Any idea will be appreciated!

    My table structure is follows:
    create table MyDates
    COL1 LONG,
    COL2 VARCHAR2(20)
    In column col1,I store some date in it,then I want to export this table,but I don't want to export this table into dmp file,I only want to export this table' structure and export it into SQL File,such export filename is mydata.sql
    I don't know how to export this table's structure? Because it contains LONG type column.How to export it? By the way,would you tell me how to export other type table,such as it contains column type is blob?

  • How to disabled autocreate-tables?

    Does any konw how to disabled autocreate-tables? oc4j standlone version 10.0.3 .
    Modify application.xml file ,set autocreate-tables=false,Still create tables in database automatically.
    Thanks in advance

    Does any konw how to disabled autocreate-tables? oc4j standlone version 10.0.3 .
    Modify application.xml file ,set autocreate-tables=false,Still create tables in database automatically.
    Thanks in advance

  • How to track changes in text [column type]  changes in MDM

    Hi,
    How to keep track changes in Text[column type] in MDM tables.Is it the only way that I have to declare it as Name field?

    Hi,
    You keep track of changes for a field by enabling change tracking for that field in MDM.  This functionality is available in the MDM Console. 
    For more information  please have a look at the MDM Console Reference Guide -> Part 4: Repository Maintenance -> Other System Tables -> Change Tracking Table
    The MDM Console Reference Guide can be found in http://service.sap.com/instguides -> SAP NetWeaver -> Release 04 -> Operations -> SAP MDM -> MDM 5.5 SP02 - Console Reference Guide
    Hope this helps,
    Richard

  • How to disable sorting for some columns in a ALV GRID?

    Hi i have requirement where I have to disable sorting for some columns in a ALV GRID. i am using REUSE_ALV_GRID_DISPLAY function module.
    Can anybody help me. how to acieve this? Any code snippets will really be appreciated.

    Hi,
    I have tried this but not completely successful. I think this can be done using the OOPS method.
      DATA: it_event_exit TYPE  slis_t_event_exit.
      DATA: w_exit TYPE slis_event_exit.
      w_exit-ucomm = '&ODN'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      w_exit-ucomm = '&OUP'.
      w_exit-before = 'X'.
      CLEAR w_exit-after.
      APPEND w_exit TO it_event_exit.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program          = w_repid
          i_callback_top_of_page      = 'ALV_TOP_OF_PAGE'
          i_callback_html_top_of_page = 'ALV_HTML_TOP_OF_PAGE'
          i_callback_user_command     = 'USER_COMMAND'  <- User command form
          is_layout                   = wm_layout
          it_fieldcat                 = wt_fieldcat
          it_events                   = i_events
          it_event_exit               = it_event_exit    <- Need to fill
          it_sort                     = wt_sort
          i_default                   = 'X'
    Now you can capture this events in the user command
    FORM user_command  USING r_ucomm LIKE sy-ucomm
                             rs_selfield TYPE slis_selfield.
      IF r_ucomm = '&OUP' and rs_selfield-SEL_TAB_FIELD = 'Your field name'.
      ENDIF.
    ENDFORM.                    "user_command
    In this form you will get the function code in 'r_ucomm' and the field selected for sorting in 'rs_selfield-SEL_TAB_FIELD'. But reseting 'r_ucomm' will not work.
    May be somebody else can give some help on this.
    But this will work if you follow the oop method.
    Please see this document for more info.
    http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
    Thanks
    Vinod

  • How to export Oracle tables and data to mySQL

    Hi,
    I am new to Oracle.. and would appreciate all help on the issues below.
    Currently, we have Oracle8i on HP-UX, and Oracle8i on IBM-AIX. We would like to be ble to browse the information on the web, thus, a decision to use mySQL as the web database was made. In order to achieve the above, we need to perform the following:
    1) Export Oracle tables to mySQL, from both the HP-UX and IBM-AIX machines.
    2) Include an additional column to the tables that need to be exported from Oracle to mySQL.
    3) Implement the export as a daily extraction that will run at a certain time of the day.
    How may I achieve the above?
    I have just installed the Oracle Enterprise Manager... will this have any help to the above???
    Appreciate all help given... greatly appreciated!
    Thanks and Brgds,
    Alicia

    I'd first make sure you really need to create a separate database just for making the data available to the web. The web application you create could just as well query the existing Oracle databases. You don't necessarily have to create a separate database just to display info over the web.
    Secondly, if you still want to create a separate database, I'd also question the use of mySQL. In my opinion, mySQL is not a relational database. It acts like a relational database; you can query it via SQL. But because of all the features which mySQL says it does not support yet, I don't consider it to be a true RDBMS. This may not be an issue in your case since you're using it just for read access. Still, I'd take a long look at the list of feature mySQL does not support and make sure you can live with those limitations.
    Also, if you create a separate database for the web app and use Oracle for that database instead of mySQL, you could use Oracle's built in data replication to automatically refresh the web db from the existing db
    If you conclude that you still want to create a separate database for the web app and use mySQL I think you'll have to write some code to support the interface between the dbs (but hey, I'm a developer). The reason I say this is because it sounds like you're merging data from two databases into one and you may even be merging data from two separate databases into a single table of the new web database. If this is the case, simple data extract utilities will not be sufficient. Also, it sounds like the new column added to the web database may not be able to be populated from existing data. And then there's the question of what you need to do with the existing web data each time you run the data extraction ? The easiest case is that you'll always add data to the web db from existing db. If you have to purge the web db first and then refresh it with existing data then there's another step in the process. Overall, writing code to support an interface like this gives you complete control over the process and provides a lot of flexibility in how it is run. In my experience, there are usually new requirements added to the interface as time goes on. The code based approach can deal with changing requirements. The tools approach eventually falls short.
    One other issue to keep in mind is how to protect your existing database while exposing your web database to the Net. Since you need to support an automated interface between the two systems, you'll need to provide a path between the two databases without letting Net users gain access to your internal database. Some serious network security issues to resolve here, but I'm not a network admin.
    hth,
    Frank
    Hi,
    I am new to Oracle.. and would appreciate all help on the issues below.
    Currently, we have Oracle8i on HP-UX, and Oracle8i on IBM-AIX. We would like to be ble to browse the information on the web, thus, a decision to use mySQL as the web database was made. In order to achieve the above, we need to perform the following:
    1) Export Oracle tables to mySQL, from both the HP-UX and IBM-AIX machines.
    2) Include an additional column to the tables that need to be exported from Oracle to mySQL.
    3) Implement the export as a daily extraction that will run at a certain time of the day.
    How may I achieve the above?
    I have just installed the Oracle Enterprise Manager... will this have any help to the above???
    Appreciate all help given... greatly appreciated!
    Thanks and Brgds,
    Alicia

  • How to get oracle 9i blob column into an itab  in sap using Native SQL

    Hi ,
    We are using SAP ECC 5.0  and we need to coonect to an oracle database ver 9i rel2.
    We need to get the data stored in a blob(pdf/jpeg) into an itab and later
    use it for futher processing.
    I am familiar with using native SQL and I wrote a stored procedure in the non sap oracle database to send the blob info into an internal table in sap.
    But the information is in hex format and the long raw of SAP does not handle this very well.
    Plz see my code below.
    data: itab_insp_drawing like zpicture_cluster(which is of type lraw - 7902 )
          occurs 100 with header line.
    EXEC SQL.
        EXECUTE PROCEDURE
           proc_get_insp_drawings  (
                   IN  :itab-aq_id,
                   IN  :itab-section_id,
                   IN  :t_in_position,
                   out :itab_insp_drawing-picture,
                   OUT :t_blob_length,
                   out :t_out_position,
                   OUT :t_status  )
       ENDEXEC.
      append itab_insp_drawing.
      while t_out_position < t_blob_length.
       EXEC SQL.
        EXECUTE PROCEDURE
           proc_get_insp_drawings  (
                   IN  :itab-aq_id,
                   IN  :itab-section_id,
                   IN  :t_in_position,
                   out :itab_insp_drawing-picture,
                   OUT :t_blob_length,
                   out :t_out_position,
                   OUT :t_status  )
       ENDEXEC.
       append itab_insp_drawing.
       endwhile.
    Any ideas of how to handle blobs from non sap oracle table. I need this blob into an itab in sap.
    Help appreciated.
    Thanks
    Mala

    Please refer the example in this link which deals with Oracle date format.
    You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
    Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

  • Oracle Views with Column type as CLOB

    I have a table which has a column of type CLOB. I am trying to creating a view which has all the columns of that table.
    I get
    Warning: View created with compilation errors.
    SQL> show errors;
    No errors
    Can any one help me how to create a view on a table wihich has a CLOB/BLOB column types. Also how to select the clob data from the view
    sree

    Are you the owner of the view you created?
    Check out the documentation for the SHOW command.
    If you omit schema, SHOW ERRORS assumes the object is located in your current schema.

  • How to disable numbers in a text type or field ?

    Hi,
    Any option of disabling numbers in a text type or field ? For E.G. in the PO header text can we prevent users from entering number or values ?
    Thanks.

    No, not without own programming

  • How to create Oracle Table in DWB from Oracle external table

    Dear all,
    I have create Oracle External Table by using DWB. Kindly tell me steps that how could i able to import this external oracle table into internal oracle table now.
    When I deploye this External table message arise "Name is using by an existing object.
    any help would be ppreciated.
    Thanks

    In your database is there a table already existing with the same name as your external table? If there is then you can try and rename your external table in OWB and then deploy it again.
    Then you can create a mapping with your source as the External Table Operator and the target as a Table Operator. When you run the mapping the data from the external table will be imported into the oracle table.
    I hope this helps.
    Regards
    GB

  • How to display oracl.sql.NUMBER in the debugger?

    Hi,
    I would like to use oracle.sql.NUMBER for various reasons.
    Unfortunately, I found no way to display in the JDev debugger
    the actual VALUE that is represented by an oracle.sql.NUMBER object.
    Is this really not possible or am I missing something here?
    Thanks for any hints.
    Marcel

    Hi Steven,
    I get the following warnings and errors if I use oracle.jbo.domain.Number
    in a SQLJ-Class (using JDev 3.1.1.2):
    Warning: (39) Invalid CustomDatum implementation in oracle.jbo.domain.Number:
    missing the factory method getFactory.
    Error: (39) Nicht unterst|tzter Java-Typ f|r Host-Element SeqNr (bei Position #1):
    oracle.jbo.domain.Number..
    Error: (66) Nicht unterst|tzter Java-Typ f|r Host-Element SeqNr (bei Position #1):
    oracle.jbo.domain.Number..
    I translate the last two error-messages to english:
    Unsupported Java-type for host item SeqNr (at Position #1)
    So now I am caught, I can't debug with oracle.sql.NUMBER, and I can't compile
    with oracle.jbo.domain.Number.
    Anyway, could you please convince the JDev-debugger team that the oracle.sql.NUMBER
    needs to be displayed in the debugger as nice as its jbo twin. Without this
    capability, this class is (at least for me) nearly useless.
    Thank you for your support.
    Marcel

  • How to use temporarly table wid record type

    Hi,
    how to use temporarly table wid the record type wid this example
    declare
    type empcurtyp is ref cursor;
    type rectype is record (veid t.emp_id%type, vename t.ename%type);
    TYPE tabtype IS TABLE OF rectype;
    empcv empcurtyp;
    vtab tabtype;
    begin
    open empcv for select emp_id,ename from t;
    loop
    fetch empcv into vtab;
    exit when empcv%notfound;
    dbms_output.put_line(vtab.vename||vtab.veid);
    end loop;
    close empcv;
    end;
    here we hav table t and i m taking only two fields of the table t which r emp_id and ename.

    Try this
    declare
    type rectype is record (veid t.emp_id%type, vename t.ename%type);
    type empcurtyp is ref cursor return rectype;
    TYPE tabtype IS TABLE OF rectype;
    empcv empcurtyp;
    vtab empcv%rowtype;
    begin
    open empcv for select emp_id,ename from t;
    loop
    fetch empcv into vtab;
    exit when empcv%notfound;
    dbms_output.put_line(vtab.vename||vtab.veid);
    end loop;
    close empcv;
    end;

  • How to disable autocreating tables...

    Using Oc4j 9.0.3. When deploying the ear, oc4j goes about creating tables. How to disable that (the tables to map to is allready defined)

    Hi,
    Edit j2ee\home\config\application.xml and change the attribute autocreate-tables="true" in <orion-application>
    to autocreate-tables="false"
    This should stop OC4J from autocreating tables
    Hope this helps,
    Thanks,
    Neelesh Shastry
    OTN Team @ IDC

  • How to get oracle table occupied size

    Hi,
    Actually my task is arrange to get an oracle table occupied size for a particular schema.
    I have an query to get allocated table size,the query as follows
    SELECT SEGMENT_NAME,sum (BYTES)/1024/1024 FROM user_SEGMENTS WHERE segment_type='TABLE' group by segment_name order by sum(bytes) desc;
    But actually i need to get "how much space occupied for each table in that particular schema"
    Thanks in advance...............

    Do you want this?
    SELECT t.owner, t.table_name, t.tablespace_name,
    (sum(d.bytes)/1024/1024) table_size
    FROM dba_segments d, all_tables t
    WHERE d.segment_name = t.table_name
       AND d.segment_type = 'TABLE'
       AND t.owner = 'SCOTT'  --- you can change or delete this condition
    GROUP BY   t.owner, t.table_name, t.tablespace_name;

Maybe you are looking for