Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8455357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:16:01+00:00 2026-06-10T12:16:01+00:00

I am using Oracle and have a table containing a long datatype. I have

  • 0

I am using Oracle and have a table containing a long datatype. I have since discovered that this is legacy and I should have used a LOB. I also now think I could probably just use NUMBER(10,0).

I want to convert the column from a long datatype to a NUMBER datatype.

Here is my SQL so far.

ALTER TABLE BUDGET ADD AMT2 NUMBER(10,0);
UPDATE BUDGET SET AMT2 = AMT;
ALTER TABLE BUDGET DROP COLUMN AMT;
ALTER TABLE BUDGET RENAME COLUMN AMT2 TO AMT;

The AMT columns is LONG
The new AMT2 column is my new column of NUMBER(10, 0)

The problem is that when assigning the long to a number I get an error. This is on the update line (line2) This I presume is because of data truncation.

The error is

SQL Error: ORA-00932: inconsistent datatypes: expected NUMBER got LONG

All the data in the column is less than 10000 so I want to force oracle to ignore any data truncation (because I dont believe there should be any). How can I assign the long data to a number data column?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:16:03+00:00Added an answer on June 10, 2026 at 12:16 pm

    Create a PL/SQL Function to get the Long as the data-type you need.

    Example:

    create or replace 
    function longtonumber( p_rowid in rowid)
    return number
     as
          l_data long;
     begin
         select remarks into l_data from cr_claimheader where rowid = p_rowid;
          return to_number(substr( l_data, 1, 4000 ));
    end;
    

    Then all you need to do is update using this function in your update statement:
    update am1=longtonumber(amt2)…etc.

    I got this from askTom: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:839298816582

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Using Oracle) I have a table with key/value pairs like this: create table MESSAGE_INDEX
using a Oracle 10g db I have a table something like this: create table
I am using Oracle 11g r2 . I have a table that stores images
I have a table in oracle that looks like this: name | type |
I am using Oracle SQL Developer. I essentially have a table of pictures that
I'm using Oracle APEX and I have a report region in a page that
I have a JRuby project that connects to an Oracle database using JDBC via
I have an Oracle account (schema) of a remote Oracle database. By using this
Possible Duplicate: SELECT INTO using Oracle I have one table in my oracle database.
I am using oracle 11g and have a table with an XMLType. There are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.