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.

Similar Messages

  • 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.

  • 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

  • Date datatype in Oracle 8i

    Books tells me that Date datatype is stored as 7 bytes.
    Yet when I run the following query, result is 8. Can someone explain this.
    SQL> select vsize(sysdate) from dual;
    VSIZE(SYSDATE)
    8

    It would appear that the external representation of a date is different than the stored representation of a date. Consider:
    SQL> CREATE TABLE t (dt DATE);
    Table created.
    SQL> INSERT INTO t VALUES(sysdate);
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT DUMP(dt) from t;
    DUMP(DT)
    Typ=12 Len=7: 120,102,12,30,10,27,9
    SQL> SELECT DUMP(sysdate) FROM dual;
    DUMP(SYSDATE)
    Typ=13 Len=8: 7,210,12,30,9,27,18,0
    SQL> SELECT DUMP(TO_DATE('20021230','yyyymmdd')) FROM dual;
    DUMP(TO_DATE('20021230','YYYYMMDD
    Typ=13 Len=8: 7,210,12,30,0,0,0,0
    A stored date is type 12 and has length 7, while sysdate, and the result of a to_date call is type 13 and has length 8. This seems to be true in all versions of Oracle I checked (7.3.2, 8.0.5, 8.1.7, 9.0.1)
    TTFN
    John

  • 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. :-)

  • 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

  • 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

  • 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

  • Data Guard in oracle 11G

    Hi Friends,
    I am new in orcle & my boss told me to configur a dataguard in oracle 11g.we have two server with same configuration. First server is primary server & second server is standby. I have created two database name as PIDB & PIHIST for RTGS system. I have gave a database name to primary server is PIHIST,PIDB & for standby PIDBSTDBY,PIHISTSTDBY, Is it right ? is it right then how i configure a dataguard?
    Thanks,
    XYZ

    Hi ,
    Check Below Links
    http://www.oracle.com/global/uk/education/downloads/uwe_data_guard.pdf (Pdf File)
    http://wiki.oracle.com/page/DataGuard+%3A+Step-by-Step+Instructions+for+Creating+a+Physical+Standby+Database
    You can go to Oracle Library and also get the pdf file which explains you Step-By-Step Process to creating Physical Or Logical Standby Database.
    And also explain need and configuration of each and every parameter of Standby or Primary database.
    Thanks & Regards
    Rahul Sharma

  • Question related to CLOB data type in Oracle 11g

    Hi,
    I'm trying to assign a string value to a CLOB variable but it is giving me an error as described below. Can someone please let me know what am I missing here? As far as I know, in 11g a CLOB variable can store upto 4GB of data and all i'm trying to use is only 7K of data.
    DECLARE
    v_sql1 CLOB;
    v_sql2 CLOB;
    BEGIN
    DBMS_OUTPUT.ENABLE(1000000);
    v_sql1 := 'BLAH-BLAH-BLAH.........'; --> this string is actually more than 4000 characters.
    v_sql2 := TO_CLOB('BLAH-BLAH-BLAH.........'); --> this string is actually more than 4000 characters.
    dbms_output.put_line(v_sql1);
    dbms_output.put_line(v_sql2);
    END;
    When I try to execute the above script, I get the error message: ORA-06502: PL/SQL: numeric or value error:character string buffer too small.
    I even tried to use TO_CLOB function as shown above but it is failing as well.
    NOTE: The string to assign is not coming from any table but mainly a SQL statement used for sys_refcursor.
    Thanks.

    John Spencer wrote:
    Unless I missed something in the 11g new features, the maximum line length in DBMS_OUTPUT.Put_Line is still 255 characters.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    SQL> set serveroutput on
    SQL> exec dbms_output.put_line(lpad('X',512,'X'));
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    PL/SQL procedure successfully completed.
    SQL> SY.

  • Table move after data deletion in oracle 11g

    Hi,
    Our previous system was in oracle 9i, And we used to archive our data in every 1 year which caused a huged number of DML operation our database. After that,we used to move our table and rebuild indexes to releases spaces. After Upgradation ,our presence system is running on oracle version 11.2.0.2. Now my question do we need to move table in 11g to release space?? Or it automatically done in 11.2.0.2???
    Thanks and Regards,

    Our previous system was in oracle 9i, And we used to archive our data in every 1 year which caused a huged number of DML operation our database. After that,we used to move our table and rebuild indexes to releases spaces. After Upgradation ,our presence system is running on oracle version 11.2.0.2. Now my question do we need to move table in 11g to release space?? Or it automatically done in 11.2.0.2???If you move that space will be released from those extents but you wont gain any space at OS level until unless you shrink datafile. Move command will do the job.
    did you see what is the free space in tablespace after moving objects?

  • Date Format in Oracle 11g XE

    Hello everyone,
    I have installed Oracle11XE and noticed that it has the following date format:
          SQL> SHOW PARAMETER NLS_DATE_FORMAT
          NAME                                 TYPE        VALUE
          nls_date_format                      string      RR-MM-DD
    I know that I can change the format for the session, like this:
         alter session set nls_date_format = 'DD-MON-YY';
    I also know that to change the system parameter I need to do the following:
         alter system set nls_date_format = 'DD-MON-YY' scope=spfile; 
         then restart the database.
    However, after I do the latter, the date format is still:
         SQL> select sysdate from dual;
         SYSDATE
         14-11-19
    Could someone tell me why this is happening and correct this?..
    Thanks.

    goodluck247 wrote:
    Hello everyone,
    I have installed Oracle11XE and noticed that it has the following date format:
          SQL> SHOW PARAMETER NLS_DATE_FORMAT
          NAME                                 TYPE        VALUE
          nls_date_format                      string      RR-MM-DD
    I know that I can change the format for the session, like this:
         alter session set nls_date_format = 'DD-MON-YY';
    I also know that to change the system parameter I need to do the following:
         alter system set nls_date_format = 'DD-MON-YY' scope=spfile;
         then restart the database.
    However, after I do the latter, the date format is still:
         SQL> select sysdate from dual;
         SYSDATE
         14-11-19
    Could someone tell me why this is happening and correct this?..
    Thanks.
    NLS_DATE_FORMAT is set at
    system
    client OS
    client oracle session.
    system setting is weakest because it is over-ridden by any other setting.
    See - But I want to store my date as ...

  • Number(p,s) data type in oracle 11g is not storing places after decimal

    I have noticed in toad that if my source is somthing like '111' it is not getting converted to 111.00 when it is being stored as number (15,2) .
    however decimal datatype would worK i think or is there a setting on toad that is turning off the visiblty.please throw light on this

    read http://download.oracle.com/docs/cd/A81042_01/DOC/server.816/a76965/c10datyp.htm#743 especially Internal Numeric Format
    Regards
    Etbin
    Edited by: Etbin on 15.10.2011 0:13
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1619552483055 more about number datatype

  • Space utilization and optimal row size in Data Blocks in Oracle 11g

    Hi,
    My main concern till now is to find the Optimal no. of rows/tuples per one oracle data block of size 8192. For that purpose i'm doing different kind of testing.
    I created one table:
    SQL> create table t5
    2 (x char(2000));
    Table created.
    Inserted 4 rows in it.
    Queried to check in which block no's these 4 rows exist.
    SQL> SELECT x,DBMS_ROWID.ROWID_BLOCK_NUMBER(rowid) "Block No."
    2 from t5;
    x Block No.
    A 422
    B 422
    C 422
    D 423
    SQL> analyze table t5 compute statistics;
    Table analyzed.
    SQL> select LOGGING,BACKED_UP,NUM_ROWS,BLOCKS,EMPTY_BLOCKS, AVG_SPACE,CHAIN_CNT, AVG_ROW_LEN
    2 from user_tables
    3 where table_name = 'T5';
    LOG B NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE CHAIN_CNT AVG_ROW_LEN . YES N 4 5 3 6466 0 2006 .
    8 data blocks are initially allocated. but my question is that while creating table of even small sizes, every time i'm seeing that it shows BLOCKS (used) are 5.
    why 3 block are EMPTY_BLOCKS allocated all the time?
    AVG_SPACE is the FREE space in every BLOCK that is used if i'm not wrong?
    In this scenerio 3 rows (each of around 2006 bytes) are inserted into into one BLOCK of 8192 i.e. 8192-6006=2186. 2186 is the PCTFREE or what?
    How can I see this CHAIN_CNT column value other than 0?
    How can actually I find the optimal no. of rows/tuples in 1 data block that will not increase OVERHEAD on the system.
    I'll highly appreciate the genuine help and solid suggestions.
    Thanks in Advance.
    Best Regards,
    Kam

    kamy555 wrote:
    If you want to suggest something it'll be nice of yo.I can't disclose my main concern :)If you can't disclose what you mean by "optimal" and you can't disclose what "overhead" you are concerned about, I'm not sure that anyone could answer your question.
    In this scenerio 3 rows (each of around 2006 bytes) are inserted into into one BLOCK of 8192 i.e. 8192-6006=2186. 2186 is the PCTFREE or
    what?PCTFREE is a percentage. You haven't specified what you set it to, but that decreases the space in a block available for inserts to 8192 * (1 - PCTFREE/100).
    How can I see this CHAIN_CNT column value other than 0?Why do you believe there would be chained rows? You would need to use the ANALYZE command to populate the CHAIN_CNT column.
    How can actually I find the optimal no. of rows/tuples in 1 data block that will not increase OVERHEAD on the system.Since you can't disclose what "optimal" means or what "overhead" you're concerned with, I don't see how this question could be answered.
    Justin

  • Looking for Active Data Guard in Oracle 11g Release 2 References

    I want to reach out to customers who have implemented Active Data Guard in production (preferably 11.2), so that we can develop some
    customer references that in turn will benefit other customers. The customers who get selected for such references may further be selected to publish their case study directly in oracle.com and/or invited as a customer co-speaker in the upcoming Oracle OpenWorld at San Francisco (Sep 19-23, 2010). Being a customer co-speaker at OOW means they get a free pass to the full conference (regular price for that is $1795-$2495).
    Please send any follow-ups to [email protected]
    Thank you.
    Larry M. Carpenter
    Oracle Data Guard & MAA Product Manager

    Hi Larry,
    This is Bhavik Desai Oracle -DBA@Amazon. I do have couple of Active Standby running on 11gR2 On RHEL 5 64-Bit platform.
    Most of the databases are reporting on (DSS Having 2-4 TB in size) having FSFO configured.
    It would be a pleasure if i can provide any benchmarking to you on this.
    Regards,
    Bhavik Desai

Maybe you are looking for

  • READ_IMAGE_FILE in Oracle Forms6.0, Code added

    Hi, I have two tif files one is compressed in Lempel-Ziv and another is not. Now READ_IMAGE_FILE does not read the image compresses in Lempel-Ziv file but does read the other tiff files. Also the size of the tiff file with Lempel-Ziv compression grea

  • S.M.A.R.T. was 'Failing'... now shows 'Verified'

    Hello, Yesterday I went into Disk Utility and found that S.M.A.R.T. on my hard drive was reporting 'Failing.' I immediately made a backup of my computer and put it to sleep. Today, S.M.A.R.T. in Disk Utility shows that the Hard Drive is 'Verified.' H

  • Created new mailbox, not showing up

    I recently created a new top level mailbox, named "Sent Messages"; it did not appear immediately after creation, and hasn't shown up after restarting Mail. I thought maybe I didn't hit the "OK" button during the Naming prompt, so I tried to add a new

  • Wireless IP address wrong assign wrong

    I have a linksys 120N router  I'm working on . The router does not show it sees the laptop. The laptop sees the wireless SSID name and seems to connect to it. But it does not get any Internet. The laptop says the ipconfig address is 192.168.0.1 . But

  • Old iPod disabled, cant be un-disabled

    I have a very old iPod touch, on I.O.S 5, it has been disabled, and it hasnt been synced to iTunes and isn't connected to find my iPhone, and when I hold the home button when its off and plug it into my laptop, nothing happens except a notification o