Procedure Parameters
You can use the DatabaseMetaData interface to retrieve stored procedure information. The getProcedureColumns method returns descriptions of stored procedure parameters. You can restrict the results by the stored procedure name.
The following code example outputs information about the parameters of the ContactMarkAsActive stored procedure:
String connectionString = "jdbc:zohoinventory:InitiateOAuth=GETANDREFRESH;OrganizationId=YourOrganizationId;"; Connection conn = DriverManager.getConnection(connectionString); DatabaseMetaData meta = conn.getMetaData(); ResultSet rs=meta.getProcedureColumns(null, null, "ContactMarkAsActive", null); while(rs.next()) { for(int i=1;i<=rs.getMetaData().getColumnCount();i++) { System.out.println(rs.getMetaData().getColumnName(i) +"="+rs.getString(i)); } }The getProcedureColumns method returns the following columns:
Column Name | Data Type | Description |
PROCEDURE_CAT | String | The catalog that the procedure belongs to. |
PROCEDURE_SCHEM | String | The schema that the procedure belongs to. |
PROCEDURE_NAME | String | The name of the stored procedure. |
COLUMN_NAME | String | The name of the procedure column. |
COLUMN_TYPE | String | The type of procedure column as defined by the following DatabaseMetaData constants: procedureColumnIn (1), procedureColumnInOut (2), procedureColumnResult (3), procedureColumnOut (4), and procedureColumnReturn (5). |
DATA_TYPE | int | The data type name as defined in java.sql.Types. |
TYPE_NAME | String | The driver-defined data type name. |
PRECISION | int | The number of digits allowed for numeric data. |
LENGTH | int | The number of characters allowed for character data. The number of digits allowed for numeric data. |
SCALE | short | The number of digits to the right of the decimal point in numeric data. |
RADIX | short | The radix, or base. |
NULLABLE | short | Whether the parameter can contain null as defined by the following DatabaseMetaData constants: parameterNoNulls (0), parameterNullable (1), and parameterNullableUnknown (2). |
REMARKS | String | The description of the parameter. |
COLUMN_DEF | String | The default value for the parameter. |
SQL_DATA_TYPE | int | Reserved in the specification. |
SQL_DATETIME_SUB | int | Reserved in the specification. |
CHAR_OCTET_LENGTH | int | The maximum length of binary-based and character-based columns. Null for other data types. |
ORDINAL_POSITION | int | The index of the output parameter. |
IS_NULLABLE | String | Whether the column can include null: YES or NO. |
SPECIFIC_NAME | String | The name that uniquely identifies the stored procedure within its schema. |