Abot oracle.sql.opaque exception

Wheen I run a program which is retreiving xmltype data from databse using a application then it works fine. But If I use jsp for same a deploy it on OC4jJ server it fgives exception at this line
xml = (XMLType)resultSet.getObject(1);
Excpeuin is ClassCasrtException: oracle.sql.OPAQUE
Please expalon. Methis is given below it works fine with application
public Vector doSelect (String keywords[]) throws Exception
//System.out.println("++++ Start of doSelect() method ++++");
// String SQLTEXT="SELECT extract(warehouse_spec,'/"+ str + "') as XMLDocument FROM WAREHOUSES";
/* select extract (value(t),'/VideoSubIndex')
* from mastersvideo x,TABLE (xmlsequence (
* extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t
* where existnode(value(t),'/VideoSubIndex[Transcription="So basically"]')=1
// String SQLTEXT="SELECT extract(x.vindex,'/VideoIndexes/VideoSubIndex/Transcription') as XMLDocument FROM mastersvideo x"+
// " where existsnode(x.vindex,'/VideoIndexes/VideoSubIndex[Transcription=\"So basically\"]')=1";
String SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[Transcription=\"So basically\"]')=1";
// String SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\"way\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
//keywords="sql";
//description="basically";
for(int i=0;i<keywords.length;i++)
System.out.println("KeyWords Received"+keywords);
String SQLTEXT=null;
if (keywords.length>0)
SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[ora:contains(@KeyTerm,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1"+
" OR existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
for(int i=1;i<keywords.length;i++)
System.out.println("Value of i "+i+" And Value Here"+keywords[i]);
SQLTEXT+=" OR existsnode(value(t),'/VideoSubIndex[ora:contains(@KeyTerm,\""+keywords[i]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1"+
" OR existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\""+keywords[i]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
// SQLTEXT+=
// Running Query
// String SQLTEXT="select extract (value(t),'/VideoSubIndex') from mastersvideo x,TABLE (xmlsequence (extract (x.vindex,'/VideoIndexes/VideoSubIndex'))) t where existsnode(value(t),'/VideoSubIndex[ora:contains(@KeyTerm,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1"+
// " OR existsnode(value(t),'/VideoSubIndex[ora:contains(Transcription,\""+keywords[0]+"\")>0]','xmlns:ora=\"http://xmlns.oracle.com/xdb\"')=1";
//System.out.println(SQLTEXT);
OraclePreparedStatement sqlStatement = null;
//OracleResultSet resultSet = null;
ResultSet resultSet = null;
oracle.xdb.XMLType xml = null;
try
System.out.println("SQL := " + SQLTEXT);
sqlStatement = (OraclePreparedStatement) getConnection("scott","tiger").prepareStatement(SQLTEXT);
System.out.println("+++++ OraclePreparedStatement created +++++");
// resultSet = (OracleResultSet) sqlStatement.executeQuery();
resultSet = sqlStatement.executeQuery();
System.out.println("***** Query Executed *****");
// return resultSet;
Vector resVector=new Vector();
while(resultSet.next())
System.out.println("Hello Miss World");
xml = (XMLType)resultSet.getObject(1);
//System.out.println("Hello World");
resVector.add(xml);
// xml.get
System.out.println(xml.getStringVal());
//System.out.println("Hello Miss World");
System.out.println("Vector size is "+resVector.size());
return resVector;
catch(NullPointerException npe)
catch (SQLException SQLe)
if (sqlStatement != null)
sqlStatement.close();
throw SQLe;
/*if(resultSet!=null)
resultSet.close();
System.out.println("**** Resultset closed ****");
if(sqlStatement!=null)
sqlStatement.close();
System.out.println("**** Resultset closed ****");
System.out.println("### Returning Vector ###");
return null;
} // End of Function doSelect()

I believe the 9.2 XDK requires the use of the 9.2 JDBC drivers.
In general, later versions of the JDBC driver will work with older versions of the database, but not vice versa. The 8.1.7 JDBC drivers won't necessarily work with a 9.2 database, but the 9.2 JDBC drivers will work with an 8.1.7 database.
Justin

Similar Messages

  • NoClassDefFoundError: oracle/sql/OPAQUE

    I've got some configuration problem with the XSU utility. It runs the getXML with all these settings fine. But when I run the putXML I get this result:
    C:\Documents and Settings\kstclair>java OracleXML putXML -user "jandj/xprojxabc" -conn "jdbc:oracle:thin:@10.1.10.11:1521:UNIT1" -fileName "/testXML/transformed.goodusers.xml" user_data
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/sql/OPAQUE
    at OracleXML.Put_XML(OracleXML.java:444)
    at OracleXML.ExecutePutXML(OracleXML.java:397)
    at OracleXML.main(OracleXML.java:181)
    Anybody seen this and know what it means? I've looked in most of the jars and can't even find this package sequence.

    Oops. I don't know if I missed in the doco, or if it's not there. If you use Oracle 8.1.7, then don't use the xsu12.jar. It will seem to work, and will even respond to getXML commands. But apparently you need to use the xsu12_817.jar instead. Most of the doco and examples are written for 9i users, so this point gets missed.

  • Oracle.sql.Opaque

    Hi, I am using the JDBC drivers for Oracle 8.1.7 (classes12.zip ( 1,892 kB)) and when i am trying to generate xml using XDK (xdk_java_9_2_0_5_0.zip). If i use methods like insertXML or OracleXMLSave it throws me an exception: Exception in thread "main" java.lang.NoClassDefFoundError: oracle/sql/OPAQUE.
    Then I use the driver for 9i (classes12.zip (1,143,559 bytes)) and it works fine, but I want to know what am I doing wrong, because my base document is Oracle 8i Application Developer’s Guide - XML. And I think these drivers have to work.
    Another issue, thinking about performance and throughput, what driver should i use if my bd is 8.1.7, is it better to work with the specific version or the lastest?
    Thanks

    I believe the 9.2 XDK requires the use of the 9.2 JDBC drivers.
    In general, later versions of the JDBC driver will work with older versions of the database, but not vice versa. The 8.1.7 JDBC drivers won't necessarily work with a 9.2 database, but the 9.2 JDBC drivers will work with an 8.1.7 database.
    Justin

  • Class oracle.sql.OPAQUE not found in class oracle.xdb.XMLType

    I have the following code written in java in a unix box and this is the error I get when compiling the code. I am not able to find which specific jar or class file I need, Kindly help.
    XMLHelper.java:0: Class oracle.sql.OPAQUE not found in class oracle.xdb.XMLType.
    ^
    1 error
    OracleResultSet orst = .... some code to get data
    orst.next();
    //either of the following 2 lines give the same error
    //XMLType dXml = XMLType.createXML(orst.getOPAQUE(1)) ;
    XMLType dXml = (XMLType)orst.getObject(i);
    xmlDoc = dXml.getDOM();
    Please help

    Hello,
    from the little information in your post i would say try to import oracle.sql.*, oracle.jdbc.* and oracle.xdb.*. Make sure your project can access the following libraries ojdbc14.jar and xdb.jar.
    Regards, Marc

  • NoClassDefFound error oracle/sql/opaque

    Hi There,
    [Using Java 1.4.2, BEA WebLogic 8.1, Oracle 9i Db]
    We're having a bit of trouble with the above error.
    In our java code, we are referencing xdb.jar and odbc14.jar but when we try to create an XMLTYPE object from an OPAQUE object we receive the NoClassDefFound error.
    Anyone with any ideas on how to get around this please?
    Many thanks,
    Neil

    Hi,
    I had the same problem...
    Put the xsu12_817.jar or xsu12_816.jar (depends on RDBMS version) in your CLASSPATH instead of xsu12.jar. (you can find xsu12_817.jar and xsu12_816.jar files in Oracle XDK).
    It should work.
    Regards
    Sash

  • I need a oracle.sql.OPAQUE

    Where are thi class. ???

    It comes with the classes12.zip of Oracle client or database. The classes12.zip is present in the folder
    <oracle_home>\jdbc\lib\classes12.zip
    where <oracle_home> is the place where oracle is installed.
    Regards,
    Anupama
    http://otn.oracle.com/sample_code/content.html

  • Mac OS X SQL Developer Exception initializing 'oracle.dbtools.raptorDBAddin

    I can't get the DB Connnection wizard to startup, probably because Raptor didn't initialize properly. I've cleaned out ~/.sqldeveloper, I've added the
    appropriate NLS lines to sqldeveloper.conf:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=US
    AddVMOption -Duser.region=US
    and I'm using the latest download sqldeveloper-5783-macosx.tar.gz.
    Java is:
    java -version
    java version "1.6.0_07"
    Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
    Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
    Mac OS Version is 10.5.6 on a MacBook Pro.
    I also have Instant_client_10_2 installed. Perhaps the libraries from this are interfering in some way?
    Can anyone please help?
    Exception stack follows. This stack was displayed in a terminal window:
    cd /Applications/SQLDeveloper.app/Contents/MacOS
    bash ./sqldeveloper.sh
    Exception initializing 'oracle.dbtools.raptor.RaptorDBAddin' in extension 'Oracle SQL Developer': java.lang.NoSuchMethodError: oracle.i18n.util.GDKOracleMetaData.getDataPath()Ljava/lang/String;
    at oracle.i18n.text.OraBoot.&lt;clinit&gt;(OraBoot.java:72)
    at oracle.i18n.util.OraLocaleInfo.&lt;init&gt;(OraLocaleInfo.java:197)
    at oracle.i18n.util.OraLocaleInfo.getInstance(OraLocaleInfo.java:272)
    at oracle.dbtools.raptor.config.DBConfig.&lt;clinit&gt;(DBConfig.java:286)
    at oracle.dbtools.raptor.RaptorDBAddin.initialize(RaptorDBAddin.java:111)
    at oracle.ideimpl.extension.AddinManagerImpl.initializeAddin(AddinManagerImpl.java:405)
    at oracle.ideimpl.extension.AddinManagerImpl.initializeAddins(AddinManagerImpl.java:214)
    at oracle.ideimpl.extension.AddinManagerImpl.initProductAndUserAddins(AddinManagerImpl.java:128)
    at oracle.ide.IdeCore.initProductAndUserAddins(IdeCore.java:1804)
    at oracle.ide.IdeCore.startupImpl(IdeCore.java:1481)
    at oracle.ide.Ide.startup(Ide.java:662)
    at oracle.ideimpl.DefaultIdeStarter.startIde(DefaultIdeStarter.java:35)
    at oracle.ideimpl.Main.start(Main.java:110)
    at oracle.ideimpl.Main.main(Main.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at oracle.ide.boot.PCLMain.callMain(PCLMain.java:66)
    at oracle.ide.boot.PCLMain.main(PCLMain.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at oracle.classloader.util.MainClass.invoke(MainClass.java:128)
    at oracle.ide.boot.IdeLauncher.bootClassLoadersAndMain(IdeLauncher.java:190)
    at oracle.ide.boot.IdeLauncher.launchImpl(IdeLauncher.java:90)
    at oracle.ide.boot.IdeLauncher.launch(IdeLauncher.java:66)
    at oracle.ide.boot.IdeLauncher.main(IdeLauncher.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at oracle.ide.boot.Launcher.invokeMain(Launcher.java:729)
    at oracle.ide.boot.Launcher.launchImpl(Launcher.java:115)
    at oracle.ide.boot.Launcher.launch(Launcher.java:68)
    at oracle.ide.boot.Launcher.main(Launcher.java:57)
    Exception initializing 'oracle.dbtools.raptor.standalone.RaptorStandaloneAddin' in extension 'Oracle SQL Developer Extras': java.lang.NoClassDefFoundError: Could not initialize class oracle.dbtools.raptor.config.DBConfig
    at oracle.dbtools.raptor.utils.URLChooserShortcuts.&lt;clinit&gt;(URLChooserShortcuts.java:39)
    at oracle.dbtools.raptor.standalone.RaptorStandaloneAddin.initialize(RaptorStandaloneAddin.java:182)
    at oracle.ideimpl.extension.AddinManagerImpl.initializeAddin(AddinManagerImpl.java:405)
    at oracle.ideimpl.extension.AddinManagerImpl.initializeAddins(AddinManagerImpl.java:214)
    at oracle.ideimpl.extension.AddinManagerImpl.initProductAndUserAddins(AddinManagerImpl.java:128)
    at oracle.ide.IdeCore.initProductAndUserAddins(IdeCore.java:1804)
    at oracle.ide.IdeCore.startupImpl(IdeCore.java:1481)
    at oracle.ide.Ide.startup(Ide.java:662)
    at oracle.ideimpl.DefaultIdeStarter.startIde(DefaultIdeStarter.java:35)
    at oracle.ideimpl.Main.start(Main.java:110)
    at oracle.ideimpl.Main.main(Main.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at oracle.ide.boot.PCLMain.callMain(PCLMain.java:66)
    at oracle.ide.boot.PCLMain.main(PCLMain.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at oracle.classloader.util.MainClass.invoke(MainClass.java:128)
    at oracle.ide.boot.IdeLauncher.bootClassLoadersAndMain(IdeLauncher.java:190)
    at oracle.ide.boot.IdeLauncher.launchImpl(IdeLauncher.java:90)
    at oracle.ide.boot.IdeLauncher.launch(IdeLauncher.java:66)
    at oracle.ide.boot.IdeLauncher.main(IdeLauncher.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at oracle.ide.boot.Launcher.invokeMain(Launcher.java:729)
    at oracle.ide.boot.Launcher.launchImpl(Launcher.java:115)
    at oracle.ide.boot.Launcher.launch(Launcher.java:68)
    at oracle.ide.boot.Launcher.main(Launcher.java:57)
    Exception in thread "XML Action Loader" java.lang.NoClassDefFoundError: Could not initialize class oracle.dbtools.raptor.config.DBConfig
    at oracle.dbtools.raptor.dialogs.actions.XMLBasedObjectAction$1$1.run(XMLBasedObjectAction.java:148)
    Exception in thread "EditorLoader" java.lang.NoClassDefFoundError: Could not initialize class oracle.dbtools.raptor.config.DBConfig
    at oracle.dbtools.raptor.oviewer.base.ViewerAddin.loadXMLEditors(ViewerAddin.java:235)
    at oracle.dbtools.raptor.oviewer.base.ViewerAddin$1$1.run(ViewerAddin.java:142)
    at java.lang.Thread.run(Thread.java:637)
    tethys:MacOS mbs$

    Setting ORACLE_HOME as below made no difference in the exception stack (same as reported above).
    $ echo $ORACLE_HOME
    /Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper
    ls $ORACLE_HOME
    BC4J               jdbc               raptor_image.jpg     sqldeveloper
    dvt               jdev               rdbms               sqldeveloper.sh
    icon.png          jlib               relnotes.html          timingframework
    ide               lib               sqlcli
    j2ee               otn_new.css          sqlcli.bat
    Was this the correct ORACLE_HOME value to try?
    Does anyone know the names and locations of the libraries that are likely to be conflicting (if that
    is indeed the problem...)?

  • Exception: oracle/sql/Datum [oracle.sql.Datum

    The following statement is throwing an exception in Servlet,
    OracleXMLQuery qry = new OracleXMLQuery(conn,sqlString);
    Where can I find the oracle.sql.Datum class
    Thank you,
    Chandra
    null

    Murali K (guest) wrote:
    : Hi Chandra,
    : What version of Oracle are u using ? (Oracle 8.0.5 or
    : Oracle8i?). Cause the object features were supported in JDBC
    : only in Oracle8i. (i.e. JDBC 8.0.4 etc.. does not support
    : objects, only JDBC 8.1.5 onwards supports it)..
    : The most likely case is that you are trying to use object
    : features, using JDBC 8.0 classes.
    : If this is not the case, please let us know (along with the
    : version of JDBC and Oracle that u are using), so that we can
    : look in to it.
    : Thanks
    : Murali
    : Chandra (guest) wrote:
    : : The following statement is throwing an exception in Servlet,
    : : OracleXMLQuery qry = new OracleXMLQuery(conn,sqlString);
    : : Where can I find the oracle.sql.Datum class
    : : Thank you,
    : : Chandra
    Hi Murali,
    I am using Oracle JDBC Drivers Ver. 8.0.4.0.5, connecting to
    Oracle database Ver. 7.3.4.0.1. This is working fine in my java
    applet running on appletviewer. After moving the JDBC
    connection code from applet to Servlet running on JRun web
    server, I got the exception. In both the cases I am using the
    same JDBC drivers.
    Thank you.
    Chandra
    null

  • ClassCast Exception at oracle.sql.BLOB.createTemporary

    Hi...
    I am facing a problem that when I am trying to open a temporary BLOB, I am getting a ClassCastException. Below is a part of stack trace:
    java.lang.ClassCastException: weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_T4CConnection_1034_WLStub
    at oracle.sql.BLOB.createTemporary(BLOB.java:684)
    I am using Weblogic 10.3.4.0 with Jrocket 1.6 Update 24 in my JAVA_HOME.
    Initially I thought this is a JDBC driver problem, then I tried with ojdbc14.jar, ojdbc5.jar, ojdbc6.jar but same result.
    With more googling I found some other reasons like:
    "Problem which seems to be that despite the fact that method BLOB.createTemporary takes a java.sql.Connection object as a parameter, it only works if the Connection is an oracle.jdbc.driver.OracleConnection object. If it's not an oracle.jdbc.driver.OracleConnection, then I get a ClassCastException. "
    I also found out that the problem happens because when I run my code in Weblogic and get the database connection via a DataSource object that I lookup via JNDI, the connection is not a real OracleConnection object, but an object that wraps the real OracleConnection.
    Now the question is how do I solve this? In My DataSource->Connection Pool-> I have unchecked the "Wrap Data Types" and it still it doesn't work.
    Not using Connection Pool is out of the question as this is not a viable solution.
    Feel free to ask me whatever details you want, but need a urgent solution for this.
    Regards,
    Priyam

    If you are using OCI driver, you may check whether using thin driver would avoid ClassCastException.

  • PL/SQL 101 : Exception Handling

    Frequently I see questions and issues around the use of Exception/Error Handling in PL/SQL.  More often than not the issue comes from the questioners misunderstanding about how PL/SQL is constructed and executed, so I thought I'd write a small article covering the key concepts to give a clear picture of how it all hangs together. (Note: the examples are just showing examples of the exception handling structure, and should not be taken as truly valid code for ways of handling things)
    Exception Handling
    Contents
    1. Understanding Execution Blocks (part 1)
    2. Execution of the Execution Block
    3. Exceptions
    4. Understanding Execution Blocks (part 2)
    5. How to continue exection of statements after an exception
    6. User defined exceptions
    7. Line number of exception
    8. Exceptions within code within the exception block
    1. Understanding Execution Blocks (part 1)
    The first thing that one needs to understand is almost taking us back to the basics of PL/SQL... how a PL/SQL execution block is constructed.
    Essentially an execution block is made of 3 sections...
    +---------------------------+
    |    Declaration Section    |
    +---------------------------+
    |    Statements  Section    |
    +---------------------------+
    |     Exception Section     |
    +---------------------------+
    The Declaration section is the part defined between the PROCEDURE/FUNCTION header or the DECLARE keyword (for anonymous blocks) and the BEGIN keyword.  (Optional section)
    The Statements section is where your code goes and lies between the BEGIN keyword and the EXCEPTION keyword (or END keyword if there is no EXCEPTION section).  (Mandatory section)
    The Exception section is where any exception handling goes and lies between the EXCEPTION keyword at the END keyword. (Optional section)
    Example of an anonymous block...
    DECLARE
      .. declarative statements go here ..
    BEGIN
      .. code statements go here ..
    EXCEPTION
      .. exception handlers go here ..
    END;
    Example of a procedure/function block...
    [CREATE OR REPLACE] (PROCEDURE|FUNCTION) <proc or fn name> [(<parameters>)] [RETURN <datatype>] (IS|AS)
      .. declarative statements go here ..
    BEGIN
      .. code statements go here ..
    EXCEPTION
      .. exception handlers go here ..
    END;
    (Note: The same can also be done for packages, but let's keep it simple)
    2. Execution of the Execution Block
    This may seem a simple concept, but it's surprising how many people have issues showing they haven't grasped it.  When an Execution block is entered, the declaration section is processed, creating a scope of variables, types , cursors, etc. to be visible to the execution block and then execution enters into the Statements section.  Each statment in the statements section is executed in turn and when the execution completes the last statment the execution block is exited back to whatever called it.
    3. Exceptions
    Exceptions generally happen during the execution of statements in the Statements section.  When an exception happens the execution of statements jumps immediately into the exception section.  In this section we can specify what exceptions we wish to 'capture' or 'trap' and do one of the two following things...
    (Note: The exception section still has access to all the declared items in the declaration section)
    3.i) Handle the exception
    We do this when we recognise what the exception is (most likely it's something we expect to happen) and we have a means of dealing with it so that our application can continue on.
    Example...
    (without the exception handler the exception is passed back to the calling code, in this case SQL*Plus)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3  begin
      4    select ename
      5    into   v_name
      6    from   emp
      7    where  empno = &empno;
      8    dbms_output.put_line(v_name);
      9* end;
    SQL> /
    Enter value for empno: 123
    old   7:   where  empno = &empno;
    new   7:   where  empno = 123;
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 4
    (with an exception handler, we capture the exception, handle it how we want to, and the calling code is happy that there is no error for it to report)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3  begin
      4    select ename
      5    into   v_name
      6    from   emp
      7    where  empno = &empno;
      8    dbms_output.put_line(v_name);
      9  exception
    10    when no_data_found then
    11      dbms_output.put_line('There is no employee with this employee number.');
    12* end;
    SQL> /
    Enter value for empno: 123
    old   7:   where  empno = &empno;
    new   7:   where  empno = 123;
    There is no employee with this employee number.
    PL/SQL procedure successfully completed.
    3.ii) Raise the exception
    We do this when:-
    a) we recognise the exception, handle it but still want to let the calling code know that it happened
    b) we recognise the exception, wish to log it happened and then let the calling code deal with it
    c) we don't recognise the exception and we want the calling code to deal with it
    Example of b)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3    v_empno NUMBER := &empno;
      4  begin
      5    select ename
      6    into   v_name
      7    from   emp
      8    where  empno = v_empno;
      9    dbms_output.put_line(v_name);
    10  EXCEPTION
    11    WHEN no_data_found THEN
    12      INSERT INTO sql_errors (txt)
    13      VALUES ('Search for '||v_empno||' failed.');
    14      COMMIT;
    15      RAISE;
    16* end;
    SQL> /
    Enter value for empno: 123
    old   3:   v_empno NUMBER := &empno;
    new   3:   v_empno NUMBER := 123;
    declare
    ERROR at line 1:
    ORA-01403: no data found
    ORA-06512: at line 15
    SQL> select * from sql_errors;
    TXT
    Search for 123 failed.
    SQL>
    Example of c)
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_name VARCHAR2(20);
      3    v_empno NUMBER := &empno;
      4  begin
      5    select ename
      6    into   v_name
      7    from   emp
      8    where  empno = v_empno;
      9    dbms_output.put_line(v_name);
    10  EXCEPTION
    11    WHEN no_data_found THEN
    12      INSERT INTO sql_errors (txt)
    13      VALUES ('Search for '||v_empno||' failed.');
    14      COMMIT;
    15      RAISE;
    16    WHEN others THEN
    17      RAISE;
    18* end;
    SQL> /
    Enter value for empno: 'ABC'
    old   3:   v_empno NUMBER := &empno;
    new   3:   v_empno NUMBER := 'ABC';
    declare
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 3
    SQL> select * from sql_errors;
    TXT
    Search for 123 failed.
    SQL>
    As you can see from the sql_errors log table, no log was written so the WHEN others exception was the exception that raised the error to the calling code (SQL*Plus)
    4. Understanding Execution Blocks (part 2)
    Ok, so now we understand the very basics of an execution block and what happens when an exception happens.  Let's take it a step further...
    Execution blocks are not just a single simple block in most cases.  Often, during our statements section we have a need to call some reusable code and we do that by calling a procedure or function.  Effectively this nests the procedure or function's code as another execution block within the current statement section so, in terms of execution, we end up with something like...
    +---------------------------------+
    |    Declaration Section          |
    +---------------------------------+
    |    Statements  Section          |
    |            .                    |
    |  +---------------------------+  |
    |  |    Declaration Section    |  |
    |  +---------------------------+  |
    |  |    Statements  Section    |  |
    |  +---------------------------+  |
    |  |     Exception Section     |  |
    |  +---------------------------+  |
    |            .                    |
    +---------------------------------+
    |     Exception Section           |
    +---------------------------------+
    Example... (Note: log_trace just writes some text to a table for tracing)
    SQL> create or replace procedure a as
      2    v_dummy NUMBER := log_trace('Procedure A''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure A''s Statement Section');
      5    v_dummy := 1/0; -- cause an exception
      6  exception
      7    when others then
      8      v_dummy := log_trace('Procedure A''s Exception Section');
      9      raise;
    10  end;
    11  /
    Procedure created.
    SQL> create or replace procedure b as
      2    v_dummy NUMBER := log_trace('Procedure B''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure B''s Statement Section');
      5    a; -- HERE the execution passes to the declare/statement/exception sections of A
      6  exception
      7    when others then
      8      v_dummy := log_trace('Procedure B''s Exception Section');
      9      raise;
    10  end;
    11  /
    Procedure created.
    SQL> exec b;
    BEGIN b; END;
    ERROR at line 1:
    ORA-01476: divisor is equal to zero
    ORA-06512: at "SCOTT.B", line 9
    ORA-06512: at line 1
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Procedure A's Declaration Section
    Procedure A's Statement Section
    Procedure A's Exception Section
    Procedure B's Exception Section
    6 rows selected.
    SQL>
    Likewise, execution blocks can be nested deeper and deeper.
    5. How to continue exection of statements after an exception
    One of the common questions asked is how to return execution to the statement after the one that created the exception and continue on.
    Well, firstly, you can only do this for statements you expect to raise an exception, such as when you want to check if there is no data found in a query.
    If you consider what's been shown above you could put any statement you expect to cause an exception inside it's own procedure or function with it's own exception section to handle the exception without raising it back to the calling code.  However, the nature of procedures and functions is really to provide a means of re-using code, so if it's a statement you only use once it seems a little silly to go creating individual procedures for these.
    Instead, you nest execution blocks directly, to give the same result as shown in the diagram at the start of part 4 of this article.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure b (p_empno IN VARCHAR2) as
      2    v_dummy NUMBER := log_trace('Procedure B''s Declaration Section');
      3  begin
      4    v_dummy := log_trace('Procedure B''s Statement Section');
      5    -- Here we start another execution block nested in the first one...
      6    declare
      7      v_dummy NUMBER := log_trace('Nested Block Declaration Section');
      8    begin
      9      v_dummy := log_trace('Nested Block Statement Section');
    10      select empno
    11        into   v_dummy
    12        from   emp
    13       where  empno = p_empno; -- Note: the parameters and variables from
                                         parent execution block are available to use!
    14    exception
    15      when no_data_found then
    16        -- This is an exception we can handle so we don't raise it
    17        v_dummy := log_trace('No employee was found');
    18        v_dummy := log_trace('Nested Block Exception Section - Exception Handled');
    19      when others then
    20        -- Other exceptions we can't handle so we raise them
    21        v_dummy := log_trace('Nested Block Exception Section - Exception Raised');
    22        raise;
    23    end;
    24    -- ...Here endeth the nested execution block
    25    -- As the nested block handled it's exception we come back to here...
    26    v_dummy := log_trace('Procedure B''s Statement Section Continued');
    27  exception
    28    when others then
    29      -- We'll only get to here if an unhandled exception was raised
    30      -- either in the nested block or in procedure b's statement section
    31      v_dummy := log_trace('Procedure B''s Exception Section');
    32      raise;
    33* end;
    SQL> /
    Procedure created.
    SQL> exec b(123);
    PL/SQL procedure successfully completed.
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Nested Block Declaration Section
    Nested Block Statement Section
    No employee was found
    Nested Block Exception Section - Exception Handled
    Procedure B's Statement Section Continued
    7 rows selected.
    SQL> truncate table code_trace;
    Table truncated.
    SQL> exec b('ABC');
    BEGIN b('ABC'); END;
    ERROR at line 1:
    ORA-01722: invalid number
    ORA-06512: at "SCOTT.B", line 32
    ORA-06512: at line 1
    SQL> select * from code_trace;
    TXT
    Procedure B's Declaration Section
    Procedure B's Statement Section
    Nested Block Declaration Section
    Nested Block Statement Section
    Nested Block Exception Section - Exception Raised
    Procedure B's Exception Section
    6 rows selected.
    SQL>
    You can see from this that, very simply, the code that we expected may have an exception was able to either handle the exception and return to the outer execution block to continue execution, or if an unexpected exception occurred then it was able to be raised up to the outer exception section.
    6. User defined exceptions
    There are three sorts of 'User Defined' exceptions.  There are logical situations (e.g. business logic) where, for example, certain criteria are not met to complete a task, and there are existing Oracle errors that you wish to give a name to in order to capture them in the exception section.  The third is raising your own exception messages with our own exception numbers.  Let's look at the first one...
    Let's say I have tables which detail stock availablility and reorder levels...
    SQL> select * from reorder_level;
       ITEM_ID STOCK_LEVEL
             1          20
             2          20
             3          10
             4           2
             5           2
    SQL> select * from stock;
       ITEM_ID ITEM_DESC  STOCK_LEVEL
             1 Pencils             10
             2 Pens                 2
             3 Notepads            25
             4 Stapler              5
             5 Hole Punch           3
    SQL>
    Now, our Business has told the administrative clerk to check stock levels and re-order anything that is below the re-order level, but not to hold stock of more than 4 times the re-order level for any particular item.  As an IT department we've been asked to put together an application that will automatically produce the re-order documents upon the clerks request and, because our company is so tight-ar*ed about money, they don't want to waste any paper with incorrect printouts so we have to ensure the clerk can't order things they shouldn't.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6      from stock s join reorder_level r on (s.item_id = r.item_id)
      7      where s.item_id = p_item_id;
      8    --
      9    v_stock cur_stock_reorder%ROWTYPE;
    10  begin
    11    OPEN cur_stock_reorder;
    12    FETCH cur_stock_reorder INTO v_stock;
    13    IF cur_stock_reorder%NOTFOUND THEN
    14      RAISE no_data_found;
    15    END IF;
    16    CLOSE cur_stock_reorder;
    17    --
    18    IF v_stock.stock_level >= v_stock.reorder_level THEN
    19      -- Stock is not low enough to warrant an order
    20      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    21    ELSE
    22      IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    23        -- Required amount is over-ordering
    24        DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                     ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    25      ELSE
    26        DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    27        -- Here goes our code to print the order
    28      END IF;
    29    END IF;
    30    --
    31  exception
    32    WHEN no_data_found THEN
    33      CLOSE cur_stock_reorder;
    34      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    35* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(10,100);
    Invalid Item ID.
    PL/SQL procedure successfully completed.
    SQL> exec re_order(3,40);
    Stock has not reached re-order level yet!
    PL/SQL procedure successfully completed.
    SQL> exec re_order(1,100);
    Quantity specified is too much.  Max for this item: 70
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,50);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL>
    Ok, so that code works, but it's a bit messy with all those nested IF statements. Is there a cleaner way perhaps?  Wouldn't it be nice if we could set up our own exceptions...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6      from stock s join reorder_level r on (s.item_id = r.item_id)
      7      where s.item_id = p_item_id;
      8    --
      9    v_stock cur_stock_reorder%ROWTYPE;
    10    --
    11    -- Let's declare our own exceptions for business logic...
    12    exc_not_warranted EXCEPTION;
    13    exc_too_much      EXCEPTION;
    14  begin
    15    OPEN cur_stock_reorder;
    16    FETCH cur_stock_reorder INTO v_stock;
    17    IF cur_stock_reorder%NOTFOUND THEN
    18      RAISE no_data_found;
    19    END IF;
    20    CLOSE cur_stock_reorder;
    21    --
    22    IF v_stock.stock_level >= v_stock.reorder_level THEN
    23      -- Stock is not low enough to warrant an order
    24      RAISE exc_not_warranted;
    25    END IF;
    26    --
    27    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    28      -- Required amount is over-ordering
    29      RAISE exc_too_much;
    30    END IF;
    31    --
    32    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    33    -- Here goes our code to print the order
    34    --
    35  exception
    36    WHEN no_data_found THEN
    37      CLOSE cur_stock_reorder;
    38      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    39    WHEN exc_not_warranted THEN
    40      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    41    WHEN exc_too_much THEN
    42      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    43* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(10,100);
    Invalid Item ID.
    PL/SQL procedure successfully completed.
    SQL> exec re_order(3,40);
    Stock has not reached re-order level yet!
    PL/SQL procedure successfully completed.
    SQL> exec re_order(1,100);
    Quantity specified is too much.  Max for this item: 70
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,50);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL>
    That's better.  And now we don't have to use all those nested IF statements and worry about it accidently getting to code that will print the order out as, once one of our user defined exceptions is raised, execution goes from the Statements section into the Exception section and all handling of errors is done in one place.
    Now for the second sort of user defined exception...
    A new requirement has come in from the Finance department who want to have details shown on the order that show a re-order 'indicator' based on the formula ((maximum allowed stock - current stock)/re-order quantity), so this needs calculating and passing to the report...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    -- Let's declare our own exceptions for business logic...
    13    exc_not_warranted EXCEPTION;
    14    exc_too_much      EXCEPTION;
    15  begin
    16    OPEN cur_stock_reorder;
    17    FETCH cur_stock_reorder INTO v_stock;
    18    IF cur_stock_reorder%NOTFOUND THEN
    19      RAISE no_data_found;
    20    END IF;
    21    CLOSE cur_stock_reorder;
    22    --
    23    IF v_stock.stock_level >= v_stock.reorder_level THEN
    24      -- Stock is not low enough to warrant an order
    25      RAISE exc_not_warranted;
    26    END IF;
    27    --
    28    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    29      -- Required amount is over-ordering
    30      RAISE exc_too_much;
    31    END IF;
    32    --
    33    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    34    -- Here goes our code to print the order, passing the finance_factor
    35    --
    36  exception
    37    WHEN no_data_found THEN
    38      CLOSE cur_stock_reorder;
    39      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    40    WHEN exc_not_warranted THEN
    41      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    42    WHEN exc_too_much THEN
    43      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    44* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(2,40);
    Order OK.  Printing Order...
    PL/SQL procedure successfully completed.
    SQL> exec re_order(2,0);
    BEGIN re_order(2,0); END;
    ERROR at line 1:
    ORA-01476: divisor is equal to zero
    ORA-06512: at "SCOTT.RE_ORDER", line 17
    ORA-06512: at line 1
    SQL>
    Hmm, there's a problem if the person specifies a re-order quantity of zero.  It raises an unhandled exception.
    Well, we could put a condition/check into our code to make sure the parameter is not zero, but again we would be wrapping our code in an IF statement and not dealing with the exception in the exception handler.
    We could do as we did before and just include a simple IF statement to check the value and raise our own user defined exception but, in this instance the error is standard Oracle error (ORA-01476) so we should be able to capture it inside the exception handler anyway... however...
    EXCEPTION
      WHEN ORA-01476 THEN
    ... is not valid.  What we need is to give this Oracle error a name.
    This is done by declaring a user defined exception as we did before and then associating that name with the error number using the PRAGMA EXCEPTION_INIT statement in the declaration section.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    -- Let's declare our own exceptions for business logic...
    13    exc_not_warranted EXCEPTION;
    14    exc_too_much      EXCEPTION;
    15    --
    16    exc_zero_quantity EXCEPTION;
    17    PRAGMA EXCEPTION_INIT(exc_zero_quantity, -1476);
    18  begin
    19    OPEN cur_stock_reorder;
    20    FETCH cur_stock_reorder INTO v_stock;
    21    IF cur_stock_reorder%NOTFOUND THEN
    22      RAISE no_data_found;
    23    END IF;
    24    CLOSE cur_stock_reorder;
    25    --
    26    IF v_stock.stock_level >= v_stock.reorder_level THEN
    27      -- Stock is not low enough to warrant an order
    28      RAISE exc_not_warranted;
    29    END IF;
    30    --
    31    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    32      -- Required amount is over-ordering
    33      RAISE exc_too_much;
    34    END IF;
    35    --
    36    DBMS_OUTPUT.PUT_LINE('Order OK.  Printing Order...');
    37    -- Here goes our code to print the order, passing the finance_factor
    38    --
    39  exception
    40    WHEN exc_zero_quantity THEN
    41      DBMS_OUTPUT.PUT_LINE('Quantity of 0 (zero) is invalid.');
    42    WHEN no_data_found THEN
    43      CLOSE cur_stock_reorder;
    44      DBMS_OUTPUT.PUT_LINE('Invalid Item ID.');
    45    WHEN exc_not_warranted THEN
    46      DBMS_OUTPUT.PUT_LINE('Stock has not reached re-order level yet!');
    47    WHEN exc_too_much THEN
    48      DBMS_OUTPUT.PUT_LINE('Quantity specified is too much.  Max for this item: '
                                  ||to_char(v_stock.reorder_limit-v_stock.stock_level));
    49* end;
    SQL> /
    Procedure created.
    SQL> exec re_order(2,0);
    Quantity of 0 (zero) is invalid.
    PL/SQL procedure successfully completed.
    SQL>
    Lastly, let's look at raising our own exceptions with our own exception numbers...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure re_order(p_item_id NUMBER, p_quantity NUMBER) is
      2    cursor cur_stock_reorder is
      3      select s.stock_level
      4            ,r.stock_level as reorder_level
      5            ,(r.stock_level*4) as reorder_limit
      6            ,(((r.stock_level*4)-s.stock_level)/p_quantity) as finance_factor
      7      from stock s join reorder_level r on (s.item_id = r.item_id)
      8      where s.item_id = p_item_id;
      9    --
    10    v_stock cur_stock_reorder%ROWTYPE;
    11    --
    12    exc_zero_quantity EXCEPTION;
    13    PRAGMA EXCEPTION_INIT(exc_zero_quantity, -1476);
    14  begin
    15    OPEN cur_stock_reorder;
    16    FETCH cur_stock_reorder INTO v_stock;
    17    IF cur_stock_reorder%NOTFOUND THEN
    18      RAISE no_data_found;
    19    END IF;
    20    CLOSE cur_stock_reorder;
    21    --
    22    IF v_stock.stock_level >= v_stock.reorder_level THEN
    23      -- Stock is not low enough to warrant an order
    24      [b]RAISE_APPLICATION_ERROR(-20000, 'Stock has not reached re-order level yet!');[/b]
    25    END IF;
    26    --
    27    IF v_stock.stock_level + p_quantity > v_stock.reorder_limit THEN
    28      -- Required amount is over-ordering
    29     

    its nice article, have put up this one the blog
    site,Nah, I don't have time to blog, but if one of the other Ace's/Experts wants to copy it to a blog with reference back to here (and all due credit given ;)) then that's fine by me.
    I'd go for a book like "Selected articles by OTN members" or something. Does anybody have a list of links of all those mentioned articles?Just these ones I've bookmarked...
    Introduction to regular expressions ... by CD
    When your query takes too long ... by Rob van Wijk
    How to pipeline a function with a dynamic number of columns? by ascheffer
    PL/SQL 101 : Exception Handling by BluShadow

  • How to create a counter using Oracle SQL Developer?

    Is there any way to create a counter using Oracle SQL Developer to create the below scenario. Meaning it will recorded down the name of user and ID and time and the date they login.
    Library portal home statistics shows how many users (outside and within the campus) visit the library portal.
    Page Access statistics is recorded on an hourly basis. Users may select the statistics by
    yearly (statistics displayed by all months in the selected year)
    monthly (statistics displayed by all days in the selected month)
    daily (statistics displayed by all hours in the selected day)

    I'm giving here one basic post - hope this will solve your problem --
    SQL>
    SQL>
    SQL> create table audit_info
      2   (
      3     usr        varchar2(50),
      4     log_time   timestamp(6)
      5    );
    Table created.
    SQL>
    SQL>
    SQL>  create table err_log
      2     (
      3       log_cd      varchar2(20),
      4       log_desc    varchar2(500)
      5     );
    Table created.
    SQL>
    SQL>
    SQL>   create or replace procedure ins_err(errcd   in  varchar2,
      2                                        errnm   in  varchar2)
      3    is
      4      pragma autonomous_transaction;
      5    begin
      6      insert into err_log values(errcd,errnm);
      7      commit;
      8    end;
      9  /
    Procedure created.
    SQL>
    SQL>
    SQL>   create or replace procedure ins_aud(ud   in varchar2,
      2                                        unm  in varchar2)
      3    is
      4      pragma autonomous_transaction;
      5    begin
      6      insert into audit_info values(ud,unm);
      7      commit;
      8    exception
      9      when others then
    10        ins_err(sqlcode,sqlerrm);
    11    end;
    12  /
    Procedure created.
    SQL>
    SQL>
    SQL>
    SQL> create or replace trigger log_odsuser1
      2   after logon on odsuser1.schema
      3   begin
      4     ins_aud('ODSUSER1',sysdate);
      5   exception
      6     when others then
      7       ins_err(sqlcode,sqlerrm);
      8   end;
      9  /
    Trigger created.
    SQL>
    SQL*Plus: Release 9.2.0.1.0 - Production on Tue Jun 12 12:21:09 2007
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production
    SQL>
    SQL>
    SQL>
    SQL> set serveroutput on
    SQL>
    SQL>
    SQL> select * from audit_info;
    USR
    LOG_TIME
    ODSUSER1
    12-JUN-07 12.00.00.00000000 AMHope this will solve your purpose.
    Regards.
    Satyaki De.

  • Error invoking populateXRefRow:oracle.tip.xref.exception.RepositoryExceptio

    Hi All,
    I created an XREF table using XREF commandline utility. Table was successfully created and columns were also successfully added. But I am getting the following error while using populateXRefRow function in assign activity in BPEL. I have XREF_DATA table is present in oraesb schema.
    SOA suite version 10.1.3.4
    JDev version 10.1.3.4
    OS - Windows XP.
    Basic Installation with Oracle lite database.
    Caused by: oracle.xml.xpath.XPathException: Extension function error: Error invoking 'populateXRefRow':'oracle.tip.xref.exception.RepositoryException: Unable to access Cross Reference Values from Database.The SQL Exception is: "JDBC 2.0 feature is not yet implemented"
    Please ensure that the database is accessible. If accessible, please look at the stack trace and fix the issue. If unable to fix contact Oracle Support '
         at oracle.xml.xslt.XSLStylesheet.flushErrors(XSLStylesheet.java:1846)
         at oracle.xml.xslt.XSLStylesheet.execute(XSLStylesheet.java:612)
         at oracle.xml.xslt.XSLStylesheet.execute(XSLStylesheet.java:548)
         at oracle.xml.xslt.XSLProcessor.processXSL(XSLProcessor.java:333)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:460)
         ... 91 more
    oracle.xml.xpath.XPathException: Extension function error: Error invoking 'populateXRefRow':'oracle.tip.xref.exception.RepositoryException: Unable to access Cross Reference Values from Database.The SQL Exception is: "JDBC 2.0 feature is not yet implemented"
    Please ensure that the database is accessible. If accessible, please look at the stack trace and fix the issue. If unable to fix contact Oracle Support '
         at oracle.xml.xpath.XSLExtFunctions.callStaticMethod(XSLExtFunctions.java:118)
         at oracle.xml.xpath.XPathExtFunction.evaluateMethod(XPathExtFunction.java:337)
         at oracle.xml.xpath.XPathExtFunction.evaluate(XPathExtFunction.java:266)
         at oracle.xml.xslt.XSLValueOf.processAction(XSLValueOf.java:120)
         at oracle.xml.xslt.XSLNode.processChildren(XSLNode.java:480)
         at oracle.xml.xslt.XSLTemplate.processAction(XSLTemplate.java:205)
         at oracle.xml.xslt.XSLStylesheet.execute(XSLStylesheet.java:581)
         at oracle.xml.xslt.XSLStylesheet.execute(XSLStylesheet.java:548)
         at oracle.xml.xslt.XSLProcessor.processXSL(XSLProcessor.java:333)
         at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:460)
         at com.collaxa.cube.xml.xpath.functions.xml.GetElementFromXSLTFunction.transform(GetElementFromXSLTFunction.java:335)
         at com.collaxa.cube.xml.xpath.functions.xml.GetElementFromXDKXSLTFunction.transform(GetElementFromXDKXSLTFunction.java:38)
         at com.collaxa.cube.xml.xpath.functions.xml.GetElementFromXSLTFunction.evaluate(GetElementFromXSLTFunction.java:144)
         at com.collaxa.cube.xml.xpath.functions.xml.GetElementFromXSLTFunction.call(GetElementFromXSLTFunction.java:89)
         at com.collaxa.cube.xml.xpath.BPELXPathFunctionWrapper.evaluate(BPELXPathFunctionWrapper.java:50)
         at oracle.xml.xpath.JXPathContext$JXFunction.invoke(JXPathContext.java:147)
         at oracle.xml.xpath.JXPathContext$JXFunction.invoke(JXPathContext.java:116)
         at oracle.xml.xpath.XPathExtFunction.evaluate(XPathExtFunction.java:254)
         at oracle.xml.xpath.JXPathExpression.evaluate(JXPathExpression.java:181)
         at com.collaxa.cube.xml.xpath.BPELXPathUtil.evaluate(BPELXPathUtil.java:189)
         at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.evalFromValue(BPELAssignWMP.java:679)
         at com.collaxa.cube.engine.ext.wmp.BPELAssignWMP.__executeStatements(BPELAssignWMP.java:143)
         at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perform(BPELActivityWMP.java:199)
         at com.collaxa.cube.engine.CubeEngine.performActivity(CubeEngine.java:3698)
         at com.collaxa.cube.engine.CubeEngine.handleWorkItem(CubeEngine.java:1655)
         at com.collaxa.cube.engine.dispatch.message.instance.PerformMessageHandler.handleLocal(PerformMessageHandler.java:75)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.handleLocalMessage(DispatchHelper.java:217)
         at com.collaxa.cube.engine.dispatch.DispatchHelper.sendMemory(DispatchHelper.java:314)
         at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:5765)
         at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:1087)
         at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.createAndInvoke(CubeEngineBean.java:133)
         at com.collaxa.cube.engine.ejb.impl.CubeEngineBean.syncCreateAndInvoke(CubeEngineBean.java:162)
         at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
         at com.evermind.server.ThreadState.runAs(ThreadState.java:693)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.TxRequiresNewInterceptor.invoke(TxRequiresNewInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
         at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
         at CubeEngineBean_LocalProxy_4bin6i8.syncCreateAndInvoke(Unknown Source)
         at com.collaxa.cube.engine.delivery.DeliveryHandler.initialRequestAnyType(DeliveryHandler.java:547)
         at com.collaxa.cube.engine.delivery.DeliveryHandler.initialRequest(DeliveryHandler.java:464)
         at com.collaxa.cube.engine.delivery.DeliveryHandler.request(DeliveryHandler.java:133)
         at com.collaxa.cube.ejb.impl.DeliveryBean.request(DeliveryBean.java:95)
         at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:31)
         at com.evermind.server.ThreadState.runAs(ThreadState.java:693)
         at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:34)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:119)
         at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:55)
         at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:87)
         at DeliveryBean_RemoteProxy_4bin6i8.request(Unknown Source)
         at com.collaxa.cube.ws.soap.oc4j.SOAPRequestProvider.processNormalOperation(SOAPRequestProvider.java:451)
         at com.collaxa.cube.ws.soap.oc4j.SOAPRequestProvider.processBPELMessage(SOAPRequestProvider.java:274)
         at com.collaxa.cube.ws.soap.oc4j.SOAPRequestProvider.processMessage(SOAPRequestProvider.java:120)
         at oracle.j2ee.ws.server.provider.ProviderProcessor.doEndpointProcessing(ProviderProcessor.java:956)
         at oracle.j2ee.ws.server.WebServiceProcessor.invokeEndpointImplementation(WebServiceProcessor.java:349)
         at oracle.j2ee.ws.server.provider.ProviderProcessor.doRequestProcessing(ProviderProcessor.java:466)
         at oracle.j2ee.ws.server.WebServiceProcessor.processRequest(WebServiceProcessor.java:114)
         at oracle.j2ee.ws.server.WebServiceProcessor.doService(WebServiceProcessor.java:96)
         at oracle.j2ee.ws.server.WebServiceServlet.doPost(WebServiceServlet.java:194)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.security.jazn.oc4j.JAZNFilter$1.run(JAZNFilter.java:400)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:414)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:623)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    Please help me to resolve the above error.
    - Sam

    Hi Sam,
    This error is because JDBC 2.0 feature is not completely implemented in Oracle Lite database.
    So, you might want to go for an SOA Advanced Install with 10.2.0.3 oracle database to resolve your issue.
    Hope this helps!
    Cheers
    Anirudh Pucha

  • Oracle SQL Developer 1.1.1.25.14, I rror ORA-01722 Invalid Number

    I have installed the new version of Oracle SQL Developer 1.1.1.25.14, I use Oracle 9.2. When I browse in the tree of the stored procedures and compile I obtain Error ORA-01722 Invalid Number. The previous version does not give this error. I have tried to change the decimal separator to comma ',' and point '.' but this error always appears.

    create or replace
    PROCEDURE getAge (
    dtmDataStart_in IN DATE,
    dtmDataEnd_in IN DATE,
    intYears_out OUT NUMBER,
    intMonths_out OUT NUMBER,
    intDays_out OUT NUMBER) AS
    -- Calcola il numero di anni, mesi, giorni intercorsi
    -- dalla data iniziale alla data finale.
    -- Se la data iniziale è > della data finale, le due date
    -- vengono scambiate e le variabili di output vengono ritornate
    -- con segno negativo.
    --==================================================
    -- Data Ultima Modifica: 31/07/98
    -- Aggiunta procedura per il calcolo della differenza tra
    -- due date dello stesso anno.
    --==================================================
    -- DICHIARAZIONE VARIABILI INIZIO --------------------------------------------------------
    intYMDStart NUMBER(10);
    intYMDEnd NUMBER(10);
    intYMD NUMBER(10);
    intDiffAnni NUMBER(5);
    intDiffMesi NUMBER(5);
    intDiffGiorni NUMBER(5);
    intMeseStart NUMBER(5);
    intAnnoStart NUMBER(5);
    intTotGiorniMeseStart NUMBER(5);
    ysnNegativo NUMBER(5);
    -- DICHIARAZIONE VARIABILI FINE ----------------------------------------------------------
    BEGIN
    intYMDStart := TO_NUMBER( TO_CHAR(dtmDataStart_in,'YYYYMMDD'));
    intYMDEnd := TO_NUMBER( TO_CHAR(dtmDataEnd_in,'YYYYMMDD'));
    ysnNegativo := 0;
    IF intYMDStart = intYMDEnd THEN
    intYears_out := 0;
    intMonths_out := 0;
    intDays_out := 0 ;
    ELSE
    IF intYMDStart > intYMDEnd THEN
    intYMD := intYMDStart;
    intYMDStart := intYMDEnd;
    intYMDEnd := intYMD;
    ysnNegativo := -1;
    END IF;
    intDiffAnni := TO_NUMBER(TO_CHAR(dtmDataEnd_in,'YYYY')) - TO_NUMBER(TO_CHAR(dtmDataStart_in ,'YYYY'));
    intDiffMesi := TO_NUMBER(TO_CHAR(dtmDataEnd_in,'MM')) - TO_NUMBER(TO_CHAR(dtmDataStart_in ,'MM'));
    intDiffGiorni := TO_NUMBER(TO_CHAR(dtmDataEnd_in,'DD')) - TO_NUMBER(TO_CHAR(dtmDataStart_in ,'DD'));
    -- I valori cosi' calcolati di intDiffAnni, intDiffMesi e intDiffGiorni vanno bene
    -- ad eccezione dei seguenti casi:
    -- Sistemo intDiffAnni
    IF (intDiffMesi > 0 OR (intDiffMesi = 0 AND intDiffGiorni >= 0)) THEN
    -- intDiffAnni e' OK
    intDiffAnni := intDiffAnni;
    ELSE
    -- non e' ancora arrivato il giorno del compleanno
    intDiffAnni := intDiffAnni-1;
    END IF;
    -- Sistemo intDiffMesi
    IF (intDiffMesi > 0 AND intDiffGiorni < 0) THEN
    intDiffMesi := intDiffMesi-1;
    ELSIF (intDiffMesi < 0 ) THEN
         if(intDiffGiorni<0) THEN
         intDiffMesi := intDiffMesi+11;
    else
         intDiffMesi := intDiffMesi+12;
    END IF;
    ELSIF (intDiffMesi=0 AND intDiffGiorni<0) THEN
         intDiffMesi:=11;
    END IF;
    -- Sistemo intDiffGiorni
    -- Calcolo i giorni come (TotGiorniMeseIniziale - GiornoIniziale) + (GiornoFinale - 0)
    -- che e' uguale a fare TotGiorniMeseIniziale + (GiornoFinale-GiornoIniziale)
    IF intDiffGiorni < 0 THEN
    intMeseStart := TO_NUMBER(TO_CHAR(dtmDataStart_in ,'MM'));
    IF intMeseStart IN (1,3,5,7,8,10,12) THEN
    intTotGiorniMeseStart := 31;
    ELSIF intMeseStart = 2 THEN
    -- Da enciclopedia: sono bisestili gli anni multipli di 4
    -- esclusi i secoli che non sono multipli di 400 (Parte commentata).
    intAnnoStart := TO_NUMBER(TO_CHAR(dtmDataStart_in ,'YYYY'));
    if (intAnnoStart MOD 4) = 0
    -- AND NOT ((intAnnoStart MOD 100) = 0 AND (intAnnoStart MOD 400) <> 0)
    Then
    intTotGiorniMeseStart := 29;
    else
    intTotGiorniMeseStart := 28;
    end if;
    ELSIF intMeseStart IN (4,6,9,11) THEN
    intTotGiorniMeseStart := 30;
    END IF;
    intDiffGiorni := intDiffGiorni + intTotGiorniMeseStart;
    END IF;
    IF ysnNegativo = 0 THEN
    intDays_out := intDiffGiorni;
    intMonths_out := intDiffMesi;
    intYears_out := intDiffAnni;
    ELSE
    intDays_out := intDiffGiorni * (-1);
    intMonths_out := intDiffMesi * (-1);
    intYears_out := intDiffAnni * (-1);
    END IF;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END getAge;
    The output result of compilation is "GETAGE Compiled", I think the 01722 error is not caused from an sql syntax error, but probably caused from an invalid or unsupported or 'strange' configuration on nationalization... the fact surprises me that the previous version did not give problems
    THANKS SO MUTCH
    */

  • Oracle SQL Developer 1.1 Patch 2 (1.1.2.25.79) Browsing

    Dear All
    I download Oracle SQL Developer 1.1 Patch 2 (1.1.2.25.79) ,and install it but
    it refuse to browse any schema , knowing that it accept the connection and keep the massage loading appearing all the time
    Thanks
    Suliman

    More detailed output below (Ctrl+break and running as sqldeveloper -J-Dide.extension.log.to.console=true)
    I've also only got Oracle.* files in my two extensions directories
    C:\Program Files\SQLDeveloper\ide\extensions
    C:\Program Files\SQLDeveloper\jdev\extensions
    C:\Program Files\SQLDeveloper\sqldeveloper\bin>sqldeveloper.exe
    WARNING: Unknown directive: SetSkipJ2SDKCheck
    Using oracle.home=C:\Program Files\SQLDeveloper
    Using ide.user.dir=null
    Full thread dump Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode):
    "TimerQueue" daemon prio=6 tid=0x04635270 nid=0xff4 in Object.wait() [0x04d3f000
    ..0x04d3fd68]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x12879928> (a javax.swing.TimerQueue)
    at javax.swing.TimerQueue.run(TimerQueue.java:233)
    - locked <0x12879928> (a javax.swing.TimerQueue)
    at java.lang.Thread.run(Thread.java:595)
    "AWT-EventQueue-0" prio=6 tid=0x04610e50 nid=0xf50 in Object.wait() [0x04c3f000.
    .0x04c3f9e8]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x12832040> (a java.awt.EventQueue)
    at java.lang.Object.wait(Object.java:474)
    at java.awt.EventQueue.getNextEvent(EventQueue.java:345)
    - locked <0x12832040> (a java.awt.EventQueue)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:189)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    "Image Fetcher 0" daemon prio=8 tid=0x04611160 nid=0x234 in Object.wait() [0x04b
    3f000..0x04b3fa68]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x12860f78> (a java.util.Vector)
    at sun.awt.image.ImageFetcher.nextImage(ImageFetcher.java:114)
    - locked <0x12860f78> (a java.util.Vector)
    at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:167)
    at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
    "AWT-Windows" daemon prio=6 tid=0x045fbd28 nid=0xb7c runnable [0x04a2f000..0x04a
    2fae8]
    at sun.awt.windows.WToolkit.eventLoop(Native Method)
    at sun.awt.windows.WToolkit.run(WToolkit.java:269)
    at java.lang.Thread.run(Thread.java:595)
    "AWT-Shutdown" prio=6 tid=0x045fb8b0 nid=0xe4c in Object.wait() [0x0492f000..0x0
    492fb68]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x128345c8> (a java.lang.Object)
    at java.lang.Object.wait(Object.java:474)
    at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
    - locked <0x128345c8> (a java.lang.Object)
    at java.lang.Thread.run(Thread.java:595)
    "Java2D Disposer" daemon prio=6 tid=0x044de4a8 nid=0x688 in Object.wait() [0x048
    2f000..0x0482fbe8]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x12834650> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
    - locked <0x12834650> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
    at sun.java2d.Disposer.run(Disposer.java:107)
    at java.lang.Thread.run(Thread.java:595)
    "Low Memory Detector" daemon prio=6 tid=0x01015278 nid=0x90c runnable [0x0000000
    0..0x00000000]
    "CompilerThread0" daemon prio=6 tid=0x01012d38 nid=0xed0 waiting on condition [0
    x00000000..0x03e6fa4c]
    "Signal Dispatcher" daemon prio=6 tid=0x010120b8 nid=0x7dc waiting on condition
    [0x00000000..0x00000000]
    "Finalizer" daemon prio=8 tid=0x01008fd0 nid=0xd28 in Object.wait() [0x03c6f000.
    .0x03c6fae8]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x1279ffa0> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
    - locked <0x1279ffa0> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=6 tid=0x01008518 nid=0x624 in Object.wait() [0x0
    3b6f000..0x03b6fa68]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x127a0020> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:474)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
    - locked <0x127a0020> (a java.lang.ref.Reference$Lock)
    "main" prio=6 tid=0x00849390 nid=0xf4c runnable [0x0012d000..0x0012fb78]
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.<init>(Throwable.java:218)
    at java.lang.Exception.<init>(Exception.java:59)
    at java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:6
    5)
    at java.lang.ClassLoader.findBootstrapClass(Native Method)
    at java.lang.ClassLoader.findBootstrapClass0(ClassLoader.java:891)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:301)
    - locked <0x127a2fd0> (a sun.misc.Launcher$ExtClassLoader)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    - locked <0x127a0058> (a sun.misc.Launcher$AppClassLoader)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    - locked <0x127a0058> (a sun.misc.Launcher$AppClassLoader)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at oracle.classloader.SearchPolicy$FindMain.getClass(SearchPolicy.java:3
    07)
    at oracle.classloader.SearchSequence.getClass(SearchSequence.java:119)
    at oracle.classloader.SearchPolicy.loadClass(SearchPolicy.java:648)
    - locked <0x127af080> (a oracle.classloader.PolicyClassLoader)
    at oracle.classloader.PolicyClassLoader.askParentForClass(PolicyClassLoa
    der.java:1308)
    at oracle.classloader.SearchPolicy$AskParent.getClass(SearchPolicy.java:
    68)
    at oracle.classloader.SearchSequence.getClass(SearchSequence.java:119)
    at oracle.classloader.PolicyClassLoader.internalLoadClass(PolicyClassLoa
    der.java:1693)
    - locked <0x127adf48> (a oracle.classloader.PolicyClassLoader)
    at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java
    :1654)
    at oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java
    :1639)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    - locked <0x127adf48> (a oracle.classloader.PolicyClassLoader)
    at javax.ide.model.spi.DocumentHook.$init$(DocumentHook.java:66)
    at javax.ide.model.spi.DocumentHook.<init>(DocumentHook.java:27)
    at javax.ide.extension.spi.DefaultHookVisitorFactory.createDocumentHook(
    DefaultHookVisitorFactory.java:157)
    at javax.ide.extension.spi.DefaultHookVisitorFactory.registerStandardVis
    itors(DefaultHookVisitorFactory.java:81)
    at javax.ide.extension.spi.DefaultHookVisitorFactory.<init>(DefaultHookV
    isitorFactory.java:53)
    at oracle.ideimpl.extension.ExtensionManagerImpl$1.<init>(ExtensionManag
    erImpl.java:153)
    at oracle.ideimpl.extension.ExtensionManagerImpl.createHookVisitorFactor
    y(ExtensionManagerImpl.java:152)
    at javax.ide.extension.ExtensionRegistry.loadExtensions(ExtensionRegistr
    y.java:259)
    at oracle.ideimpl.extension.ExtensionManagerImpl.loadExtensions(Extensio
    nManagerImpl.java:376)
    at javax.ide.extension.ExtensionRegistry.loadExtensions(ExtensionRegistr
    y.java:171)
    at javax.ide.extension.ExtensionRegistry.initialize(ExtensionRegistry.ja
    va:382)
    at oracle.ideimpl.extension.ExtensionManagerImpl.initialize(ExtensionMan
    agerImpl.java:875)
    at javax.ide.Service.getService(Service.java:68)
    at javax.ide.extension.ExtensionRegistry.getExtensionRegistry(ExtensionR
    egistry.java:401)
    at oracle.ide.ExtensionRegistry.getOracleRegistry(ExtensionRegistry.java
    :140)
    at oracle.ide.IdeCore.startupImpl(IdeCore.java:1122)
    at oracle.ide.Ide.startup(Ide.java:642)
    at oracle.ideimpl.DefaultIdeStarter.startIde(DefaultIdeStarter.java:35)
    at oracle.ideimpl.Main.start(Main.java:90)
    at oracle.ideimpl.Main.main(Main.java:51)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at oracle.ide.boot.PCLMain.callMain(PCLMain.java:45)
    at oracle.ide.boot.PCLMain.main(PCLMain.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at oracle.classloader.util.MainClass.invoke(MainClass.java:89)
    at oracle.ide.boot.IdeLauncher.bootClassLoadersAndMain(IdeLauncher.java:
    218)
    at oracle.ide.boot.IdeLauncher.launchImpl(IdeLauncher.java:90)
    at oracle.ide.boot.IdeLauncher.launch(IdeLauncher.java:66)
    at oracle.ide.boot.IdeLauncher.main(IdeLauncher.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at oracle.ide.boot.Launcher.invokeMain(Launcher.java:508)
    at oracle.ide.boot.Launcher.launchImpl(Launcher.java:106)
    at oracle.ide.boot.Launcher.launch(Launcher.java:60)
    at oracle.ide.boot.Launcher.main(Launcher.java:49)
    "VM Thread" prio=6 tid=0x010058e0 nid=0xde8 runnable
    "VM Periodic Task Thread" prio=6 tid=0x01011ff8 nid=0xeb8 waiting on condition
    Product extension oracle.sqldeveloper could not be loaded. The product cannot st
    art.
    Disabled extensions:
    oracle.ide.xmlef: Missing dependencies: oracle.ide.daf, oracle.ide.palette2
    C:\Program Files\SQLDeveloper\sqldeveloper\bin>sqldeveloper -J-Dide.extension.lo
    g.to.console=true
    WARNING: Unknown directive: SetSkipJ2SDKCheck
    Using oracle.home=C:\Program Files\SQLDeveloper
    Using ide.user.dir=null
    Product extension oracle.sqldeveloper could not be loaded. The product cannot st
    art.
    Disabled extensions:
    oracle.ide.xmlef: Missing dependencies: oracle.ide.daf, oracle.ide.palette2
    C:\Program Files\SQLDeveloper\sqldeveloper\bin>

  • Oracle.sql.BLOB and oracle.sql.STRUCT

    I'm development a application in Java with oracle, to manage media files. When I try to insert into oracle , I have this problem "oracle.sql.BLOB cannot be cast to oracle.sql.STRUCT" , and I don't know what that can be ..
    This is my code , please help with that.. If you have a smaple code of java and oracle to insert media , that will be a great help ..
    public void loadDataFromStream(OracleConnection con)
    try {
    Statement s = con.createStatement();
    OracleResultSet rs = (OracleResultSet)
    s.executeQuery("select * from blobs where id='video2.avi' for update ");
    String index = "";
    while(rs.next())
    index = rs.getString(1);
    index+="1";
    System.out.println("llego hasta aki");
    // el error esta en esta linea de abajo ...
    OrdVideo vidObj = (OrdVideo) rs.getCustomDatum(2, OrdVideo.getFactory());
    //rs.getBfile(3);///
    FileInputStream fStream = new FileInputStream("/home/jova/movie.avi");
    vidObj.loadDataFromInputStream(fStream);
    vidObj.getDataInFile("/home/jova/movie.avi");
    fStream.close();
    System.out.println(" getContentLength output : " +
    vidObj.getContentLength());
    OraclePreparedStatement stmt1 =
    (OraclePreparedStatement) con.prepareCall("update blob_col set image = ? where id = " + index);
    stmt1.setCustomDatum(1,vidObj);
    stmt1.execute();
    stmt1.close() ;
    index+="1";
    System.out.println("OK");
    catch(Exception e) {
    System.out.println("exception raised " + e);
    System.out.println("load data from stream unsuccessful");
    }

    I'm development a application in Java with oracle, to manage media files. When I try to insert into oracle , I have this problem "oracle.sql.BLOB cannot be cast to oracle.sql.STRUCT" , and I don't know what that can be ..
    This is my code , please help with that.. If you have a smaple code of java and oracle to insert media , that will be a great help ..
    public void loadDataFromStream(OracleConnection con)
    try {
    Statement s = con.createStatement();
    OracleResultSet rs = (OracleResultSet)
    s.executeQuery("select * from blobs where id='video2.avi' for update ");
    String index = "";
    while(rs.next())
    index = rs.getString(1);
    index+="1";
    System.out.println("llego hasta aki");
    // el error esta en esta linea de abajo ...
    OrdVideo vidObj = (OrdVideo) rs.getCustomDatum(2, OrdVideo.getFactory());
    //rs.getBfile(3);///
    FileInputStream fStream = new FileInputStream("/home/jova/movie.avi");
    vidObj.loadDataFromInputStream(fStream);
    vidObj.getDataInFile("/home/jova/movie.avi");
    fStream.close();
    System.out.println(" getContentLength output : " +
    vidObj.getContentLength());
    OraclePreparedStatement stmt1 =
    (OraclePreparedStatement) con.prepareCall("update blob_col set image = ? where id = " + index);
    stmt1.setCustomDatum(1,vidObj);
    stmt1.execute();
    stmt1.close() ;
    index+="1";
    System.out.println("OK");
    catch(Exception e) {
    System.out.println("exception raised " + e);
    System.out.println("load data from stream unsuccessful");
    }

Maybe you are looking for