Derby
  1. Derby
  2. DERBY-3125

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

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.4.1.3
    • Fix Version/s: None
    • Component/s: JDBC
    • Urgency:
      Normal
    • Issue & fix info:
      Repro attached
    • Bug behavior facts:
      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

        Activity

        Hide
        Daniel John Debrunner added a comment -

        It would be good to get some clarification on what the scale set by registerOutParameter should affect. E.g.

        • should decimal digits be modified on a setBigDecimal for INOUT parameters ?
        • should parameter meta data reflect the scale of the declared parameter of the procedure or of the scale set by registerOutParameter?
        • how does getBigDecimal() that takes a scale value behave?
        Show
        Daniel John Debrunner added a comment - It would be good to get some clarification on what the scale set by registerOutParameter should affect. E.g. should decimal digits be modified on a setBigDecimal for INOUT parameters ? should parameter meta data reflect the scale of the declared parameter of the procedure or of the scale set by registerOutParameter? how does getBigDecimal() that takes a scale value behave?
        Hide
        Kathey Marsden added a comment -

        Triaged for 10.5.2. Setting normal urgency.

        Show
        Kathey Marsden added a comment - Triaged for 10.5.2. Setting normal urgency.

          People

          • Assignee:
            Unassigned
            Reporter:
            Kathey Marsden
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development