473,324 Members | 2,531 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,324 software developers and data experts.

oracle sql

can anyone tell me any example of implicit conversion from date/number to
char data-type in case of assignments in ORACLE SQL..????

send me reply at [REMOVED]
Jul 20 '08 #1
1 1570
Dave44
153 100+
oracle will make implicit conversions when it needs to but it will fall over if that conversion fails (as it should). Even for dates it will make an implicit conversion and if you luck out and have your default date format string match what you give then it will work.

In reality you should code your conversions EXPLICITLY, do not rely on oracle's attempt to convert it for you.

Expand|Select|Wrap|Line Numbers
  1. [125]SQL> SELECT *
  2.   2  FROM   (SELECT '1' my_char
  3.   3          FROM   DUAL)
  4.   4  WHERE  my_char = 1;
  5.  
  6. M
  7. -
  8. 1
  9.  
  10. Elapsed: 00:00:00.04
  11. [125]SQL> SELECT *
  12.   2  FROM   (SELECT 't1' my_char
  13.   3          FROM   DUAL)
  14.   4  WHERE  my_char = 1;
  15. WHERE  my_char = 1
  16.        *
  17. ERROR at line 4:
  18. ORA-01722: invalid number
  19.  
  20.  
  21. Elapsed: 00:00:00.06
  22.  
  23. Elapsed: 00:00:00.07
  24. [125]SQL> SELECT *
  25.   2  FROM   (SELECT trunc(sysdate) my_char
  26.   3          FROM   DUAL)
  27.   4  WHERE  my_char = '23-Jul-2008';
  28.  
  29. MY_CHAR
  30. ---------
  31. 23-JUL-08
  32.  
  33. Elapsed: 00:00:00.04
  34. [125]SQL> SELECT *
  35.   2  FROM   (SELECT trunc(sysdate) my_char
  36.   3          FROM   DUAL)
  37.   4  WHERE  my_char = '20080723';
  38. WHERE  my_char = '20080723'
  39.                  *
  40. ERROR at line 4:
  41. ORA-01861: literal does not match format string
  42.  
  43.  
  44. Elapsed: 00:00:00.06
  45.  
  46.  
Jul 23 '08 #2

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

Similar topics

3
by: Jan Bols | last post by:
I've been trying to install Oracle 8.1.7 on a fresh Mandrake 9.1 O.S for days, but I'm still not able to get it running. I've tried several install instructions that I found on the internet but no...
4
by: susmita_ganguly | last post by:
Hi I am trying to upgrade from oracle 8i to oracle 9i on the same server ..I don't know much abt migration . Can anyone help me out. Thanks. Susmita
63
by: Nick Palmer | last post by:
Hi all, Is there a DB2 equivilant to Oracle's DB Link functionality ? I have two DB2 databases and I need to get access to the tables in one from the other. In Oracle I would just create a DB...
3
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary...
13
by: Chris Botha | last post by:
The machine is running XP Pro with all the latest service packs, etc. I must access an Oracle database so I installed the Oracle client stuff. I can query Oracle from a Windows app, no problem....
2
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers:...
2
by: Ruslan A Dautkhanov | last post by:
Hello ! I'm about to install O9i on FreeBSD box. uname -a: FreeBSD stat2.scn.ru 5.2.1-RELEASE-p3 FreeBSD 5.2.1-RELEASE-p3 #2: Fri Apr 23 19:19:43 KRAST 2004...
0
by: Jack | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
0
by: Winder | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location worldwide. Courseware licensing also available....
0
by: sathyguy | last post by:
when i type the below in my RHEL AS 4's Firefox 1.5 http://appsworld.ncc.com:7777/forms/...&form=test.fmx iam getting the below error... The requested URL /forms/frmservlet was not found on...
0
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
1
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.