473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Convert LONG format to DATE or CHAR

The source table has tbldate formated as long and I want it to be date.
I've created another table and set the correct format and have tried to convert to date or char, but I continue to get error messages when I execute my Insert SQL.


TO_DATE(TBLDATE) gives me this message.
ORA-00932: inconsistent datatypes: expected NUMBER got LONG

TO_CHAR(TBLDATE) gives me this
ORA-00932: inconsistent datatypes: expected CHAR got LONG

How do I get rid of the LONG format?

ORACLE 10g TOAD 9.1
Oct 11 '07 #1
2 67080
amitpatel66
2,367 Expert 2GB
The source table has tbldate formated as long and I want it to be date.
I've created another table and set the correct format and have tried to convert to date or char, but I continue to get error messages when I execute my Insert SQL.


TO_DATE(TBLDATE) gives me this message.
ORA-00932: inconsistent datatypes: expected NUMBER got LONG

TO_CHAR(TBLDATE) gives me this
ORA-00932: inconsistent datatypes: expected CHAR got LONG

How do I get rid of the LONG format?

ORACLE 10g TOAD 9.1
Oracle will not allow you the convert the data type LONG (2 GB or more) to CHAR (2000 bytes).
Oct 12 '07 #2
amitpatel66
2,367 Expert 2GB
You can convert LONG to CHAR using PLSQL block:

Check out below code that is used to select the LONG value in to VARCHAR2 variable:

Expand|Select|Wrap|Line Numbers
  1. declare
  2. a varchar2(20);
  3. begin
  4. EXECUTE IMMEDIATE 'SELECT b FROM tt2' INTO a;
  5. DBMS_OUTPUT.PUT_LINE(a);
  6. end;
  7. /
  8.  
  9. SQL> /
  10. 01-OCT-2007
  11.  
  12. PL/SQL procedure successfully completed.
  13.  
  14.  
Oct 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Num | last post by:
Hi all, I have to convert a J2EE date as a long ("Millis") in a .NET date as a long ("Ticks") In Java, currentTimeMillis, is the difference, measured in milliseconds, between the current time...
1
by: faktujaa | last post by:
Hi, I have date in a string format like string strDate = "110204". Now i want to convert this string to MM/dd/yyyy format. How do i do this???? I used string.Format(strDate, "MM/dd/yyyy") but no...
6
by: John Smith | last post by:
What's wrong with the use of atoi in the following code? Why do I get the error message: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *' char cBuffer; void...
7
by: Nimmy | last post by:
Hi, I have a file which has different dates, I want to scanf them as CHAR and convert them to DATE format, how can I do this? Thanks
0
by: stevag | last post by:
I want to convert a custom date format of the type DD/MM/YYYY into the RFC 822 date format in order to use it for RSS feeds. I want to do this transformation into an XSLT transformation which is...
7
by: wenmang | last post by:
what is format for sprintf to convert long long integer (64 bits) to string?
3
by: funzia | last post by:
Hello! I must convert seconds (long format) into common data format (yy/mm/dd hh:mm:ss). Please help me! Thanks!
1
by: Taka | last post by:
Hi there... The application im writing needs to calculate a persons age(as long) by entering the day, month and year into seperate textboxes. I want the application to calculate the age by using...
2
by: Jcan | last post by:
hi I have a long variable: long id = 0x0457; which in decimal is 1111 I need to convert id into a char array with its ascii values.
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.