#Error using IIF and divide by zero

I am getting an error in a calculated field that could potentially divide by zero, even though I'm using an IIF.  The column displays in the report as "#Error".  My expression looks like this:
= IIF(Fields!Qty.Value = 0,
"None", Fields!Hours.Value / Fields!Qty.Value)
I have successfully used this approach with INT fields, but this time the Hours field is a NUMERIC(9,2).  My workaround is to do this:
 IIF(Fields!Qty.Value = 0, "None", IIF(Fields!Qty.Value = 0, 42, Fields!Hours.Value) / Fields!Qty.Value)
I guess the 42 is cast to an INT inside the second IIF and the calculation works.
What's strange is that the division would even be carried out in the event of Qty = 0 from the first IIF, because the expression should just evaluate to "None" and that would be that.
Has anybody run into this problem?  Is my workaround the recommended approach?
-Larry

First a diatribe: This is just one of the many annoying "features" of SSRS that needs to be fixed. It should just flat out work. Period.
Now the fix.
The following formula to calculate Discount% gives the #Error result if List = 0
=iif(Fields!List.Value=0,0, (Fields!List.Value-Fields!Net.Value)/Fields!List.Value)
However, if you add a very small number to the divisor it will work.
=iif(Fields!List.Value=0,0, (Fields!List.Value-Fields!Net.Value)/(Fields!List.Value+.000001))
Apparently SSRS evaluates the false part of the expression before it tests. Try this in most any other language and you will not have this problem.
You just need to add a small enough number to your formula to not impact your results when the divisor is not zero.
You can actually leave out the IIF entirely if you do this:                             
Fields!List.Value-Fields!Net.Value)/(Fields!List.Value+.000001)
I usually leave the syntax in there just so I know what the intention was.

Similar Messages

  • Arithmetic Overflow/Underflow and Divide by Zero Errors

    We're having problems similar to those posted below (see links), especially "Help: Divide by Zero Errors" to which no one has addressed. <br /><br />Here's our situation: On our form, we have two columns that sum the rows above them, called<br /><br />"covertotal" and "multtotal"<br /><br />...for which we need a final calculation: multtotal/covertotal<br /><br />Under calcutions in FormCalc, we have generated the following formula for the box called "prevtotal" under the calculate command: <br /><br />(multtotal / covertotal)<br /><br />However, since this calculation runs when the document is opened, we get a divide by zero error. Do we need to create an initialize or calculate formula to correct for this zero? If so, what is the proper coding.<br /><br />Please spell this out, we're that stupid... <sigh><br /><br />Thanks!<br /><br />Matthew<br /><br />Previous posts with similar problems are linked below:<br /><br />Help: Divide by Zero Errors<br /><a href="/cgi-bin/webx?14@@.3bbd2077">Harry Kontos, "Help: Divide by Zero Errors" #, 6 Nov 2005 10:01 pm</a><br /><br />calculations overflow/underflow<br />http://www.adobeforums.com/cgi-bin/webx/.3bbeb7e0<br /><br />FormCalc error-arithmetic overflow/underflow<br />http://www.adobeforums.com/cgi-bin/webx/.3bbc15f3

    Your error message indicates your script is being executed as FormCalc, not JavaScript.
    If you're using FormCalc try using an If statment to test for zero/null.
    if (tr>0) then (ac/tr)*100 endif

  • At startup-system error and divide by zero

    I've been having a lot of problems starting up my beige G3 mini tower, it has 233mhz, 384ram, mac os9.1. I've zapped the pram and held the shift key down to boot with extensions off, didnt work. I've changed the battery twice in case the first replacement was bad, it started up and ran long enough for me to trash all the preferences, I tried to change the extensions, but when restarting it was back to not completely starting up. I've tried pressing the button near the pci slots with the battery out, 30 seconds, waited 30 minutes and held down the button for another 30 seconds, replaced the battery, checked the sound card for looseness then at startup it worked till I changed the time and date. I tried the battery and button again this time waiting over night between pressing the button for 30 seconds, after startup I was able to run disc first aid and it said everything was ok, then crashed again when I tried to change the date and time. I've even tried booting up from command/option/o/f, I'm not sure what firmware is but it would try to start up that way,but was very slow with a os cd in the cd drive. I tried to erase the hard drive but I couldnt get it to start up from a cd, iv'e tried os9, the original cd that came with the computer and a system recovery cd.
    Most times when trying to start it up it chimes, then the happy mac with a grey screen, then the mac os screen, then the bomb with "system error" and under that "bus error" under that it says to restart with extensions off. sometimes the button for restart will even work with the cursor. Once, after trying to start up after all the battery removal, pressing button near pci slots , pressing com/opt/o/f, extensions off, the screen getting to the mac os then the bomb dialogue, it said system error and instead of saying "bus error" it said "divide by zero". Thats the first and only time I've seen that one. Also, the grey screen (with the happy mac disc icon) now has horizontal lines with texture? that I havent noticed before.
    got any ideas what I should do next? I probably wouldnt bother with my G3 anymore because I just bought a new Imac, but I have a vinyl cutter hooked to it, it has the old round serial port cables and I would have to buy new software, cables and dongle to use it with my new Imac, I also have illustrator, photoshop, scanner, and drawing tablet on my G3 that I cant use on my new Imac (intel) leopard.
    Is my hard drive or motherboard dying? is there a way to find out if and what hardware is messed up? and if so, is there still still parts out there for this G3?

    Hi, R1camper -
    I ran disc first aid from the cd and and it said it couldnt fix-overlapped extent allocation,4,479.
    That is a type of disk directory damage, one which Disk First Aid can not repair.
    Alsoft's DiskWarrior can usually repair that kind of damage, with no loss of files. If you choose to go this route, suggest you call (or email) Alsoft's sales department, and request an older version of DiskWarrior - the current versions won't run on your Beige G3/MT.
    However, if you can manage to live with the loss of files, you can probably replace the hard drive for less cost.
    Your Beige G3/MT came with either an ATA (now often referred to as PATA and/or IDE) drive or a SCSI drive - it could have been ordered with either when the machine was new.
    With luck it will be an ATA drive, since those are the least expensive and the easiest to install. Such drives are not Mac-specific - any ATA drive designed for internal use and of appropriate size will work. The only item of concern is to set the drive's jumpers properly. The drive should be jumpered as Master (it may come preset as Master or as Cable Select - Cable Select will not work on your model), unless it is a Western Digital in which case it should be set to Single if that is an available choice.
    There is probably little to gain by getting a 7200RPM drive, especially if there is extra cost for one vs. a 5400RPM drive - the relatively slow internal bus speed on your machine will not be able to take significant advantage of a faster drive.
    Re the RAM, if you have the time you might try replacing any you took out. Over time the contact the module makes in its slot can get iffy - removing and replacing the module usually fixes that problem, by wiping the contacts clean.

  • Syntax errors using sql and java

    Could somebody inform of the correct syntax for using UPDATE and INSERT SQL commands in a java program? Any information I can find demonstrates this with:
    INSERT INTO table_name(column_name, ..., column_name)
    VALUES(value, ..., value)
    However - this isn't working? any suggestions - and I know its very basic, but I'm just learning.
    String query = " INSERT INTO SESSIONS (" +                                   
                        "id,module_name, module_number, level, session " +
                        "term, class_list, location, lecturer" + ")
    VALUES('"+
                        fields.id.getText() + "', '"+
                        fields.module_name.getText() + "', '" + fields.module_number.getText() + "', '" +
                   fields.level.getText() + "', '" fields.session.getText() "', '" +
                   fields.term.getText() + "', '" fields.class_list.getText() "', '" +
                   fields.location.getText() + "', '" fields.lecturer.getText() "')";
              output.append( " \nSending query: " + connection.nativeSQL(query)+ "\n");                                                                                                         
              output.append( "query sent");     
    thanks
              int result = statement.executeUpdate(query);                    

    With all those quotes and apostrophes and string concatenations, I'd be surprised if you got it right by the fourth try. (By the way, you appear to have missed a comma between "session" and "term".) Are you planning to insert more than one record in your program? If so, you should consider using a PreparedStatement. This will likely run faster, and your program will definitely be easier to read. Also, you won't have to come back here later to ask how you deal with data that includes apostrophes (the notorious "O'Brien" problem). Here's how you do that... you define the PreparedStatement only once:
    String query =
      "INSERT INTO SESSIONS (id,module_name, module_number, level, session, term, class_list, location, lecturer) " +
      "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)";
    PreparedStatement insert = connection.prepareStatement(query);and then every time you want to insert a record you do this:
    insert.setString(1, fields.id.getText());
    insert.setString(2, fields.module_name.getText());
    // and so on...
    insert.executeQuery();

  • Error using JDBC and DB2 - Please help

    Hi, I need some help solving this problem. I ran the same program at my university and it worked. At home I am using TomCat4 and j2sdk1.4.1. I want to connect to the IBM DB2 Universal database personal edition v7. The program compiles, but when I run it, it says it can't find
    com.ibm.db2.jdbc.app.DB2Driver. The class path was automatically updated when I installed DB2. What could the problem be? Please help because I really need to use this. Thank you.
    Marianne.
    This is my program:
    import java.io.*;
    import java.sql.*;
    class testDB {
    public static void main(String argv[]) {
    try {
    // load driver and connect to database
    Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
    String url = "jdbc:db2:test";
              String userid = "the database name"; // blanked out
              String password = "my password";
    Connection con = DriverManager.getConnection(url, userid, password);
    // an SQL retrieval getting all rows in table
    Statement stmt = con.createStatement();
    String SQLStatement = "SELECT issueID, stock FROM test.issue ORDER BY issueID";
    String theIssueId;
    int theStock;
    ResultSet rs = stmt.executeQuery(SQLStatement);
         // loop to step through each row of result set
         while (rs.next()) {
    theIssueId= rs.getString("issueID");
    theStock = rs.getInt("stock");
    System.out.println(theIssueId + " : " + theStock);
    // tidy up
    rs.close();
    stmt.close();
    con.close();
    } catch( Exception e ) {
    e.printStackTrace();
    }

    Try add path C:\Program Files\SQLLIB\java\db2java.zip to classpath.

  • Scan to Email not working - Invalid Credentials error (using gmail and 2-factor authentication)

    I configured the HP OfficeJet 8600 printer for scan to email using the Embedded Web Server interface. In the Web interface, I added/entered an email address for my gmail account, and set the correct SMTP server details, and entered 465 for the port number. I checked the "Always use secure connection" box, as well as the "SMTP requires authentication for outgoing email messages" box. I entered correct SMTP user ID and password. Yet when I did a test, I got an error "Invalid credentials" After a lot of frustration, and trying all sorts of things, I eventually got the idea to try another email account. This time I tried a different email account, a netzero email account, configured the smtp server details for it etc. And this time when I tested the netzero email address it worked. I tried the scan to email on the printer, and it worked for the Netzero email account. it just didnt work for the gmail account. I had a while back turned on 2-factor authentication. I went to gmail settings and requested an "App password" for my HP printer. Google/gmail displayed a 16 character password, which I then entered into the password box in the HP OfficeJet printer Embedded Web Server interface (instead of my usual password), for the gmail account. And this time when I tested the email account - it worked! Problem solved! .. I share this just in case anyone else is having the same problem I had, and is going through the same frustrating experience I endured!  

    Thank you. This helped TREMENDOUSLY! 

  • Errors using themes and tomahawk within portlets

    I've been developing a portlet using Creator2 Update 1 that uses the myfaces tomahawk library of components. Besides the difficulty of not being able to use the visual designer, I've managed to get my portlet functioning the way I want.
    My next step was to apply styles to my portlet. The difficulty here is that since portlets are aggregated within a portal, the portlet does not have access to the <head> tag of the container page (meaning I couldn't just add my own stylesheets and link them in.) I'm not sure how Creator works around this problem - I just know that it manages to using <ui:themeLinks> somehow.
    Changing the theme for a regular Creator-components-only (read: no tomahawk) is a no-brainer. I simply pick a different theme in the Project view and set it as the Current Theme. I can even set my own user-defined theme. Running the portlet either through Creator or Liferay shows the applied theme.
    However, once I start using tomahawk components, the theme system breaks down, throwing exceptions, such as the following:
    com.sun.rave.web.ui.theme.ThemeConfigurationException: WARNING: the Sun Web Components could not load any themes.
    at com.sun.rave.web.ui.theme.ThemeFactory.createThemeManager(ThemeFactory.java:274)
    Curiously, it only breaks if I use one of my user-defined themes. The Creator-provided themes will work with the tomahawk components portlet.
    In short, I am baffled. Creator-provided themes work regardless of tomahawk components present. My own themes work so long as there aren't tomahawk components present.

    Sorry, I don't think that's going to work. Themes are not used in the standard SES index, and therefore the Oracle Text knowledgebase is not installed - hence the DRG-11446 error you're seeing.
    If you figured out a way to install the knowledgebase from another system (and I'm NOT recommending that), you would still need to recreate the text index with INDEX_THEMES turned on.
    You should be able to connect to the SES instance from a remote machine by commenting out both "tcp.invited_nodes" and "tcp.validnode_checking" from the sqlnet.ora file. Not sure why just adding an entry to tcp.invited_nodes didn't work for you.

  • UIX-XML BC4J - Unexpected errors using paths and DeltaTree on a particular UIX page

    We are using a PageDescription to dynamically change a UIX tree using the DeltaTree technique described in the Dynamic Structure for For UIX Pages chapter of the UIX Developers Guide.
    We search for a particular node using PathUtils.FindPathWithNodeID(RenderingContext context, UINode from, java.lang.String nodeID), but this fails when the page contains nested ViewObjectScopes.
    The method throws a NullPointerException, and the render fails:
    29/08/02 9.08 Valutazioni: java.lang.NullPointerException
         oracle.cabo.ui.data.DataObjectList oracle.cabo.ui.collection.DataObjectListNodeList.getDataObjectList(oracle.cabo.ui.RenderingContext)
         int oracle.cabo.ui.collection.DataObjectListNodeList.size(oracle.cabo.ui.RenderingContext)
         int oracle.cabo.ui.BaseUINode.getIndexedChildCount(oracle.cabo.ui.RenderingContext)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         boolean oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.path.PathImpl, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         oracle.cabo.ui.path.Path oracle.cabo.ui.path.PathUtils._findPath(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.UINode, oracle.cabo.ui.path.PathUtils$Finder)
         oracle.cabo.ui.path.Path oracle.cabo.ui.path.PathUtils.findPathWithNodeID(oracle.cabo.ui.RenderingContext, oracle.cabo.ui.UINode, java.lang.String)
         oracle.cabo.ui.UINode com.websiteitalia.wsdk.uix.pageflow.PageFlowManager.getRootUINode()
         oracle.cabo.ui.UINode oracle.cabo.servlet.ui.UINodePageDescriptionProxy.getRootUINode()
         oracle.cabo.ui.UINode oracle.cabo.servlet.ui.UINodePageRenderer.getRootUINode(oracle.cabo.servlet.BajaContext, oracle.cabo.ui.RenderingContext, oracle.cabo.servlet.Page)
         oracle.cabo.ui.UINode oracle.cabo.servlet.ui.HTMLUINodePageRenderer.getRootUINode(oracle.cabo.servlet.BajaContext, oracle.cabo.ui.RenderingContext, oracle.cabo.servlet.Page)
         void oracle.cabo.servlet.ui.UINodePageRenderer.renderPage(oracle.cabo.servlet.BajaContext, oracle.cabo.servlet.Page)
         void oracle.cabo.servlet.AbstractPageBroker.renderPage(oracle.cabo.servlet.BajaContext, oracle.cabo.servlet.Page)
         oracle.cabo.servlet.Page oracle.cabo.servlet.PageBrokerHandler.handleRequest(oracle.cabo.servlet.BajaContext)
         void oracle.cabo.servlet.BajaServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    We found the element of the UIX page that causes the problem:
    <bc4j:viewObjectScope name="ElementsView" >
    <contents>
         <bc4j:rowScope name="NewElement" >
         <contents>     
              <bc4j:region automatic="false" >
                   <bc4j:key>
                        <bc4j:rowKey name="keyElement"/>
                   </bc4j:key>
                   <contents>
                        <bc4j:attrScope name="FlgState">
                        <contents>
                             <messageChoice name="FlgState" prompt="State" >
                                  <boundAttribute name="selectedValue">
                                       <concat>
                                            <bc4j:attrProperty name="value"/>
                                            <fixed text=""/>
                                       </concat>
                                  </boundAttribute>
                                  <contents>
                                       <!-- This is the nested vo scope causing the error -->
                                       <bc4j:viewObjectScope name="DecodeStateView" >
                                       <contents data:childData="list@DecodeState">
                                            <option data:value="StateCode"
                                                 data:text="StateDescription"/>
                                       </contents>
                                       </bc4j:viewObjectScope>
                                  </contents>
                             </messageChoice>
                        </contents>
                        </bc4j:attrScope>
                   </contents>
              </bc4j:region>
         </contents>
         </bc4j:rowScope>
    </contents>
    </bc4j:viewObjectScope>
    This usage of nested view object scopes has been explained in reply of a previous post, How to databind the children of a UIX XML choice, and before ours attempts to modify the tree it worked fine. Removing the nested view object scope the page makes the page render correctly, but we need it to retrieve the description of its state.
    We get the same behaviour (and a much similar stack trace, with the same oracle.cabo.ui.data.DataObjectList oracle.cabo.ui.collection.DataObjectListNodeList.getDataObjectList (oracle.cabo.ui.RenderingContext) throwing a NullPointerException) if we use NodeUtils.createPreorderDescendentAttributeEnumeration method instead of PathUtils.

    It's a bug in the DataObjectListNodeList class that's up at the top of
    the stack. It's been fixed for 9.0.3. The bit of XML that's triggering
    it isn't the <viewObjectScope>s, but the "data:childData".
    I believe you can workaround this bug by not passing a null RenderingContext to
    findPathWithNodeID(). Now, you don't have a real RenderingContext, and we
    don't especially need one - "null" is legit here, but I think if
    you just pass "new oracle.cabo.ui.RootRenderingContext()" then you'll
    get around this bug.

  • Error using java and javascript

    I have a jsp page that links to a bean and is working fine (getting data from the database).
    On a html form I have a button with a picture that fires off javascript when clicked:
    <BUTTON TYPE=reset onclick=showinfo('<%=index%>')>
    <IMG SRC="http://localhost:8080/Portal/Images/q2.bmp" ALT="Info">
    </BUTTON>
    The javascript function just opens a new window and displays the text sent in:
    <Script Language=JavaScript>
    function showinfo(arrayindex)
    InfoWin=window.open("","InfoWin","width=345,height=220");
    InfoWin.document.write(arrayindex);
    return false;
    </Script>
    Well in the above example index is a number (pulled from the database using a java bean and javascript converts it into a string then the function displays it correctly. If I replace <%=index%> with regular text it works fine as well(because java isn't used to pull data)! The problem occurs when I retrieve text data from the database and send it to the function. The web page gives errors about a nonterminating string. But I can move the code to somewhere else on the form(as long as I don't send it to java script) and it will print the text to the screen. I can also view the source of the web page and the html shows the text from the data base as if I hard coded the text into the javascript!!!!!!!!!!!!!!!!!
    This must be a bug between java and javascript!
    -can pass numbers(from a database) between the two
    -can't pass text (from a database)between the two
    Any info would help!

    Found the problem myself!
    I am using an odbc connection to msaccess and the spaces in the text was messing things up!
    After taking out the spaces it worked again.

  • Error using setTimestamp and ojdbc14 against Oracle 7.3.4

    I am having a problem setting a timestamp value against Oracle 7.3.4 and Oracle 8.0.6 databases.
    Here's the code:
    public Tester
    (String passedUsername, String passedPassword, String passedHostName, String passedPort, String passedSID)
    throws SQLException {
    // Establish a database connection
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    } catch (ClassNotFoundException e) { throw new SQLException("Can't find class oracle.jdbc.driver.OracleDriver"); }
    StringBuffer myStringBuffer = new StringBuffer(50);
    myStringBuffer.append("jdbc:oracle:thin:@");
    myStringBuffer.append(passedHostName);
    myStringBuffer.append(":");
    myStringBuffer.append(passedPort);
    myStringBuffer.append(":");
    myStringBuffer.append(passedSID);
    Connection myConnection = DriverManager.getConnection(myStringBuffer.toString(), passedUsername, passedPassword);
    myConnection.setAutoCommit(false);
    // Insert the test record
    PreparedStatement myPreparedStatement = null;
    try {
    myPreparedStatement = myConnection.prepareStatement("insert into test_table(date_field) values (?)");
    myPreparedStatement.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
    myPreparedStatement.execute();
    } finally {
    if (myPreparedStatement != null) myPreparedStatement.close();
    Here's the error that occurs under Oracle 7.3.4:
    java.sql.SQLException: ORA-01024: invalid datatype in OCI call
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
         at Tester.<init>(Tester.java:46)
         at Tester.main(Tester.java:62)
    Here's the error that occurs under Oracle 8.0.6:
    java.sql.SQLException: ORA-03115: unsupported network datatype or representation
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
         at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
         at Tester.<init>(Tester.java:46)
         at Tester.main(Tester.java:62)
    Note that the table in the insert statement does not have to exist. You can even replace the statement with a garbage statement.
    The error is produced regardless.
    The code is being compiled under JDK 1.4
    I am using the latest version of the JDBC drivers (i.e. ojdbc14.jar)
    The code works fine under Oracle 8.1.7 and 9.0.1
    My code needs to access all four of these database version, sometimes concurrently, so I can only use a single driver class (i.e. I can't swap out ojdbc14.jar for classes12.zip).
    Any feedback would be appreciated!

    Hi,
    Only to say that we have the same problem like you:
    - Error ORA-01024 when connection to Oracle 8.0.1 on Sun Solaris
    - Error ORA-03115 when connection to Oracle 8.1.5 on Windows
    We are thinking about upgrading Oracle. Is it the only solution?
    Thank you

  • Run-Time errors using DAQmx and Borland C++ Builder 5.0

    I've written a simple program on MS Visual C++ 6.0 to test my PCI-6014 board and it works fine.
    I copied the code to Borland C++ builder 5.0 and had some linker problems with the .lib files that where solved with borland's "coff2omf".
    Now I've been getting run-time errors when I use the function DAQmxCreateAIVoltageChan()... The error code is -50251: "The specified software component is not available. The component was not loaded".
    But I'm sure that the code is right, since it works fine on MS Visual C++ 6.0!
    That the part of the code where I'm getting the error:
    iErro = DAQmxCreateTask("", &thTask);
    iErro = DAQmxCreateAIVoltageChan(thTask, "Dev1/ai0", "", DAQmx_Val_Diff, -10.0, 10.0, DAQmx_Val_Volts, NU
    LL);
    Thanks for the help,
    Marcelo

    Hello
    Borland enables certain types of exceptions by default which are initially disable in MSVC. You will need to refer to the documentation for Borland Builder on how to disable floating point exceptions. I believe you can do it by adding the following statement to your initialization code, but you should double check this:
    _control87(MCW_EM, MCW_EM);
    These exceptions get thrown because we are doing some floating point initialization underneath. This is not an indication of a bug or a problem of any sort. Apparently you have to this for alot of libraries to work correctly with Borland (OpenGL etc...)
    Hope this helps
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • EJBGen Error using CMP and relationships

    I am trying to use this example, Order and LineItems. An order can have multiple line items. When I compile things using WeblogicWorkshop Beta for 9.1 I get the following error.
    EJBGen Error: Error: [OrderBean] Relation OrderCanHaveMultipleLineItems has only one role: One-OrderBean@lineItems-Has-OrderBean
    Does anybody know how to fix this error ??
    Thanks,
    Ian
    My OrderBean looks like this:
    @Entity(ejbName = "OrderBean", dataSourceName = "jdbc/JavaWorldPool", tableName = "TOrder", primKeyClass = "java.lang.String", defaultTransaction = Constants.TransactionAttribute.REQUIRED)
    @JndiName(local = "ejb.OrderBeanLocal")
    @FileGeneration(localClass = Constants.Bool.TRUE, localHome = Constants.Bool.TRUE, remoteClass = Constants.Bool.TRUE, remoteHome = Constants.Bool.TRUE, valueClass = Constants.Bool.TRUE)
    @Relations(value={@Relation(cmrField = "lineItems", targetEjb = "OrderBean", multiplicity = Relation.Multiplicity.ONE, name = "OrderCanHaveMultipleLineItems")})
    abstract public class OrderBean extends GenericEntityBean implements EntityBean {
    public java.lang.String ejbCreate(java.lang.String key)
    throws CreateException {
    setOrderid(key);
    return null;
    public void ejbPostCreate(java.lang.String key) {
    @CmpField(column = "orderid", primkeyField = Constants.Bool.TRUE)
    public abstract java.lang.String getOrderid();
    public abstract void setOrderid(java.lang.String orderid);
    @CmpField(column = "status")
    @LocalMethod()
    @RemoteMethod
    public abstract java.lang.String getStatus();
    @LocalMethod()
    @RemoteMethod
    public abstract void setStatus(java.lang.String status);
    @CmpField(column = "creditApproved")
    @LocalMethod()
    @RemoteMethod
    public abstract Boolean getCreditApproved();
    @LocalMethod()
    @RemoteMethod
    public abstract void setStatus(Boolean creditApproved);
    // Container Managed Relation Fields //
    @LocalMethod()
    @CmrField
    public abstract Collection getLineItems();
    * @ejbgen:local-method
    public abstract void setLineItems(Collection lineItems);
    @Entity(ejbName = "LineItemBean", dataSourceName = "cgDataSource", tableName = "TLineItem", primKeyClass = "java.lang.String", defaultTransaction = Constants.TransactionAttribute.REQUIRED)
    @JndiName(local = "LineItemBeanLocal")
    @FileGeneration(localClass = Constants.Bool.TRUE, localHome = Constants.Bool.TRUE, remoteClass = Constants.Bool.TRUE, remoteHome = Constants.Bool.TRUE, valueClass = Constants.Bool.TRUE)
    @Relations(value = { @Relation(cmrField = "order", fkColumn = "orderfk", targetEjb = "OrderBean", multiplicity = Relation.Multiplicity.MANY, name = "OrderCanHaveMultipleLineItems") })
    abstract public class LineItemBean extends GenericEntityBean implements
    EntityBean {
    public java.lang.Integer ejbCreate(java.lang.String key)
    throws CreateException {
    // setKey(key);
    return null;
    public void ejbPostCreate(java.lang.String key) {
    @CmpField(column = "lineitemid", primkeyField = Constants.Bool.TRUE)
    public abstract java.lang.String getLineitemid();
    public abstract void setLineitemid(java.lang.String id);
    @CmpField(column = "quantity")
    @LocalMethod()
    @RemoteMethod
    public abstract Integer getQuantity();
    @LocalMethod()
    @RemoteMethod
    public abstract void setQuantity(Integer quantity);
    @CmpField(column = "status")
    @LocalMethod()
    @RemoteMethod
    public abstract String getStatus();
    @LocalMethod()
    @RemoteMethod
    public abstract void setStatus(String status);
    @CmpField(column = "tax")
    @LocalMethod()
    @RemoteMethod
    public abstract Double getTax();
    @LocalMethod()
    @RemoteMethod
    public abstract void setTax(Double tax);
    @CmpField(column = "shipmentdate")
    @LocalMethod()
    @RemoteMethod
    public abstract Date getShipmentdate();
    @LocalMethod()
    @RemoteMethod
    public abstract void setShipmentdate(Date shipmentDate);
    // Container Managed Relation Fields //
    @CmrField
    @LocalMethod
    public abstract OrderBeanLocal getOrder();
    @LocalMethod
    public abstract void setOrder(OrderBeanLocal order);
    }

    I figured it out, it appears to be a problem with Weblogic Workshop. I used the ejbgen tool and it fixed the problem, contacted BEA support about this issue and the answer was they don't support it because it is a Beta Version.
    Ian

  • Error Using Directories and UTL_FILE package

    Dear All, I have a problem using UTL_FILE package...
    When I'm trying to write into a directory I get the following error message:
    ORA-29283: invalid file open
    I have a Directory named "TMPDIRPD". I checked the permissions over this directory and found that
    'OPS$PDRVBPP' user has OS permissions over it. I supposed that it was the user used to validate permissions.
    Plus, I verified that user "OPS$PDRDVBPP" has read/write permission into directory with this query:
    SELECT TP.grantee,
    TP.privilege
    FROM dba_tab_privs TP,
    dba_role_privs RP
    WHERE TP.table_name = 'TMPDIRPD'
    AND TP.grantee = RP.granted_role
    AND rp.grantee = 'OPS$PDRDVBPP';
    But I'm getting the same error message.
    Then I saw that 'OPS$PDRDVBPP' user calls UTL_FILE package through another package, and isn't the owner of it...
    This package - who belongs to another database user - is using the OS user who owns the Oracle Installation instead 'OPS$PDRVBPP'. Isn't it?
    I also checked that operative system user has read-write permissions, and asked it to the OS Administrator. He told me that oracle user has read-write permissions over this directory too... I don't know what more else can be wrong.
    Have anyone some idea to fix this?

    Roman, I sorry about missed info.
    This is the version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
    PL/SQL Release 10.2.0.4.0 - Production
    "CORE     10.2.0.4.0     Production"
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    It's running over a Unix server (I really don´t know the exact version but it's a suse Linux).
    I though in ORACLE Directory object named TMPDIRPD, and its directory_path defined like /companyFiles/thishost/proj/pdrdvbpp/appfiles/tmp (OS Directory).
    I wrote into a OS directory using one of the procedures or functions inside the UTL_FILE package (SYS.UTL_FILE.FOPEN(parameter_path,parameter_file,parameter_io)).
    Here it goes an example of code.
    DECLARE
    v_AbroLog UTL_FILE.FILE_TYPE;
    BEGIN
    v_AbroLog := UTL_FILE.FOPEN('TMPDIRPD','log_prueba_utl.'||to_char(sysdate,'mmddy
    yyy'), 'a');
    UTL_FILE.PUT_LINE(v_AbroLog,'PRUEBA OK');
    UTL_FILE.FCLOSE(v_AbroLog);
    END;
    quit
    SQL> @test_utl.sql;
    DECLARE
    ERROR at line 1:
    ORA-29283: invalid file open
    some other generic error messages
    This error happens when the file doesn't exists.

  • Using IIF and AND in SSRS Expression

    I have a table like below
    I want to hide the rows where ALL 3 columns are 0. All the columns are of INT data type
    My expression is like so:
    =IIF((Fields!PastVal.Value=0) AND (Fields!DatePay=0) AND (Fields!Line.Value=0),False,True)
    But no data is returned except the column label(heading). What could be wrong with my express?
    Thank you.
    Zionlite

    In  that case compare 
    as below
    =IIF((Fields!PastVal.Value="0") AND (Fields!DatePay="0") AND (Fields!Line.Value="0"),True,False)
    Or irrespective of data type make every column  as string as below
    =IIF(Cstr((Fields!PastVal.Value="0") )AND (Cstr(Fields!DatePay.value)="0") AND (Cstr(Fields!Line.Value)="0"),True,False)
    Make sure you select the details row  and set the hide property
    Many Thanks
    Chandra
    Please mark the post as Answered if the above solution solves your issue.

  • ORA-00932 Error using 11g and the SDO_RELATE function. Works fine in 10g

    Hello,
    If I run this query in Oracle 11g:
    SELECT M.FID, MAX(M.VERSION) AS VERSION
    FROM SW_PB.A_ROADNODEINFORMATION M, SW_PB.ROADNODE N
    WHERE M.REFERENCETOROADNODE = N.FID
    AND M.NODEVERSION = N.VERSION
    AND M.CATALOGUEID <= 477
    AND MDSYS.SDO_RELATE( N.GEOM, MDSYS.SDO_GEOMETRY(2003,81989,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(120000,0,160000,40000)),'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE'
    GROUP BY M.FID;
    I get an error regarding the N.GEOM field. The error is as follows:
    ORA-00932: inconsistent datatypes: expected - got MDSYS.SDO_ELEM_INFO_ARRAY
    The same query runs fine on a 10g database with the same data. I've even truncated the N table and still get the error. I've rebuilt the index but it makes no difference and the metadata is exactly the same for this table as it is for other tables that are involved in a similar query.
    It looks like a bug to me but just wondered if anyone else had come across this?
    Thanks,
    Peter.

    Thanks for the reply. I'm really sorry but I haven't created trace files like this for a very long time and have forgotten the best way to read them. This is the start of the trace file, any help with reformatting it would be greatly appreciated.
    Thanks,
    Peter.
    *** 2009-04-23 17:09:22.902
    ----- Error Stack Dump -----
    *** 2009-04-23 17:09:22.917
    ORA-00932: inconsistent datatypes: expected - got MDSYS.SDO_ELEM_INFO_ARRAY
    ----- Current SQL Statement for this session (sql_id=br02jqdwy2utk) -----
    SELECT M.FID, MAX(M.VERSION) AS VERSION
    FROM SW_PB.A_ROADNODEINFORMATION M, SW_PB.ROADNODE N
    WHERE M.REFERENCETOROADNODE = N.FID
    AND M.NODEVERSION = N.VERSION
    AND M.CATALOGUEID <= 477
    AND MDSYS.SDO_RELATE( N.GEOM, MDSYS.SDO_GEOMETRY(2003,81989,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(120000,0,160000,40000)),'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE'
    GROUP BY M.FID
    ----- Call Stack Trace -----
    calling call entry argument values in hex
    location type point (? means dubious value)
    skdstdst()+114      CALLrel  kgdsdst()+0 FB783A0 2
    ksedst1()+91        CALLrel  skdstdst()+0
    ksedst()+50         CALLrel  ksedst1()+0 0 1
    dbkedDefDump()+298  CALLrel  ksedst()+0 0
    5
    ksedmp()+40         CALLrel  dbkedDefDump()+0 3 0
    _dbkdaKsdActDriver(  CALLreg  00000000             3
    )+841
    _dbgdaExecuteAction  CALLreg  00000000             7B50420 FB79A4C
    ()+63
    dbgdaRunAction()+3  CALLrel  dbgdaExecuteAction 7B50420 4D4C148 20C0002
    02 ()+0 FB79A4C
    dbgdRunActions()+4  CALLrel  dbgdaRunAction()+0 7B50420 A789E54
    4
    dbgdProcessEventAc  CALLrel  dbgdRunActions()+0 7B50420 A789E74
    tions()+446
    __VInfreq__dbgdChkE CALLrel _dbgdProcessEventAc  7B50420 120A3370 A789F64
    ventKgErr()+237 tions()+0
    dbkdChkEventRdbmsE  CALLrel  dbgdChkEventKgErr( 7B50420 A7C06F4 3A4
    rr()+33 )+0
    __PGOSF99__ksfpec() CALLrel _dbkdChkEventRdbmsE  3A4
    +110 rr()+0
    _dbgePostErrorKGE()  CALLreg  00000000             120A3370 3A4
    +1601
    dbkePostKGEkgsf() CALLrel _dbgePostErrorKGE()  120A3370 A772020 3A4
    +49 +0
    _kgeade()+268        CALLreg  00000000             120A3370 A772020 3A4
    kgesev()+54         CALLrel  kgeade()+0
    kgesec2()+18        CALLrel  kgesev()+0 120A3370 A772020 3A4 2
    FB7A200
    qctErr932()+217     CALLrel  kgesec2()+0 120A3370 A772020 3A4 1 1
    FB7A468 1 19 FB7A218
    qctErrConvertDataT  CALLrel  qctErr932()+0 995FBCC0 120A3370 F6 FB7A468
    ype()+82 7B C2E85B4 995FBCC0 120A3370
    FB7A468 0 0 FB7A468 0 204
    qecgby()+240        CALLrel  qctErrConvertDataT 995FBCC0 120A3370 F6 0 0 7B
    ype()+0 C2E85B4
    qecpqbcheck()+75    CALLrel  qecgby()+0
    qecdrv()+161        CALLrel  qecpqbcheck()+0 C2ECD7C 0 0 0
    qecdrv()+74         CALLrel  qecdrv()+0
    kkqcttcalo()+383    CALLrel  qecdrv()+0 C2EFBAC
    kkqctdrvGBP()+1841  CALLrel  kkqcttcalo()+0 C2EFBAC 0 C2EFBAC 166A5D4 0 2
    __VInfreq__kkqgbpTr CALLrel _kkqctdrvGBP()+0     A730DD8
    avChkTran()+193
    _qksqbApplyToQbcLoc  CALLreg  00000000             A730DD8 FB7A9BC
    ()+536
    qksqbApplyToQbc()+  CALLrel  qksqbApplyToQbcLoc
    67 ()+0
    kkqctdrvTD()+1000   CALLrel  qksqbApplyToQbc()+ A730DD8 2EF2DA0 FB7A9BC 0
    0
    kkqgbpdrv()+88      CALLrel  kkqctdrvTD()+0 A754820 995FBDF4 6
    kkqdrv()+1520       CALLrel  kkqgbpdrv()+0 A754820 995FBDF4
    kkqctdrvIT()+698    CALLrel  kkqdrv()+0 A754820 0
    apadrv()+1205       CALLrel  kkqctdrvIT()+0 A754820 995FBDF4
    opitca()+1841       CALLrel  apadrv()+0 995FBDF4
    __PGOSF435__kksFull CALLrel _opitca()+0          A7CC9E4 995FBDF4
    TypeCheck()+15
    _rpiswu2()+560       CALLreg  00000000             FB7B718
    kksLoadChild()+860  CALLrel  rpiswu2()+0 AF495220 5 A77DCBB4 16
    8 94591E54 5 A77DCBE0 0 FB7B670
    615F44 0 FB7B718 0
    kxsGetRuntimeLock(  CALLrel  kksLoadChild()+0 120A3370 AE9130D8 FB7C090
    )+1421
    kksfbc()+8954       CALLrel  kxsGetRuntimeLock( 120A3370 A7CC9E4 FB7C090 3 1
    )+0
    kkspsc0()+1882      CALLrel  kksfbc()+0 A7CC9E4 3 108 FB7D2D8 1BB 0 0
    0
    kksParseCursor()+1  CALLrel  kkspsc0()+0
    43
    opiosq0()+2028      CALLrel  kksParseCursor()+0 FB7C610
    kpooprx()+273       CALLrel  opiosq0()+0 3 E FB7C734 A4
    kpoal8()+729        CALLrel  kpooprx()+0 FB7F214 FB7D2D8 1BA 1 0 A4
    _opiodr()+1224       CALLreg  00000000             5E 1C FB7F210
    _ttcpip()+2733       CALLreg  00000000             5E 1C FB7F210 0
    _opitsk()+1278       CALL???  00000000            
    opiino()+1067       CALLrel  opitsk()+0 0 0
    _opiodr()+1224       CALLreg  00000000             3C 4 FB7FC28
    opidrv()+807        CALLrel  opiodr()+0 3C 4 FB7FC28 0
    sou2o()+45          CALLrel  opidrv()+0 3C 4 FB7FC28
    opimaireal()+130 CALLrel _sou2o()+0           FB7FC1C 3C 4 FB7FC28
    opimai()+92         CALLrel  opimai_real()+0 2 FB7FC54
    OracleThreadStart@  CALLrel  opimai()+0
    4()+764
    77E6482C CALLreg 00000000
    00000000 CALL??? 00000000

Maybe you are looking for

  • Result is empty error in XPath

    Hi, I am getting the following error coming from an "Assign" activity that copies from a child element of one variable (child of message type = M1) to another variable (which is of type element same as that of that child of M1). I am consistently get

  • Watching games in NHL GameCenter on tv through ATV2?

    Hi, I am considering purchasing ATV2. If I have the NHL's GameCenter will I be able to stream games from my iMac to my television? I looked around and couldn't find any info on this.

  • Asset usefullife

    hi sap gurus, when i am defining new asset in AS02 useful life is not coming automatically. In oayz I have given dep key for all asset class. There useful life column is dumb. When i am defining useful life in multilevel it does not get copied while

  • IWork doesn't support arabic!! When will it support?!

    When can i use iWork to write in arabic?!

  • How do I get my CS2 PREMIUM?

    Here's my problem: I have the Adobe CS2 Production PREMIUM. I had to uninstall it because of a virus. I tried to re-install it from the discs but I can no longer install from the discs - so I called the phone # and was sent here -  https://www.adobe.