Announcement Announcement Module
Collapse
No announcement yet.
How to make SimpleJdbcCall use Function and Procedure default arguments? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to make SimpleJdbcCall use Function and Procedure default arguments?

    Hi,

    I'm using SimpleJdbcCall to integrate with the Oracle DBMS_DATAPUMP package. I don't want to have to set all the default arguments again in my code, so would like to know if there is a way to get SimpleJdbcCall to respect these?

    Here is an example procedure from the DBM_DATAPUMP library:

    Code:
    DBMS_DATAPUMP.ADD_FILE (
       handle     IN NUMBER,
       filename   IN VARCHAR2,
       directory  IN VARCHAR2,
       filesize   IN VARCHAR2 DEFAULT NULL,
       filetype   IN NUMBER DEFAULT DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE);
    Here is how I call the function:

    Code:
      
        @Autowired
        public void setDataSource(DataSource dataSource) {
            jdbcTemplate = new JdbcTemplate(dataSource);
            jdbcTemplate.setResultsMapCaseInsensitive(true);
    
            procDataPumpAddFile = new SimpleJdbcCall(dataSource)
                    .withCatalogName(DBMS_DATAPUMP)
                    .withProcedureName("ADD_FILE");
            procDataPumpAddFile.setSchemaName(DATAPUMP_OWNER);
    
        }
    
        public void dataPumpAddFile(BigDecimal handle, String filename, String directory) {
            SqlParameterSource in = new MapSqlParameterSource()
                    .addValue("handle", handle)
                    .addValue("filename", filename)
                    .addValue("directory", directory)
                    .addValue("filesize", "20G")
                    .addValue("filetype", KU$_FILE_TYPE_DUMP_FILE);
            procDataPumpAddFile.execute(in);
        }
    I don't believe I should have to specify the filesize and filetype, but every time I omit them, I get a org.springframework.dao.InvalidDataAccessApiUsageE xception: Required input parameter 'FILESIZE' is missing exception.

    Could anyone tell me if there is a way to use procedure default arguments?

    Thanks,
    Mark
Working...
X