Date problem in oracle 11g

iam New to oracle 11g but familiar with SQL 2005
i have a table Patient which has a column Date_Of_Birth has datatype Date
and iam writing a query in which if Date_Of_Birth column has a value
*01/01/1900* then i should be replaced by *' ' or balnk*
otherwise show date value for that i have made use of
case
query
select case(Date_Of_Birth)-------------this is my column
when '01/01/1900'
then ''
ELSE TO_CHAR( Patient.Date_Of_Birth, 'DD/MM/YYYY')
END Date_Of_Birth
from Patient -------------my table
but error is comming
Error starting at line 1 in command:
select case(Date_Of_Birth)
when '01/01/1900'
then ''
ELSE TO_CHAR( Patient.Date_Of_Birth, 'DD/MM/YYYY')
END Date_Of_Birth
from Patient
Error at Command Line:2 Column:5
Error report:
SQL Error: ORA-00932: inconsistent datatypes: expected DATE got CHAR
00932. 00000 - "inconsistent datatypes: expected %s got %s"
*Cause:   
*Action:
Edited by: user13066438 on Jan 24, 2011 9:38 PM

Hi there
you have date data type in Date_Of_Birth you have to use to_date function
try this
select case((Date_Of_Birth)when to_date('01/01/1900', 'DD/MM/YYYY')
then ''
ELSE TO_CHAR(Patient.Date_Of_Birth, 'DD/MM/YYYY')
END Date_Of_Birth
from table_name;regards
Hitesh

Similar Messages

  • Problem with Oracle 11g(32 bit) installation on windows 7 ultimate edition

    Hello all,
    I have a problem with Oracle 11g(32 bit) installation on windows 7 ultimate edition (32 bit).
    I have successfully installed it immediately after OS installation. But today, i have decided to deinstall it and go for Oracle 10g version for 32 bit.
    Everything went normal during installation, but i can see the services is not present in services.msc. Also its throwing some exception for dbca, netca
    Now i tried to deinstall it and again go for 11g. But even the same story here..
    Can anybody give me a solution for this..
    -Regards
    Rajesh Menon

    Saqib Alam wrote:
    i recently install Oracle 11g R1 on windows 7 ultimate, i installed it and working perfectly.
    ur problem is that u install latest version and now u trying to installing old version.
    now u need to uninstall 10g and delete oracle from services, if the probleme presist then u should
    install fresh windows 7.
    Regards
    SaqibNo need to install a fresh OS. That's like tearing your house down just because you wired a lamp wrong and blew a circuit breaker.
    There are MeaLink notes on how to eradicate an Oracle install from Windows, but it boils down to this:
    Stop all Oracle services
    In the registery:
    - Delete all oracle services from the register (HKLM\SYSTEM\CurrentControlSet
    - Delete the entire Oralce folder from HKLM\Software
    reboot
    Delete the ORACLE_HOME directory and any other Oracle related directories/files. Offhand, it seems like there is an Oracle directory under Program Files.
    reboot

  • Is it possible to perform network data encryption between Oracle 11g databases without the advance security option?

    Is it possible to perform network data encryption between Oracle 11g databases without the advance security option?
    We are not licensed for the Oracle Advanced Security Option and I have been tasked to use Oracle Network Data Encryption in order to encryption network traffic between Oracle instances that reside on remote servers. From what I have read and my prior understanding this is not possible without ASO. Can someone confirm or disprove my research, thanks.

    Hi, Srini Chavali-Oracle
    As for http://www.oracle.com/technetwork/database/options/advanced-security/advanced-security-ds-12c-1898873.pdf?ssSourceSiteId… ASO is mentioned as TDE and Redacting Sensitive Data to Display. Network encryption is excluded.
    As for Network Encryption - Oracle FAQ (of course this is not Oracle official) "Since June 2013, Net Encryption is now licensed with Oracle Enterprise Edition and doesn't require Oracle Advanced Security Option." Could you clarify this? Thanks.

  • Uninstallation problem in oracle 11g

    i have uninstall ed oracle 11g from my computer but still the folder app exists when i delete the folder it is giving me message that cannot delete oci.dll file
    Access Denied Make sure disk is not full, or write - protected and that file is not currently in use
    iam not understanding what is actually happening
    please somebody help

    uninstallation problem in oracle 11g
    Please refrain from posting in multiple forums like this. It's tantamount to abuse of the forums.
    Please mark this thread as answered and continue on in your other thread, where this question belongs.

  • Problem with Export User's data from database oracle 11g

    i want export all user data and Its tables from oracle 11g database, I am using the comand exp, pero export only the tables with data, i Have Some tables and Not Without export data These tables,
    can someone help me!

    problem with zero extent table
    exp is de-supported in 11g. Use expdp instead to export tables without any rows.
    Srini

  • Tns problem with Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools

    I installed the full
    Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools for Visual Studio
    now I am at the good old "[ORA-12154: TNS:could not resolve the connect identifier specified]" error.
    I copied the same tnsnames.ora as used on the db server
    onto the client "C:\Oracle\product\11.1.0\client_2\Network\Admin".
    The host name is right since a normal ping works. TNSping is not available.
    but I get the [ORA-12154: TNS:could not resolve the connect identifier specified] error.
    The listener is running and the instance as well since it all works on the source server.
    I tried it with
    SET path=c:\oracle\product\11.1.0\client_2\bin
    but tnsping is still not recognized.
    sqlplus works on the other hand when I set it to
    SET path=c:\oracle\product\11.1.0\client_2\
    what is going on...

    hey
    u can post your query here, and i think everyone here is to share opinion so do not hesitate to do so and please try to google before posting here,
    and we know no one is expert like some people saying 'boring questions' you just try to overcome your problem and you will definitly get your problem solved .
    some mpeople ar still there who answeres hopeless questions and say nothing about them but when a fresher askin a qustion is not tolarated by them they think everyone is born DBA here
    they always tend to discouraging people here on forums,and i think they are vvolunteers to reduce crowd here on forums, inspite of there experience and people respect them they can not control their anger
    so please post you tns here, i think there are ways to ask people to google and search docs first, but not like this
    thanks and regards
    VD
    Edited by: vikrant dixit on Jun 29, 2009 4:33 AM

  • How to generate TPC-E schema/data sets in Oracle 11g

    Hi,
    I want to use TPC-E schema in my Oracle 11g database (Standard) and also want to use DATA SETS from this benchmark for some kind of testing.
    I've download EGen v1.8.0 from this TPC website:
    http://www.tpc.org/tpce/default.asp
    but don't know who to implement this benchmark database into my computer's database. I'll appreciate if someone please suggest me how to do this...
    Thanks alot.
    Best Regards,
    Kamran

    kamran safdar malik wrote:
    I want to find Optimal size of a data block size as this is the one parameter which can increase the performance of a database or decrease it.If there is a single optimal size, that would surely be the default Oracle block size - as Oracle should know perhaps better than any of us, just what block size differences do as it is their code that uses it?
    Can I ask why you said that you would not have chosen this topic as a thesis?My leaning has always been to expert systems and A.I. Even designed and written my own expert system language years ago. One thing that is critical in such systems is how you structure data - and that has a nice database angle to it. One that I believe can still be exploited for research purposes.
    Don't you think that it'll benefit DBA's or database developer after I reach a successful conclusion?To be honest, in the real world of database systems, the least of my concerns are data block sizes. For example, we're busy putting together a storage array that should have a maximum I/O pipe size of 40Gb. In comparison, we currently use dual 2Gb fibre channels on most of our servers for our I/O.
    Technology moves fast. And perhaps there is an ideal block size for the standard storage array and Oracle instance today - but that could invalidated by new technology next year. Would I want to spend time and effort studying and analysing and researching a very specific technical subject, that perhaps is not considered as of that critical importance by DBAs and perhaps can be outdated with new technology and techniques?
    I honestly do not want to put you off studying db block sizes. Perhaps there's still some critical issues to uncover in that respect. But personally.. there are many other subject areas in database technology that peak my interest a lot more. But then you have your personal preferences and likes and dislikes - and data blocks could be your muse. :-)

  • Sort Order problem in Oracle 11g

    Hi,
    While executing the below query in 10g and 11g, I got different results.
    SELECT loan.Ins_Id,
    ARev.revision,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and ARev.revision=
    (select max(revision) from Acc_REV where Loan_Id =
    (select max(Loan_Id) from LoanAcc where Ins_Id =Ins.Ins_Id
    ) AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Result in Oracle 11g
    INS_ID  REVISION  Acc_ID   Loan_Id
    707      2      312    238
    691      1      312    234
    Result in Oracle 10g
    INS_ID  REVISION  Acc_ID   Loan_Id
    691      1      312    234
    707      2      312    238
    The order in both the cases were different.The order in 11g was not in ascending order.Though the data in both the databases
    is same. Could anyone please tell me why is this happening?. Is there any diffeence in the architecure of ORDER BY (sort) in
    10g and 11g. If I modify the above query by avoiding the subquery I get the correct result(i.e in ascending order).
    SELECT loan.Ins_Id,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and ARev.revision in ('100','101')
    AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Edited by: KZON on Apr 7, 2011 4:46 AM

    Hi all,
    I have modified the query by giving To_Number(ARev.revision) before sub query. Now Oracle 11g returns results in ascending order. But 10g returns results in ascending order with out using To_Number()
    NOte:- Type of ARev.revision is VARCHAR
    SELECT loan.Ins_Id,
    ARev.revision,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and To_Number(ARev.revision)=
    (select max(revision) from Acc_REV where Loan_Id =
    (select max(Loan_Id) from LoanAcc where Ins_Id =Ins.Ins_Id
    ) AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Result
    INS_ID  REVISION  Acc_ID   Loan_Id
    691      1      312    234
    707      2      312    238
    Is there any difference in ORDER BY clause in Oracle11g and 10g ?
    Edited by: KZON on Apr 7, 2011 4:45 AM

  • Failed to get Column's data type in Oracle 11g

    Hi,
    I made an ADO connection(Oracle provider) to Oracle 11g, and use ADO API: OpenSchema(adSchemaColumns) to fetch the columns' info. But I found I couldn't get the column's data type if it's type is timestamp or timestampwithtimezone in database. What I got is 'adIUnknown' whose number is 13.
    I test with another column whose data type is 'date', and everything is ok. I get the data type 'adDBTimeStamp'.
    This issue occurs on Oracle 10g, too.
    Can anyone offer some help? Thanks a lot!

    See
    http://www.oracle.com/technology/tech/windows/odpnet/index.html
    http://download.oracle.com/docs/cd/B28359_01/win.111/b28431/using.htm#CHDJJDAJ

  • Potentialy serious problem with Oracle 11g R1

    Today i have download to try Oracle 11g , my system supports database system
    requirerments and into installation progress my antivirus software find some troyan horses and my antivirus software is ordinary not powerfull .Do someone have the same problem?

    Yes, Trojan found in ott.exe. I believe this may be a false alarm because of its filename, which is the name of a known malware. Only some antivirus detected it.
    Since it's just one file, use whatever your antivirus has for isolating it, or just delete it.

  • Enforce date datatype in oracle 11g

    Can I restrict database so that application can not enter date data in certain format.
    E.g. If I want that date enter should be registered in [year to minute] 'MM-DD-YYYY' hh:mm' only format and not in [year to second format]'MM-DD-YYYY' hh:mm:ss' then how I can do it in Oracle 11g.
    Currently I am using oracle sql developer to create data model and then I want to generate DDL from that to generate database. Is there is any facility in Oracle SQL developer to enforce format specification.
    thanks!

    This is not really related to SQLDeveloper, so you may find better answers in another forum but I'll try to give you an idea anyway.
    Actually the DATE datatype has no format, you use a format when you convert it to a string or vice versa, but the DATE itself is just a DATE.
    You could probably create a trigger to truncate your data as you see fit, but IMHO your best option would be to remove the seconds from your output queries using something like
    TO_CHAR(YOUR_DATE_FIELD,'MM-DD-YYYY HH24:MI')you can also set this output format for SQLDeveloper in
    Tools -> Preferences -> Database -> NLSbut this will work only for SQLDeveloper, it's up to you to determine the best way of setting the output/input date format in your specific application.

  • Anyone inserted data directly from Oracle 11g to MySQL?

    Hi There,
    We work mainly on Oracle 11g. However, there is a requirement to now connect to an external MySQL database from our company's Oracle Database. Would be trying to do this for the first time. The process would be to download the data using PL/SQL from the ORacle 11g DB and then insert the data into the MySQL DB table. Had a few questions,
    1. Are there any known issues with connections between ORacle as source and MySQL as target. Anything that needs to be kept in mind?
    2. How do we send the data to MySQL, I mean in PL/SQL we can have the procedure create the insert statements. But can we directly fire the insert on MySQL ? If yes, any suggestions on what the commands would be?
    3.Any way to figure out if the insert was successful?
    4. We might also have to do other operations like update/delete etc.
    5. Any possible reference or sample code on this would also help.
    Thanks

    Well, the simplest and most direct approach would be to create a java function in the database to perform the operation and call it from pl/sql. I've done it before and there are examples out there and its a pretty straight-forward process.
    A quick example from [this website|http://w2.syronex.com/jmr/edu/db/oracle-and-java]
    import java.io.*;
    import java.sql.*;
    public class OraThin {
      public static void main(String[] args) {
        try {
          Connection con=null;
          Class.forName("oracle.jdbc.driver.OracleDriver");
          con=DriverManager.getConnection(
            "jdbc:oracle:thin:@machine_name:1521:database_name",
            "scott",
            "tiger");
          Statement s=con.createStatement();
          s.execute("
            INSERT INTO BOOKS VALUES
            'A Tale of Two Cities',
            'William Shakespeare',
            4567891231,
            '5-JAN-1962'
          s.close();
          con.close();
       } catch(Exception e){e.printStackTrace();}
    }Check out Oracle's Java tutorial at http://docs.oracle.com/javase/tutorial/jdbc/basics/storedprocedures.html for more in-depth information.
    If you're going to be doing this for more than a handful of tables under very controlled circumstances keeping it synchronized is going to be a mess, however.
    Edited by: Bill Haverberg on Jun 20, 2012 8:05 AM

  • Problem regarding oracle 11g

    sir/mam
    i am facing a problem in installing the oracle 11g.. after installing the software. when i am going on command prompt then it is asking for user name and password. after then it is showing that connected to oracle. then when i am clicking on the desktop icon get started with oracle database 11g, it is opening a web page. i am not getting what to do after that..?????
    sir/mam please give me some advice.. its very urgent.
    thanks a lot..

    Hi,
    Reading Database Express Edition Getting Started Guide might help
    http://docs.oracle.com/cd/E17781_01/admin.112/e18585/toc.htm
    Regards,
    Jari
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Problem Installing Oracle 11g. Please Help!

    Hello All,
    I need to install Oracle 11g Release 2  database on my machine:
    Windows 7 Enterprise
    64 bit Operating System
    Service Pack 1
    I ran into problems right before  I reach the Installation Options Screen
    The error message is:
    Unable to establish a network connection to proxy server. Specify the correct proxy details.
    I have tried entering the correct Proxy server information but it gives me the same error.
    Please Help
    Thanks

    HI,
    If you are not using proxy or if you want to continue without connecting to internet, you can just continue without providing these details
    Regards
    Yoonas

  • Problem Installing oracle 11g in Fedora 8

    Hi,
    I am trying to install oracle 11g in Fedore 8. The problem I am facing is that it is not starting the universal oracle installer. It is giving that DISPLAY is not set properly. I tried to do the following:
    DISPLAY=<machine-name>.0.0;export DISPLAY
    but it is not working.
    Can any one advise regarding installing 11g in linux.
    Thanks,
    Mahboob

    Details! What is the exact message, if any, that you get?

Maybe you are looking for

  • GPS Question [might be dumb]

    Last night was the first night I used GPS on my phone, I had to pick someone up. Well I got there and couldn't figure out how to shut the thing off, it kept tracking where I was. Or as soon as you hit the home button an exit out of maps does it stop?

  • Multibox problem in IE?

    Hello I have just created a multibox for my website and when I open the box in Firefox everything works fine and the box appears in the center of the page as it should. But when I try it in internet explorer for some reason the box appears to the top

  • Is it possible record the sound without using server  ?

    hi   i need to record the sound(.mp3) from microphone in flash, i want to save in a local system from a web page and without using the sever like fms red5 etc. any idea or solution ? is it possibe? if so how ?

  • LightRoom Slide Show Pro

    Having difficulty with inserting a SWF created by Light Room - Flash Gallery; I used the Slide Show Pro pluging and exported the Album to a folder. I tried insert>media>swf> and selected each of the swf files in the folder but none of them would play

  • JMS Selectors

    Hi, When specifying a selector for a given JMS message, where's the message filtered out/in? The WL server or the client API? I'm assuming the former, but could not find any information on the documentation. If it's important for my question, I'm usi