Conversion of LOB to timestamp in Oracle 10G

Hi all,
I am having a problem in converting a LOB ( which will have date value) to timestamp.
My LOB value will be in the format "(CLOB) 19/Feb/09 07:25 PM".
And I need to convert it into timestamp format with format 'dd-MON-yy HH:MI:SS AM'.
When I convert the LOB to char using to_char(dbms_lob.substr(oldstring, 18, 1)) where oldstring is the column name, I will get the value in the format '19/Feb/09 07:25 PM'. But after that I was not able to convert it into timestamp as I am getting the message 'ORA-01858' related to non-numeric character when it is expecting a numeric character.
Does anyone had this problem or is anyone having solution to this?
Thanks in advance..
-Raghu

And if you're worried about losing the time element... it's not lost
SQL> alter session set nls_date_format = 'dd-mm-yyyy hh24:mi:ss'
  2  /
Session altered.
SQL> create table test
  2  (oldstring clob)
  3  /
Table created.
SQL>
SQL> insert into test values ('19/Feb/09 07:25 PM')
  2  ;
1 row created.
SQL> select to_date (substr (oldstring, 1, 18), 'dd/Mon/rr hh:mi AM')
  2    from test;
TO_DATE(SUBSTR(OLDS
19-02-2009 19:25:00
SQL> drop table test
  2  /
Table dropped.
SQL>

Similar Messages

  • Issue with Date Conversion when loading XML File into Oracle 10g Database

    Hello all,
    I have the interface shown in the screenshot below. In it, amongst other actions, I'm mapping an XML file element representing a date to an Oracle table column defined as DATE. The source and target columns are highlighted in the screenshot.
    !http://img223.imageshack.us/img223/1565/odiscr275.jpg!
    When I execute the interface, I get the following error message:
    java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:103)
    I'm assuming this refers to the date conversion!
    I've already tried replacing SRC_TRADES.DEAL_DATE with TO_DATE( SRC_TRADES.DEAL_DATE, 'DD/MM/YYYY' ) in the Implementation tab. This function was not recognised when I executed the interface, so it didn't work! The date value in the XML file is in DD/MM/YYYY format.
    I'm guessing that Oracle SQL Date functions don't work in the Implementation tab. Please could somebody let me know:
    1. Which Date Conversion function I could use instead?
    2. Where I can find a reference for the methods/functions I can use in the Implementation tab (if such a reference exists)?
    Cheers.
    James

    Hi.
    Try to change the execution area to staging area. After You change it, write in the mapping box just SRC_TRADERS.DEAL_DATE. When You use TO_DATE, the source field typu should be varchar2, not date (as it is in your source datastore)

  • DB2 timestamp to oracle timestamp conversion

    Does any one know how to convert Db2 timestamp into oracle timestamp.
    From DB2 we are getting timestamp in this format (2000-03-06-16.02.19.074474) (26 bytes).
    I want to insert this into oracle thru owb into oracle table with column type timestamp.
    Does anyone know the procedure for this type of conversion
    Thanks in advance..

    Hi,
    Try a migration tool at www.ispirer.com/chyfo.html
    It provides you the fastest, the easiest and the most powerful way to migrate
    DB2 database into Oracle.
    It works in conjunction with Oracle SQL Loader. The tool creates text files (moving of LOBs are fully supported), generates
    CREATE TABLE scripts for Oracle and control files for SQL Loader.
    The tool has a lot of other features.
    Best regards, Dmitry.
    null

  • How to sync the timestamp type in 10g with oracle 8i

    Hi,
    I have oracle 8i on solaris server and we have created application database as well.
    I have created oracle 10g databse in some other server and imported the whole database into 10g.
    Since there is timestamp format difference in oracle 8i and 10g the application is not working properly in 10g server.
    see the below example
    In 8i
    select to_char(sys.standard.sys_at_time_zone(sys.standard.localtimestamp,'0:00')) from dual
    22-MAY-09 09.59.50 AM +00:00
    In 10g
    select to_char(sys.standard.sys_at_time_zone(sys.standard.localtimestamp,'0:00')) from dual
    22-MAY-09 09.53.54.638090000 AM +00:00
    since in 10g it is giving microseconds as well in the output unlike 8i, our application is not working properly.
    Please advice
    RB

    Does setting NLS_TIMESTAMP_TZ_FORMAT at session level (using logon trigger) solve your problem?
    BTW, this does not qualify as an installation issue so please post such queries in Database-General forum.

  • Conversion of oracle 10g character (.txt) reports to bitmap (.pdf)

    Hi,
    I have two queries:
    1) I want to convert oracle 10g bitmap (.rtf) reports to bitmap (.pdf) reports. I can do it by converting desformat. But the problem is .rtf reports have PAGESIZE 13 inches x 11 inches. After conversion to .pdf I need to have A4 size (11.7 x 8.3) . This also I can do it manually by changing width and height. But the issue is I'm getting error that : some object is out of body. So I have to change the marging of each and every report manually by trail & error method. Which is consuming lot of time.
    So any one please provide me solution so that I can generate .pdf report in A4 format with out any issues. (By changing any class files, etc..)
    2) I want to convert character(.txt) reports to bitmap (.pdf) reports. Again its having same problem as mentioned in (1). So any shortcut or any method for doing it.
    Please let me know whatever you know abt this issue.
    Thanks in Advance

    Don't think there are any shortcuts you can convert 13x11 to 11.7x8.3 without modification of the layout. changes or moves of the frames/fields are expected if they are beyond 11.7x8.3.

  • Unix timestamp to Oracle timestamp conversion

    Hi all,
    I am trying to convert the UNIX timestamp to ORACLE timestamp .
    I have done like this upto now.
    CREATE OR REPLCACE FUNCTION unixts_to_oraclets(unixtimestamp IN INTEGER)
    RETURN DATE IS
    result DATE;
    BEGIN
    result := TO_DATE('1970-01-01', 'YYYY-MM-DD') + numtodsinterval(unixtimestamp, 'SECOND');
    return(result);
    end unixts_to_oraclets;
    now i have run this query
    SQL> select unixts_to_oraclets(1139291114) as TS from dual;
    TS
    07-FEB-06
    now i need the ouput to like this 07-FEB-06 01:10:12
    for that i have done like this:
    DECLARE
    v_date DATE;
    res_date DATE;
    BEGIN
    SELECT from_uts(1139291114)INTO v_date FROM dual;
    SELECT TO_TIMESTAMP(v_date,'DD-MON-RRHH24.MI.SS.FF') INTO res_date FROM dual;
    DBMS_OUTPUT.PUT_LINE(res_date);
    END;
    but the output is :
    SQL> /
    07-FEB-06
    PL/SQL procedure successfully completed.
    why is that it is not printing 07-FEB-06 01:10:12 ?
    how should i moodify the code to get the desired output.
    please help me i this regard
    Trinath Somanchi,
    Hyderabad.

    SQL> exec dbms_output.put_line(sysdate);
    07-FEB-06
    PL/SQL procedure successfully completed.
    SQL> exec dbms_output.put_line(to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS'));
    07-02-2006 02:48:35
    PL/SQL procedure successfully completed.
    SQL> alter session set nls_date_format='DD-MM-YYYY HH24:MI:SS';
    Session altered.
    SQL> exec dbms_output.put_line(sysdate);
    07-02-2006 02:49:03
    PL/SQL procedure successfully completed.

  • Oracle 10g - Issue with Timestamp

    Hi All,We are having an issue with Oracle 10g and Hyperion Intelligence Explorer 8.3.1.133I can only use ODBC to connect to 10g. If I use SQL Net as my connection source I get the dreaded "An unknown error has occurred".Hyperion support tells us to roll back to 8i or just use ODBC until patch released.Anybody know of any workarounds?Regards,Mike

    Nevermind.. a co-worker just told me that I still have to use parenthesis around the values for the IN clause. 

  • ORA-01722: invalid number error coming in Oracle 10g.

    Hi,
    We are getting the error "ORA-01722: invalid number" while opening a cursor using CURSOR FOR LOOP.
    This error has started coming only after we have migrated to Oracle 10g from Oracle 9i. Earlier the same code used to work properly. And also on Oracle 10g, its not happening every time. Sometimes it gives error while sometimes it works.
    Does anybody know about any such bug in Oracle 10g. Our cursor is a parametrized cursor accepting a VARCHAR2 parameter and the value we are passing to it is also character.
    Our database is Oracle 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production and is running on UNIX server.

    And also on Oracle 10g, its not happening every time. Sometimes it gives error while sometimes it works. This is typically due to
    a) environment settings that differ from session to session
    b) or more often, data
    The actual error means that Oracle expects a number and is unable to obtain a number from the input (data or SQL or bind variables) supplied. I agree with William that it looks a lot like an implicit TO_NUMBER() conversion failing.
    Why not add a debug exception handler to the code? When that exception occurs, dump the PL/SQL call stack and values of all variables and parameters to a debug/logging table (using an autonomous transaction).

  • Character set error oracle 10g

    I have a 10g TARGET database with a single byte character set of western european and 9i SOURCE databse with multibyte character of UTF8 since the character sets are different to load data from 9i to 10g I am using national character set NCHAR columns on target database to store the multi byte data :
    this is the table i am working on loading
    CREATE TABLE RAN_TEST1_MDL
    ( MODEL_ID NUMBER(15) NOT NULL,
    PRODUCT_ID NUMBER(15) NULL,
    MODEL_CODE NVARCHAR2(540) NULL,
    ODM_CODE NVARCHAR2(900) NULL,
    MODEL_DESC NVARCHAR2(1200) NULL )
    tablespace csn_d_01 LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING
    The table is test table on oracle 10g database .
    This is the query I am running
    INSERT /*+append*/ INTO WORK_HIER_MDL(
    MODEL_ID,
    PRODUCT_ID,
    MODEL_CODE,
    ODM_CODE,
    MODEL_DESC
    SELECT
    MODEL_ID,
    PRODUCT_ID,
    MODEL_CODE,
    ODM_CODE,
    MODEL_DESC
    FROM SHLD_HIER_MDL
    shld_hier_mdl is source table from oracle 9i multi byte UTF8 database.
    WORK_HIER_MDL is target table on oracle 10g single byte western european databse
    Error : ORA-29275: partial multibyte character
    When I describe the source table SHLD_HIER_MDL ( on 9i oracle accesed thru a db link ) I get the following error
    ORA-01460: unimplemented or unreasonable conversion requested
    I think ORA-29275 and ORA-01460 are correleted . Can anyone suggest what could be the cause for this ? Thanks

    Error:     ORA-29275 (ORA-29275)
    Text:     partial multibyte character
    Cause:     The requested read operation could not complete because a partial
         multibyte character was found at the end of the input.
    Action:     Ensure that the complete multibyte character is sent from the
         remote server and retry the operation. Or read the partial
         multibyte character as RAW.
    you can export the table and import on 10g.Rename the table,create your test table and use IAS.

  • Using Clob with TopLink 9.0.4.5 and Oracle 10g RAC

    I am trying to store an XML file in a Clob type field of a DB table using TopLink 9.0.4.5 and Oracle 10g RAC and need some guidance about how to do it. I got some directions to start it with the Tip "How-To: Map Large Objects (LOBs) to Oracle Databases with OracleAS TopLink" but still need some more helps.
    When using the Oracle JDBC OCI driver, the tip gives the code block for a Clob field:
    DirectToField scriptMapping = new DirectToField();
    scriptMapping.setAttributeName("script");
    scriptMapping.setFieldName("IMAGE.SCRIPT");
    descriptor.addMapping(scriptMapping);
    As I understand, TopLink creates instances of the Descriptor class at run time for each of the descriptor files and stores them in a database session, where is the proper place (in SessionEvent of TopLinkSessionEventHandler?) for me to get a reference to such an instance of my Descriptor class in Java code so that I can add the above mentioned additional Mapping? Are the above String values of "script" and "IMAGE.SCRIPT" predefined in TopLink API? Can I accomplish the same thing just using the TopLink Workbench tool instead? If yes, please advise the detailed steps to do so.
    The tip also states to call the following code in case of using Clob:
    DatabaseLogin login = session.getLogin();
    login.useStringBinding();
    Should the above 2 lines of code be called after the following lines of code?
    SessionManager sessionManager = SessionManager.getManager();
    Server serverSession = (Server)sessionManager.getSession("MY_SESSION_NAME");
    Besides the above extra coding for the Session and Descriptor Mapping, is there any special handling in between Data model and DB table mapping? Can I map a Java String type to a DB Clob field using the Direct-to-field mapping?
    Appreciate any help.

    Never mind ....... I had already figured it out .....

  • Materialize view on oracle 9i and oracle 10g

    Hi,
    My sql query using Materialized view in from cluase.
    its execution time on oralce 9i 9.0.2 is only 0.25 sec but on oracle 10g it takes 4 minutes.
    Explain plan in oracle 9i it consider MV as table but in Oracle 10g it consider it as MV.
    i m analyze all the table before executing the query although it takes time to execute it
    Please can anyone hv the idea how to decrease the execution time.
    Thanks in advance.

    This is my QUERY
    SELECT pp.hhc_code hhc_code, descp.item_id lucode, pp.ctry_code country_code,
    pp.co_code company_code, descp.hq_descp_txt description
    FROM prod_descp_en descp,
    (SELECT DISTINCT ctry_code, co_code, item_id, hhc_code
    FROM prod_perf_xref
    WHERE procs_revis_nbr <= 1493) pp
    WHERE descp.ctry_code = pp.ctry_code
    AND descp.co_code = pp.co_code
    AND descp.item_id = pp.item_id
    AND EXISTS (
    SELECT 'X'
    FROM (SELECT prod_nbr, case_seq_nbr, prod_ctry_code, prod_co_code
    FROM ord_ship_ln
    WHERE (ord_ctry_code,
    ord_co_code,
    ord_doc_nbr,
    ord_sys_srce
    ) IN (
    SELECT ord_ctry_code, ord_co_code, ord_doc_nbr,
    ord_sys_srce
    FROM oms.ord_ship_hdr hr1
    WHERE ( ( hr1.acctg_dest_ctry = '119'
    AND hr1.acctg_dest_co = '003'
    AND hr1.acctg_dest_nbr = 131
    AND hr1.acctg_dest_type = '02'
    OR ( hr1.srce_ctry_code = '119'
    AND hr1.srce_co_code = '003'
    AND hr1.srce_loc_nbr = 131
    AND hr1.srce_loc_type_code = '02'
    ))) ln1
    WHERE descp.product_nbr = ln1.prod_nbr
    AND descp.case_nbr = ln1.case_seq_nbr
    AND descp.ctry_code = ln1.prod_ctry_code
    AND descp.co_code = ln1.prod_co_code)
    ORACLE -9i
    Plan
    SELECT STATEMENT CHOOSECost: 1,528 Bytes: 138 Cardinality: 1                                              
         16 HASH JOIN Cost: 1,528 Bytes: 138 Cardinality: 1                                         
              12 HASH JOIN SEMI Cost: 1,316 Bytes: 93 Cardinality: 1                                    
                   1 TABLE ACCESS FULL OMS.PROD_DESCP_EN Cost: 10 Bytes: 1,160,406 Cardinality: 20,358                               
                   11 VIEW SYS.VW_SQ_1 Cost: 1,290 Bytes: 515,484 Cardinality: 14,319                               
                        10 NESTED LOOPS Cost: 1,290 Bytes: 1,317,348 Cardinality: 14,319                          
                             8 TABLE ACCESS BY INDEX ROWID OMS.ORD_SHIP_HDR Cost: 138 Bytes: 31,104 Cardinality: 576                     
                                  7 BITMAP CONVERSION TO ROWIDS                
                                       6 BITMAP OR           
                                            3 BITMAP CONVERSION FROM ROWIDS      
                                                 2 INDEX RANGE SCAN NON-UNIQUE OMS.ORD_SHIP_HDR_DEST_IDX1 Cost: 1
                                            5 BITMAP CONVERSION FROM ROWIDS      
                                                 4 INDEX RANGE SCAN NON-UNIQUE OMS.ORD_SHIP_HDR_SRCE_INDX Cost: 1
                             9 INDEX RANGE SCAN UNIQUE OMS.PKORD_SHIPLN1 Cost: 2 Bytes: 950 Cardinality: 25                     
              15 VIEW OMS. Cost: 211 Bytes: 598,860 Cardinality: 13,308                                    
                   14 SORT UNIQUE Cost: 211 Bytes: 532,320 Cardinality: 13,308                               
                        13 TABLE ACCESS FULL MFIDATA.PROD_PERF_XREF_T Cost: 164 Bytes: 532,320 Cardinality: 13,308                          
    ORACLE -10g
    Plan
    SELECT STATEMENT CHOOSECost: 7,538 Bytes: 138 Cardinality: 1                                              
         19 HASH JOIN Cost: 7,538 Bytes: 138 Cardinality: 1                                         
              12 HASH JOIN SEMI Cost: 6,851 Bytes: 93 Cardinality: 1                                    
                   1 MAT_VIEW ACCESS FULL MAT_VIEW OMS.PROD_DESCP_EN Cost: 32 Bytes: 1,132,305 Cardinality: 19,865                               
                   11 VIEW VIEW SYS.VW_SQ_1 Cost: 6,612 Bytes: 2,585,376 Cardinality: 71,816                               
                        10 NESTED LOOPS Cost: 6,612 Bytes: 6,607,072 Cardinality: 71,816                          
                             8 TABLE ACCESS BY INDEX ROWID TABLE OMS.ORD_SHIP_HDR Cost: 805 Bytes: 156,114 Cardinality: 2,891                     
                                  7 BITMAP CONVERSION TO ROWIDS                
                                       6 BITMAP OR           
                                            3 BITMAP CONVERSION FROM ROWIDS      
                                                 2 INDEX RANGE SCAN INDEX OMS.ORD_SHIP_HDR_SRCE_INDX Cost: 6
                                            5 BITMAP CONVERSION FROM ROWIDS      
                                                 4 INDEX RANGE SCAN INDEX OMS.ORD_SHIP_HDR_DEST_IDX1 Cost: 1
                             9 INDEX RANGE SCAN INDEX (UNIQUE) OMS.PKORD_SHIPLN1 Cost: 2 Bytes: 950 Cardinality: 25                     
              18 VIEW OMS. Cost: 685 Bytes: 1,154,925 Cardinality: 25,665                                    
                   17 HASH UNIQUE Cost: 685 Bytes: 1,026,600 Cardinality: 25,665                               
                        16 VIEW VIEW MFIDATA.index$_join$_007 Cost: 511 Bytes: 1,026,600 Cardinality: 25,665                          
                             15 HASH JOIN                     
                                  13 INDEX RANGE SCAN INDEX MFIDATA.IDX_PROD_PERF_XREF_ROW_DELT Cost: 419 Bytes: 1,026,600 Cardinality: 25,665                
                                  14 INDEX FAST FULL SCAN INDEX (UNIQUE) MFIDATA.IND_PROD_PERF_XREF_INDEX1 Cost: 309 Bytes: 1,026,600 Cardinality: 25,665

  • Query works on Oracle 9i, but fails on Oracle 10g - puzzling...

    In porting an application from Oracle 9i to Oracle 10g, I hit a problem that for a while I assumed was some bug of mine. But I eventually isolated the problem and can reproduce this using a single sql script and then a single delete. The amazing thing is that it works fine on Oracle 9i (always) and fails on Oracle 10g (always).
    Have I found a bug? (I would be pretty amazed).
    Here's the situation. I have four tables and a trigger set on one of those tables.
    The tables are configured so that there is the "parent" table (A). Table B has a foreign key dependency on A's primary key, with "on delete cascade". Table B also has a trigger that runs on the delete. Table C (which has no data) has an integrity constraint on A's primary key. Table D holds information used by the trigger to determine if/when table C should be dropped. (I have a script that sets all this up).
    After setting up the tables and the few data records needed, I delete a record from Table A. This causes the records in Table B to be deleted. That fires the trigger, which determines that Table C can be dropped, so the trigger drops Table C. Then, Oracle decides it still needs to check the integrity constraint on Table C (after all, C depended on A and we have deleted a record in A). Oracle then issues a query against table C, but of course table C has already been dropped and an error results.
    The exact same script followed by the delete works fine on Oracle 9i. Is this a bug or is this a documented change in behavior? Any known workarounds? Unfortunately, the application needs all the integrity constraints that are present in the schema and also runs on SQL Server, so modifications in the integrity constraints are probably not what I am seeking).
    Thanks so much!
    RB

    I wasn't sure how to post the script, but it is short enough to include below. Many thanks for the quick response.
    To connect the script below to my original post, the names are:
    Table A = OT_AW_PROCESSDEF
    Table B = OT_AW_PROCESS_APPDATADEF
    Table C = OT_AW_AD_OneLoop_1
    Table D = OT_AW_APPDATA_TABLEINFO
    The trigger is also included in the script. After running this script, the command:
    delete from OT_AW_ProcessDef where processdefId = 101
    will cause the failure on Oracle10g, but succeeds on Oracle 9i.
    Thanks again!
    RB
    /* *********************** CLEAN UP ********************************** */
    /* Order the dropping of objects in reverse of creation */
    DROP TABLE OT_AW_AD_OneLoop_1 CASCADE CONSTRAINTS
    DROP TABLE OT_AW_PROCESS_APPDATADEF CASCADE CONSTRAINTS
    DROP TABLE OT_AW_APPDATA_TABLEINFO CASCADE CONSTRAINTS
    DROP TABLE OT_AW_PROCESSDEF CASCADE CONSTRAINTS
    /* ******************* DATA TABLES *********************************** */
    /* OT_AW_PROCESSDEF(Process Definition) Table */
    /* ********** NOTE: OT_AW_PROCESSDEF and AW_PROCESS TABLES SHOULD ALWAYS HAVE THE SAME SET OF COLUMNS ********* */
    create table OT_AW_PROCESSDEF (
    processDefId NUMBER /* Id for the process definition */
    , processDefName NVARCHAR2(255) /* Name of the process definition */
    , CONSTRAINT OT_AW_PROCESSDEF_PK PRIMARY KEY(processDefId)
    insert into OT_AW_PROCESSDEF (
    processDefId, processDefName
    values (
    1, 'ADHOC'
    /* OT_AW_APPDATA_TABLEINFO(List of all application Data tables in the system) Table */
    create table OT_AW_APPDATA_TABLEINFO (
    namespace VARCHAR2(65) NOT NULL, /* name of the namespace to which it belongs */
    tableName VARCHAR2(128) , /* Name of the appdata table */
    adLevel NUMBER(38) NOT NULL /* Appdata table level: 0=>PROCESS, 1=>CONVERSATION */
    , CONSTRAINT OT_AW_APPDATA_TABLEINFO_PK PRIMARY KEY ( tableName )
    , CONSTRAINT OT_AW_APPDATA_TABLEINFO_UNQ UNIQUE( namespace, tableName, adLevel )
    /* OT_AW_PROCESS_APPDATADEF(Process level application data definition) Table */
    create table OT_AW_PROCESS_APPDATADEF (
    processDefId NUMBER NOT NULL /* Id for the process definition */
    , name VARCHAR2(65) NOT NULL /* Name of the application data field, This name may be pointing to a shared namespace field */
    , tableName VARCHAR2(128) /* Name of the table that holds the value for the field, may be same as local namespace table name */
    , namespace VARCHAR2(65) NOT NULL /* Name of the namespace to which this field belongs */
    , mappedNamespace VARCHAR2(65) null /* Name of the shared namespace to which this field is mapped, if there is any mapping */
    , CONSTRAINT OT_AW_PROCESS_APPDATADEF_PK PRIMARY KEY (namespace, processDefId, name)
    , CONSTRAINT OT_AW_PROCESS_APPDATADEF_FK FOREIGN KEY (processDefId) REFERENCES OT_AW_PROCESSDEF(processDefId) on delete cascade
    CREATE TABLE OT_AW_AD_OneLoop_1(processDefId number , processId number ,FromRole number null, ToRole number null, Anyone number null,
    CONSTRAINT OT_AW_AD_OneLoop_1_FK1 FOREIGN KEY (processDefId) REFERENCES OT_AW_PROCESSDEF(processDefId) )
    /* TRIGGERS */
    CREATE OR REPLACE TRIGGER OT_AW_PROCESS_APPDATADEF_DEL
    AFTER DELETE ON OT_AW_PROCESS_APPDATADEF
    FOR EACH ROW
    DECLARE
    PRAGMA AUTONOMOUS_TRANSACTION;
    tableName_var OT_AW_PROCESS_APPDATADEF.tableName%TYPE;
    tempStr_var varchar2(128) :=null;
    deletedId OT_AW_PROCESS_APPDATADEF.processDefId%TYPE;
    deletedMNsp OT_AW_PROCESS_APPDATADEF.mappedNamespace%TYPE;
    numReferences number :=-1;
    tableExists number :=0;
    CURSOR ADPTable_cursor
    IS
    SELECT apa.tableName, apa.processDefId, apa.mappedNamespace
    FROM OT_AW_PROCESS_APPDATADEF apa
    WHERE apa.tableName = :old.tableName
    AND apa.processDefId = :old.processDefId;
    BEGIN
    dbms_output.put_line('Starting TRIGGER OT_AW_PROCESS_APPDATADEF_DEL');
    OPEN ADPTable_cursor;
    LOOP
    FETCH ADPTable_cursor
    INTO tableName_var, deletedId, deletedMNsp;
    EXIT WHEN ADPTable_cursor%NOTFOUND;
    BEGIN
    IF (deletedMNsp IS NULL) THEN
    BEGIN
    select count(*) into numReferences from OT_AW_PROCESS_APPDATADEF where tableName = tableName_var
    and processDefId <> deletedId;
    IF ( numReferences = 0 ) THEN
    BEGIN
    SELECT count(*) INTO tableExists FROM OT_AW_APPDATA_TABLEINFO where
              tableName=tableName_var;
    IF (tableExists > 0) THEN
    BEGIN
    --dbms_output.put_line('About to alter first table');
    -- EXECUTE IMMEDIATE 'ALTER TABLE ' || tableName_var || ' DROP CONSTRAINT ' || tableName_var ||'_FK1';
    --dbms_output.put_line('About to alter second table');
    -- EXECUTE IMMEDIATE 'ALTER TABLE ' || tableName_var || ' DROP CONSTRAINT ' || tableName_var ||'_FK2';
    dbms_output.put_line('About to drop table named: ' || tableName_var);
    tempStr_var := 'DROP TABLE ' || tableName_var;
    EXECUTE IMMEDIATE tempStr_var;
    dbms_output.put_line(tempStr_var);
    dbms_output.put_line('Table dropped');
    --dbms_output.put_line('Not dropping table now');
    END;
    END IF;
    delete from OT_AW_APPDATA_TABLEINFO where
              tableName=tableName_var;
    dbms_output.put_line('OT_AW_APPDATA_TABLEINFO updated');           
    END;
    END IF;
    END;
    END IF;
    END;
    END LOOP;
    dbms_output.put_line('Loop ended');
    CLOSE ADPTable_cursor;
    dbms_output.put_line('Cursor closed');
    COMMIT WORK;
    dbms_output.put_line('Work committed');
    dbms_output.put_line('Ending TRIGGER OT_AW_PROCESS_APPDATADEF_DEL');
    END;
    show errors;
    /* Set up data to simulate the creation of OT_AW_AD_OneLoop_1 */
    insert into OT_AW_PROCESSDEF (
    processDefId, processDefName
    values (
    101, 'OneLoop'
    insert into OT_AW_PROCESS_APPDATADEF (
    processDefId, name, tableName, namespace
    values (
    101, 'FromRole', 'OT_AW_AD_OneLoop_1', 'OneLoop'
    insert into OT_AW_PROCESS_APPDATADEF (
    processDefId, name, tableName, namespace
    values (
    101, 'ToRole', 'OT_AW_AD_OneLoop_1', 'OneLoop'
    insert into OT_AW_APPDATA_TABLEINFO (
    namespace, tablename, adlevel
    values (
    'OneLoop', 'OT_AW_AD_OneLoop_1', 0
    /

  • Oracle 11g- Straing behaviour of query after importing from Oracle 10g

    Hi,
    I have a table in Oracle 10g as follows:
    Create Table xyz (col1 varchar2(50), col2 varchar2(50));
    With following Data
    Col1     Col2
    A     320
    A     110
    A     290
    A     380
    B     ABC
    B     256
    B     LMN
    I am running following Query
    select * from xyz
    Where Col1='A' and Col2=110
    It works fine. But when I export this table and import it in Oracle 11g. It says invlid identifier.
    But if I enclose 110 in single quotes. It works fine.
    Also If I recreate this table in Oracle 11g like
    Create table xyz1
    as select * from xyz;
    Now alos I am able to run this query smoothly.
    select * from xyz1
    Where Col1='A' and Col2=110
    What is wrong exporting this table from 10g to 11g.
    Any comments/suggestion??
    Aarbi

    The check in your where clause
    Col2=110Is comparing a string (Col2 is defined as a VARCHAR) with a numeric literal, so there will be an implicit conversion taking place from character to number. The query then fails due to the B LMN row when 'LMN' fails number conversion.
    I'm guessing there was there an index on the table in your 10g installation which would allow the query to be satisfied without checking the B ABC or B LMN rows but is not present or not used in the 11g installation so a full table scan results in an attempt to convert 'ABC' and 'LMN' to a number. Check the explain plans.
    Or it could even just be a difference in the order in which the two conditions in the where clause are evaulated between the two versions.
    The solution, as you have already found is to do a string comparision
    Col2='110'Edited by: Cyn on Dec 7, 2009 12:38 PM

  • Archive log mode in oracle 10g on windows environment

    Hi All,
    I have a production database (Oracle 10g 10.2.0.1.0) on windows 2003 server. yesterday i put the database into archivelog mode. when i query for spfile location it is shown in ORACLE_HOME\dbs location.
    but when i created pfile using the spfile it is created at ORACLE_HOME\database location. and there is another spfile also. i set the log_archive_dest at a location other than flash_recovery_area in pfile, but it is showing the DB_RECOVER_AREA.
    today i seen archives are creating in both locations.
    can a database have two spfiles. and working on them ?
    can i remove a spfile in /dbs location.
    pls. give me suggestion to rectify this
    thanks and regards.

    Salman Qureshi wrote:
    Hi,
    On windows platform, spfile and initfiles are by default created under ORACLE_HOME\database directory and this is also the default location, so, your spfile or initfile in this directory are actually in use.
    i set the log_archive_dest at a location other than flash_recovery_area in pfile, but it is showing the DB_RECOVER_AREA. You need to unset the "db_recovery_file_dest" parameter first.
    alter system set db_recovery_file_dest='';Now set your log_archive_dest as follows
    alter system set log_archive_dest_1="location=your_location";Don't user older "log_archive_dest" parameter
    SalmanYour assertion that "You need to unset the "db_recovery_file_dest" parameter first." is patently false.
    DB_RECOVERY_FILE_DEST is used for more than just archivelogs. Setting LOG_ARCHIVE_DEST_n to a location other than USE_DB_RECOVERY_FILE_DEST even while DB_RECOVERY_FILE_DEST is set is perfectly acceptable. In fact it is required if you want to continue to use the FRA for things other than archivelogs. Things, like - oh, say - backups!
    =~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2011.02.15 07:42:18 =~=~=~=~=~=~=~=~=~=~=~=
    login as: oracle
    oracle@vmlnx01's password:
    Last login: Tue Feb 15 07:01:51 2011 from 192.168.160.1
    [oracle@vmlnx01 ~]$ sqlplus / as sysdbaFirst, note the date and time of logon, to compare to archivelog timestamps later ...
    SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 15 07:42:27 2011
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing optionsNext, note the values for the log_archive_dest_n parameters. Actually, the value for #10 is the default if no log_arch_dest_n parms are set, but I like to set it explicitly to avoid ambiguity.
    SQL> show parameter log_archive_dest_
    NAME     TYPE VALUE
    log_archive_dest_1     string
    log_archive_dest_10     string LOCATION=USE_DB_RECOVERY_FILE_
    DEST
    log_archive_dest_2     string
    log_archive_dest_3     string
    log_archive_dest_4     string
    log_archive_dest_5     string
    log_archive_dest_6     string
    log_archive_dest_7     string
    log_archive_dest_8     string
    log_archive_dest_9     string
    NAME     TYPE VALUE
    log_archive_dest_state_1     string enable
    log_archive_dest_state_10     string enable
    log_archive_dest_state_2     string enable
    log_archive_dest_state_3     string enable
    log_archive_dest_state_4     string enable
    log_archive_dest_state_5     string enable
    log_archive_dest_state_6     string enable
    log_archive_dest_state_7     string enable
    log_archive_dest_state_8     string enable
    log_archive_dest_state_9     string enableAnd note the setting for db_recovery_file_dest ...
    SQL> show parameter db_recovery_file_dest
    NAME     TYPE VALUE
    db_recovery_file_dest     string /orafra
    db_recovery_file_dest_size     big integer 4GNow lets check what's in the recovery dest. Notice there is no directory timestamped today (15 Feb), so no archivelogs have been generated for today.
    SQL> !ls -l /orafra/VLNXORA1/archivelog
    total 28
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_08
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_09
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_10
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_11
    drwxr-x--- 2 oracle oinstall 4096 Feb 12 06:00 2011_02_12
    drwxr-x--- 2 oracle oinstall 4096 Feb 13 11:00 2011_02_13
    drwxr-x--- 2 oracle oinstall 4096 Feb 14 22:00 2011_02_14So lets force a log switch and check the results
    SQL> alter system switch logfile;
    System altered.
    SQL> !ls -l /orafra/VLNXORA1/archivelog
    total 32
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_08
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_09
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_10
    drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_11
    drwxr-x--- 2 oracle oinstall 4096 Feb 12 06:00 2011_02_12
    drwxr-x--- 2 oracle oinstall 4096 Feb 13 11:00 2011_02_13
    drwxr-x--- 2 oracle oinstall 4096 Feb 14 22:00 2011_02_14
    drwxr-x--- 2 oracle oinstall 4096 Feb 15 07:43 2011_02_15
    SQL> !ls -l /orafra/VLNXORA1/archivelog/2011_02_15
    total 1892
    -rw-r----- 1 oracle oinstall 1931776 Feb 15 07:43 o1_mf_1_82_6oo0qomc_.arcSo we see that, as expected, the archivelog was written to the FRA. Note the log sequence # of 82
    Also, let's check my "alternate" location, as yet undefinded to the db ..
    SQL> !ls -l /oraarch/vlnxora1
    total 0No files there.
    Now we will change the archivelog destination. Note that I am NOT touching the FRA definition
    SQL> alter system set log_archive_dest_1='location=/oraarch/vlnxora1' scope=both;
    System altered.
    SQL> alter system set log_archive_dest_10 = '' SCOPE=both;
    System altered.
    SQL> show parameter log_archive_dest_
    NAME     TYPE VALUE
    log_archive_dest_1     string location=/oraarch/vlnxora1
    log_archive_dest_10     string
    log_archive_dest_2     string
    log_archive_dest_3     string
    log_archive_dest_4     string
    log_archive_dest_5     string
    log_archive_dest_6     string
    log_archive_dest_7     string
    log_archive_dest_8     string
    log_archive_dest_9     string
    log_archive_dest_state_1     string enable
    NAME     TYPE VALUE
    log_archive_dest_state_10     string enable
    log_archive_dest_state_2     string enable
    log_archive_dest_state_3     string enable
    log_archive_dest_state_4     string enable
    log_archive_dest_state_5     string enable
    log_archive_dest_state_6     string enable
    log_archive_dest_state_7     string enable
    log_archive_dest_state_8     string enable
    log_archive_dest_state_9     string enable
    SQL> show parameter db_recovery_file_dest
    NAME     TYPE VALUE
    db_recovery_file_dest     string /orafra
    db_recovery_file_dest_size     big integer 4GSo, above we see that I do not have an archivelog destination set to the FRA, but the FRA is still set. I did not unset it, as you asserted was necessary. I still want my backups to go there.
    Next we'll do another log switch and check the results.
    SQL> alter system switch logfile;
    System altered.First, we'll check the (now unused) FRA destination. Notice that there is still just the one archivelog, sequence 82.
    SQL> !ls -l /orafra/VLNXORA1/archivelog/2011_02_15
    total 1892
    -rw-r----- 1 oracle oinstall 1931776 Feb 15 07:43 o1_mf_1_82_6oo0qomc_.arcNow check the new, non-fra destination. Notice that it now has an archivelog, sequence 83
    SQL> !ls -l /oraarch/vlnxora1
    total 96
    -rw-r----- 1 oracle oinstall 92160 Feb 15 07:45 1_83_732127364.dbf
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@vmlnx01 ~]$ exit
    logout

  • ORA-22275 writing BLOB using Oracle 10g

    Am trying to INSERT a record including a BLOB. Using Visual C++ 6.0, Oracle 10g, and Oracle ODBC Driver.
    Setup calls to SQLAllocStmt, SQLBindParameter (for the BLOB, only), and SQL_LEN_DATA_AT_EXEC all are ok as far as can be told. (Return code is zero.)
    After setup calls, call to SQLExecDirect returns -1 (error with info) and the info is error ORA-22275 (invalid LOB locator specified). (Was expecting 99 (SQL_NEED_DATA) to start feeding LOB data.)
    This same code ran under Oracle 9i, but fails under 10g. Did not even rebuild the code.
    Does anyone have any ideas?
    Thanks in advance

    This was resolved in the latest 10g ODBC driver (10.1.0.3.1)
    Jon

Maybe you are looking for