Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3125

registerOutputParameter with a specified scale does not adjust the scale of the output parameter

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 10.4.1.3
    • None
    • JDBC
    • Normal
    • Repro attached
    • Deviation from standard

    Description

      Running the following program with either embedded or client does not adjust the scale of the output parameter.

      public class DecimalOutParam {

      public static void main(String[] args) throws Exception
      {
      //Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
      //Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/wombat;create=true");
      Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
      Connection conn = DriverManager.getConnection("jdbc:derby:wombat;create=true");
      Statement s = conn.createStatement();
      try

      { s.executeUpdate("DROP PROCEDURE DECPROC"); }

      catch (SQLException se)
      {

      }
      s.executeUpdate("CREATE PROCEDURE DECPROC(OUT DECIMAL(10,2)) parameter style java language java NO SQL external name 'DecimalOutParam.decProc'");

      CallableStatement cs = conn.prepareCall("CALL DECPROC");
      cs.registerOutParameter(1,java.sql.Types.DECIMAL, 0);
      cs.executeUpdate();
      System.out.println(cs.getBigDecimal(1));

      }

      public static void decProc(BigDecimal [] outDec)

      { outDec[0] = new BigDecimal("123.45"); }

      }

      C:/kmarsden/repro/DERBY-2073] java DecimalOutParam
      23.45

      Should be
      23

      Attachments

        Activity

          People

            Unassigned Unassigned
            kmarsden Katherine Marsden
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: