public static void run() {
		Connection conn = null;
		ResultSet rs = null;
		try {
			String theClassName = "", 
					  theURL = "", 
					  theUser = "", 
					  thePassword = "", 
					  theFunctionName = "";
			
			Class.forName(theClassName);
			conn = DriverManager.getConnection(theURL, theUser, thePassword);
			DatabaseMetaData dbmd = conn.getMetaData();
			rs = dbmd.getProcedureColumns(null, null, theFunctionName, null);
			ResultSetMetaData rsmd = rs.getMetaData();
			
			int columnIndex = 1;
			boolean setNoCount = true;
			String productName = dbmd.getDatabaseProductName();
			while (rs.next()) {
				if (productName.indexOf("Microsoft") != -1) {
					if (getParameterType(rs.getInt(5)).equalsIgnoreCase("Return") && setNoCount == true) {
						setNoCount = false;
						continue;
					}
				}
				System.out.println("----------------------------------------");
				System.out.println("Parameter " + columnIndex++);
				System.out.println("Parameter Type : " + getParameterType(rs.getInt(5)));
				System.out.println("Name : " + rs.getString(4));
				System.out.println("Data Type : " + rs.getString(7));
				for (int i = 1; i < rsmd.getColumnCount(); i ++) {
					System.out.println("\t" + i + " - ColumnLabel : " + rsmd.getColumnLabel(i) + " : " + rs.getString(i));
					System.out.println("\t\tColumnClassName : " + rsmd.getColumnClassName(i));
					System.out.println("\t\tColumnName : " + rsmd.getColumnName(i));
					System.out.println("\t\tColumnType : " + rsmd.getColumnType(i));
					System.out.println("\t\tColumnTypeName : " + rsmd.getColumnTypeName(i));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (rs != null) {
					rs.close();
				}

				if (conn != null) {
					conn.close();
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
	
	private static String getParameterType(final int metadataType) {
		switch (metadataType) {
		case DatabaseMetaData.procedureColumnUnknown :
            return "Unknown";
        case DatabaseMetaData.procedureColumnIn :
        	return "In";
        case DatabaseMetaData.procedureColumnInOut :
        	return "InOut";
        case DatabaseMetaData.procedureColumnOut :
        	return "Out";
        case DatabaseMetaData.procedureColumnReturn :
            return "Return";
        case DatabaseMetaData.procedureColumnResult :
            return "Result";
        default:
        	return "Unknown";
		}
	}

Oracle, SQLServer를 기준으로 작성하였습니다. SQLServer같은 경우에는 첫번째 파라미터로 setNoCount가 오므로 두번째 파라미터부터 해당 프로시저의 첫번째 파라미터의 정보를 가져올수가 있습니다.

블로그 이미지

행복그리고..

,