nerdexam
Oracle

1Z0-819 · Question #198

Given the Customer table structure: ID Number Primary Key NAME Varchar(20) Given code fragment: 12. PreparedStatement stmt = con.prepareStatement("INSERT INTO CUSTOMER VALUES (?,?,?)"); 13…

The correct answer is A. stmt.setNull(2, java.sql.Types.VARCHAR). See the full explanation below for the reasoning.

Question

Given the Customer table structure: ID Number Primary Key NAME Varchar(20) Given code fragment: 12. PreparedStatement stmt = con.prepareStatement("INSERT INTO CUSTOMER VALUES (?,?,?)"); 13. stmt.setInt(1, 10); 14. /* Insert code here */ 15. int stat.execute.executeUpdate(); Which statement inserted in line 14 sets NAME column to a NULL value?

Options

  • Astmt.setNull(2, java.sql.Types.VARCHAR);
  • Bstmt.setNull(2, string, class);
  • Cstmt.setNull(2, null);
  • Dstmt.setNull(2, java.lang, string);

How the community answered

(36 responses)
  • A
    75% (27)
  • B
    8% (3)
  • C
    14% (5)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-819 Practice