Storing dates in oracle

Hi all,
Probably it might be a silly question, but it just made me wonder... how???
Here is my query....
It seems oracle stores dates in an internal numeric format, representing the century, year, month, day, hours, minutes and seconds. For example 07-Jun-1994 5:10:43 PM is stored in the database as
Century     Year     Month     Day     Hour     Minute     Second
19     94     06     07     5     10     43
The 19th century began on January 1, 1801 and ended on December 31, 1900. So the year 1994 has to be 20th century and not 19th century, but its confusing why it is stored in the database as 19th century.
Please let me know whether i am asking a correct question and please correct me if i am wrong.
-Satheesh

Satheesh_Kumar wrote:
Hi all,
Probably it might be a silly question, but it just made me wonder... how???
Here is my query....
It seems oracle stores dates in an internal numeric format, representing the century, year, month, day, hours, minutes and seconds. For example 07-Jun-1994 5:10:43 PM is stored in the database as
Century     Year     Month     Day     Hour     Minute     Second
19     94     06     07     5     10     43
The 19th century began on January 1, 1801 and ended on December 31, 1900. So the year 1994 has to be 20th century and not 19th century, but its confusing why it is stored in the database as 19th century.
Please let me know whether i am asking a correct question and please correct me if i am wrong.
-SatheeshNot exactly:
Century and year components are stored in 'excess 100 format', which means that 100 must be deducted from the byte's value. If a negative number results, then we've got a BC date at which point we take the absolute number. Also, to avoid ever having a zero byte, 1 is added to the hour, minute and second bytes. Therefore, 1 must be detected to get the correct value.
So 07-Jun-1994 5:10:43 PM is stored in the database as
Century     Year     Month     Day     Hour     Minute     Second
119     194     06     07     18     11     44SY.

Similar Messages

  • Storing data in oracle 8i with PtG

    I want to store retrieved data in a database (oracle 8i) with Portal-to-Go?
    Is it necessary to write an adapter and in that case where can I find information about adapters? Any help will be appreciated.
    Thanks
    null

    OTN has some sample apps that show how to store documents in the database as CLOBs:
    [list][*]Customizing Web Content
    [*]B2B with XML
    [*]Managing Web Content (CMS)
    [*]XML Live Demos
    [list]
    Regards,
    -rh

  • Sending Long Raw Data to Oracle database through Stored  Procedure

    Hi,
    I am trying to push data to Oracle 9i database through Stored Procedure via thin driver. It is going smoothly upto 29411 bytes. But it is not accepting for 53843 bytes and giving following error :
    java.sql.SQLException: Data size bigger than max size for this type: 53843
    Is it thin driver limitation? Can I solve it by using OCI driver? Or is there any other approach?
    I tried creating connection pool in weblogic 7.0 through OCI driver. But I am not able to configure it. Is there any special way of configuration.
    Quick response will be greatly appreciated.
    Thanks
    Sanjiv

    It happens to me. But I am using CMP of Weblogic 7. If you write your own jdbc code, the following link may be helpful.
    http://otn.oracle.com/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html

  • Passing data from Oracle stored procedures to Java

    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.

    user1754151 wrote:
    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
    The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
    The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor.

  • Unable to show Unicode Data in Oracle RESTful Service JSON

    Hi Everyone.
    I have stored unicode data in Oracle database and when i retrieve in sql query it is showing the same. But when i retrieve the data in json using oracle RESTful web service (GET), it bringing with unknown character as shown below.
    next: {},$ref: "http://000.00.00.00:8085/ords/mobile/sch/loginm/?user=SURESH&pwd=123&page=1"
    items: [
    uri: {},$ref: "http://000.00.00.00:8085/ords/mobile/sch/loginm/41"
    stud_id: 41,
    stud_code: "1001",
    stud_name: "அப்துல் ஜப்பார்"
    My Database Setup as below:
    SQL> SELECT name,value$ FROM sys.props$;
    NAME                                                          VALUE$
    DICT.BASE                                                  2
    DEFAULT_TEMP_TABLESPACE               TEMP
    DEFAULT_PERMANENT_TABLESPACE     USERS
    DEFAULT_EDITION                                   ORA$BASE
    Flashback Timestamp TimeZone                    GMT
    TDE_MASTER_KEY_ID
    DBTIMEZONE                                        -07:00
    DST_UPGRADE_STATE                         NONE
    DST_PRIMARY_TT_VERSION               11
    DST_SECONDARY_TT_VERSION          0
    DEFAULT_TBS_TYPE                              SMALLFILE
    NLS_LANGUAGE                              AMERICAN
    NLS_TERRITORY                                   AMERICA
    NLS_CURRENCY                                   $
    NLS_ISO_CURRENCY                         AMERICA
    NLS_NUMERIC_CHARACTERS               .,
    NLS_CHARACTERSET                         AL32UTF8
    NLS_CALENDAR                                   GREGORIAN
    NLS_DATE_FORMAT                              DD-MON-RR
    NLS_DATE_LANGUAGE                         AMERICAN
    NLS_SORT                                        BINARY
    NLS_TIME_FORMAT                         HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT               DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT               HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT          DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY                    $
    NLS_COMP                                   BINARY
    NLS_LENGTH_SEMANTICS          BYTE
    NLS_NCHAR_CONV_EXCP          FALSE
    NLS_NCHAR_CHARACTERSET          AL16UTF16
    NLS_RDBMS_VERSION               11.2.0.1.0
    GLOBAL_DB_NAME                    MOBILE
    EXPORT_VIEWS_VERSION   
    SQL> select DECODE(parameter, 'NLS_CHARACTERSET', 'CHARACTER SET',
      2  'NLS_LANGUAGE', 'LANGUAGE',
      3  'NLS_TERRITORY', 'TERRITORY') name,
      4  value from v$nls_parameters
      5  WHERE parameter IN ( 'NLS_CHARACTERSET', 'NLS_LANGUAGE', 'NLS_TERRITORY');
    NAME          VALUE
    LANGUAGE      AMERICAN
    TERRITORY     AMERICA
    CHARACTER SET AL32UTF8
              8
    WORKLOAD_CAPTURE_MODE    
    WORKLOAD_REPLAY_MODE
    Awaiting you solution.
    -- Abdul Jabbar

    Kumar,
    Ftping the PG.xml to mds folder will not help the page to goto MDS directory
    You have to import the file using xmlimporter
    I understand you have done the import, but it is not success.
    Could you please post what is the script you used to import the PG.xml
    and once you run what was the output you have got.
    May be you can refer the URL for the scripts
    http://apps2fusion.com/at/61-kv/331-oa-framework-scripts
    With regards,
    Kali.
    OSSI.

  • Need sample source code for calling stored procedure in Oracle

    Hi.
    I try to call stored procedure in oracle using JCA JDBC.
    Anybody have sample source code for that ?
    Regards, Arnold.

    Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
    I have the Procedure defined as below in the SFCS1 package body
    Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
    BEGIN
    Open O_Cursor FOR
    SELECT CompanyId, CompanyName
    FROM Company
    WHERE CompanyProvince IN ('AL','AK');
    END Company_Selection;
    In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
    At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
    DECLARE
    A SFCS1.T_Cursor;
    BEGIN
    SFCS1.Company_Selection(A);
    go_Block ('Block36');
    The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause.

  • Calling DB2 Stored Proc from Oracle DB

    Hi,
    I am having two different database running (One is oracle on solaris while the other one is db2 on os/390 mainframe) i want to pass the data realtime. Is there any way I can call a DB2 stored procedure from oracle directly. If anyboy can help in this will be really helpful.
    thanks,
    Kishor

    odi version we have is  ODI_11.1.1.6.0, it is not migrated and 'Always Execute' option is checked already.
    tried using variables in capital format but did not worked,
    begin
    schema_name.proc_name(#LV_TABLE_NAME,#LV_SCHEMA_NAME,#LV_START_DATE,#LV_END_DATE);
    end;
    odi is giving error if it finds any bug in stored proc but after fixing its completing successfully without errors in operator but i am not able to see the result.
    Please advise.

  • JDBC send data to oracle, oracle only accept column name in Upper case

    Hi experts,
    I am doing a scenario File --> XI --> JDBC,  JDBC send data to a Oracle 10g database, I have configured JDBC receiver to use XML-SQL format. in oracle database ,  table "EMPLOYEE" has a column "NAME", but when I send data to oracle using JDBC receiver, the column is "name", then XI complains
    " 'EMPLOYEE' (structure 'insert'): java.sql.SQLException: FATAL ERROR: Column 'name' does not exist in table 'EMPLOYEE'.
    can anyone help me to let oracle accpet column "name". I can't change colum in JDBC receiver from "name" to "NAME".
    Thanks a lot.

    <i>can anyone help me to let oracle accpet column "name"</i>
    Making Oracle case insensitive is not possible (in my opinion). By default all object names are stored in UPPER case in the rdbms dictionary.
    When XI searches for column name in Oracle, this search is case sensitive. So u have to configure accordingly.
    Regards,
    Prateek

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • Calling stored procedure in Oracle forms

    I have a stored procedure in Oracle which is declared as follows in the package
    SFCS1.Company_Selection(O_Cursor IN OUT T_Cursor, cls IN Varchar2);
    Where T_Cursor is defined as a Ref Cursor
    From the Oracle forms I'm using the following code
    SFCS1.Company_Selection(A,my_cls);
    go_block('Block50');
    Execute_Query;
    I get the error message "FRM40505:Oracle Error: Unable to Perform Query". If I hardcode the value of my_cls in the query it runs properly. Any solutions will be really helpful
    Further to this, I want to put the single quotes around a value (for eg. 'A') from a variable. For instance I'm getting a value from my_cls and for the output I want to surround it with the single quotes, can somebody tell me how to do it.
    Thanks in advance

    This is a bit of a roundabout way to do it? Try setting up the block data source as procedure and set the values in the property palette of the data block.
    e.g.
    Query Data Source Type = Procedure
    Query Data Source Name = SFCS1.Company_Selection
    Query Data Source Columns = (Whatever columns/items you have in your datablock)
    Query Data Source Arguments = Argument names are your ref cursor and your variable.
    Check out basing data blocks on Ref Cursors.
    HTHs
    L :-)

  • Insert data into oracle based on sql server data(here sql server acting as source to oracle and destination to oracle)

    Source is Oralce. Destination is SQL Server.
    Requirement - I have to fetch sql server server data (empid's) based emp table  and send this as input data to oracle to fetch and empid's are common.
    I cannot use merge or loopkup or for each as oracle have too many records.
    For example - In MS SQL - i have empid=1,2..Only these records, I have to fetch from oracle source into sql server destination. For this, I have adopted the below approaches...The major problem I face, when i build a empid's as a string, it is taking only
    4000 chars. My string lenght is 10000. How do I breakup this string lengh and send to data flow task till all broken strings length passed to DFT.
    Approach-1
    created two variables - oraquery string, empid string
    step1 - ms sql database - created sql task - declare @empid varchar(max)
    SELECT @empid=
    Stuff((SELECT ',' + empid
            FROM  
            (SELECT  DISTINCT  convert(varchar(10),empid ) empid FROM emp
             ) x
            For XML PATH ('')),1,1,'')
    select @empid =    '(' +  @empid + ')'
    select @empid
    resultset=singlerow
    resultset=resultname=0; variablename=User::empid (empid is declared as string)
    step2 - oracle database - created data flow task
    created oledb source
    I put  this statemnt in oraquery expression - "select * from dept where dept in  "
    +  @[User::empid] + "
    expression=true
    [OLE DB Source [1]] Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.
    An OLE DB record is available.  Source: "Microsoft OLE DB Provider for Oracle"  Hresult: 0x80040E14  Description: "ORA-00936: missing expression".
    Approach-2
    created three variables - oraquery string, empid  int, loop object--when I put int then it is automatically setting to 0
    step1 - ms sql database - created sql task - SELECT  DISTINCT  convert(varchar(10),empid ) empid FROM emp
    resultset=fullresult
    resultset=resultname=0; variablename=User::loop
    step2 - created a for each loop container
    for loop editor - for each ado ennumerator
    enumerator configuration - loop
    variablemapping - variable=empid;index=0
    step3 - oracle database - created data flow task (outside for each loop. If I put inside it is taking long time)
    created oledb source
    I put  this statemnt in oraquery expression - "select * from dept where dept in  "
    +  @[User::empid] + "
    expression=true
    Data inserting in a destination table but  empid=0.

    Sorry didnt understand if your step3 is outside loop how
    @[User::empid] will get values for the empids from User::loop. The iteration happens inside loop so you
    need to have a logic to form the delimited list inside using a script task or something and concatenating everything and storing to variable @[User::empid]
    . Then only it will have full value used to be used in step3 query
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to wake-up a Java Stored Proc at Oracle Server Startup

    Hi,
    I am writing a Java Stored Procedure responsible to
    execute periodically (daily for example) a command (the
    command and its arguments are prepared by the Java stored
    procedure and they are date and time sensitive).
    My questions are:
    1. Is there any way that my Java stored procedure is
    initially NOTIFIED (woke-up) when the Oracle server is
    started ? I noticed that there is a built-in Java stored procedure in Oracle DB declared as:
    "PROCEDURE notify_at_startup( user_schema VARCHAR2, classname VARCHAR2) ;"
    Can this be used in any way for my purpose ? If yes, how ?
    2. I can do the PERIODIC scheduling of execution of the
    command using standard (SUN) java timer/Thread
    primitives. Are there any Oracle Java classes/methods
    which can be used instead for this scheduling ?
    Thanks for any help/suggestions.
    Arminius

    I would look at two things.
    1) Create a database level trigger that fires at server start up.
    2) Define an Oracle Job that runs every xx minutes and restarts itself.
    Chet West

  • I want to load data into Oracle using XML & Java - hints??

    I have a XML files that are created on a timed basis....they describe a photo and point to a dir where the photo is stored...like...
    <image>
    <user>bill</user>
    <img>photo.jpg</img>
    <img_dir>'/tmp/photos'</img_dir>
    </image>
    I'd like to write a Java program that parses the XML and loads the images, data into Oracle.
    Suggestions on Oracle tools, downloads that will help me accomplish this???
    Thanks!

    Depending on whether you want assistance in doing the insert into the database or whether you don't mind writing the JDBC code to perform the insert, you can get by with only our XML Parser for Java v2, which implements SAX, DOM, XPath, and XSLT standards. The latest beta release (2.1.0) supports SAX2 and DOM2.
    If you want help inserting the XML into tables, then in addition to this, you might want our XML SQL Utility as well.
    http://technet.oracle.com/tech/xml
    Steve Muench
    Lead Product Manager for BC4J and Lead XML Evangelist
    Author, Building Oracle XML Applications
    null

  • How to verify stored procedures in Oracle 10g.

    I would like to locate default stored procedure in Oracle 10g database.
    And Suggest which stored procedure can be converted in to JAVA code ??

    If the Java part of the question refers to looking for potential to speed up your stored procedures:
    You should consider native compilation which transfers your code to shared libraries which are bound to the DB kernel.
    In this case however consider, that this does not make any sense/improvement for pure data access statements but only for procedures consisting of complex algorithmic processing.
    For details refer to
    [How native compilation works|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2280]
    and
    [Setting Up and Testing PL/SQL Native Compilation|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2309]

  • C-stored procedure in Oracle

    Dear Friends,
    I have a lot of c-stored procedures for DB2,
    now,I want to use these c-stored procedures in Oracle directly without any changes.
    I'm not sure whether this method is right.
    Please help me.
    Guang

    I think, that the best way inclusion of business logic into ORACLE database as a TABLE-constraints, triggers and stored procedures for guaranteeing data integrity.
    But if you have really a LOT of c-stored procedures and you need provide quick startup with ORACLE, than you can use your c-procedures as "external calls" with ORACLE.
    Unfortunately I don't know DB2 c-stored procedures specifics and can't give finally recommendations for you.
    Sincerely, Urry

Maybe you are looking for

  • How to catch SQLException from a session bean

    Hello I have a stateless session bean which has a method to persist an entity (User) in the database. In User there is a foreign key (addressId) from another entity (Address). While i was persisting User, i entered a value of addressId which was not

  • HT2500 Mac mail macbook pro 10.6.8 receiving messages hear chime but no mail notification. cannot see or open

    Mac Mail. receiving messages. I hear chime. Cannot see notifications in inbox or mail icon in dock. Thus cannot open messages. Macbook pro 2009 10.6.8.

  • Floating Images -- Removing Artifacts

    This design issue is driving me nuts. I'm creating a flyer that incorporates "floating" product images. I removed the background of the original images, using Photoshop. Two files were rendered from tiff, and two files were rendered from smaller rez

  • Encroaching Lake Ice - MN

    Well, Spring is here - but not everywhere. With mentions of The Fog, The Cloud, etc., maybe someone should be doing a horror film in MN, and up in Canada - The Ice! Rod, do you copy? http://www.news.com.au/world-news/wave-of-ice-marches-on-homes-on/s

  • Implement Connection Pooling

    Hi, I want to create a pool of connection objects and when multiple users query the database, the connection should be returned from the pool to the different users. What is the best way to implement this? Could I use javax.sql package or dbcp classe