Hello,
I have java function which when used executes a stored procedure which inturn returns a VARCHAR value.
The java function:
public String getDocumentName () {
try {
System.out.println("DBDocument getDocumentName() ID : " +super.getId());
System.out.println(" "
;
CallableStatement statement = con.prepareCall("{ ? = call getDocumentName (?)}"
;
statement.registerOutParameter(1,java.sql.Types.VARCHAR);
statement.setLong (1, super.getId());
ResultSet resultSet = statement.executeQuery();
if (!resultSet.next()) {
throw new DBDOMSpException ("SQL Statement"
;
}
System.out.println("DBDocument getDocumentName() resultSet : "
;
System.out.println(" "
;
String result = statement.getString (1);
System.out.println("DBDocument getDocumentName() result : " +result);
System.out.println(" "
;
resultSet.close();
return result;
} catch (SQLException sqle) {
throw dbDomImplementation.getSqlOrDomException(sqle);
}
}
The stored procedure:
CREATE OR REPLACE FUNCTION getDocumentName (docId NUMBER) RETURN VARCHAR IS
nodeIsDoc BOOLEAN;
result VARCHAR (255);
BEGIN
nodeIsDoc := nodeTypeMatches (docId, 9);
IF NOT nodeIsDoc THEN
DOMException(15);
ELSIF nodeIsDoc IS NULL THEN
raise_application_error (-20205, ' Document does not exists');
ELSE
SELECT name
INTO result
FROM t_Document
WHERE id = docId;
END IF;
RETURN result;
END getDocumentName;
I have checked the value returned by the stored procedure explixitly which looks like this "/home/s0199941/Project/node_in_dtd3.xml".
But the exception of parameter type conflict is thrown.
Can any one suggest something?
Regards
I have java function which when used executes a stored procedure which inturn returns a VARCHAR value.
The java function:
public String getDocumentName () {
try {
System.out.println("DBDocument getDocumentName() ID : " +super.getId());
System.out.println(" "
CallableStatement statement = con.prepareCall("{ ? = call getDocumentName (?)}"
statement.registerOutParameter(1,java.sql.Types.VARCHAR);
statement.setLong (1, super.getId());
ResultSet resultSet = statement.executeQuery();
if (!resultSet.next()) {
throw new DBDOMSpException ("SQL Statement"
}
System.out.println("DBDocument getDocumentName() resultSet : "
System.out.println(" "
String result = statement.getString (1);
System.out.println("DBDocument getDocumentName() result : " +result);
System.out.println(" "
resultSet.close();
return result;
} catch (SQLException sqle) {
throw dbDomImplementation.getSqlOrDomException(sqle);
}
}
The stored procedure:
CREATE OR REPLACE FUNCTION getDocumentName (docId NUMBER) RETURN VARCHAR IS
nodeIsDoc BOOLEAN;
result VARCHAR (255);
BEGIN
nodeIsDoc := nodeTypeMatches (docId, 9);
IF NOT nodeIsDoc THEN
DOMException(15);
ELSIF nodeIsDoc IS NULL THEN
raise_application_error (-20205, ' Document does not exists');
ELSE
SELECT name
INTO result
FROM t_Document
WHERE id = docId;
END IF;
RETURN result;
END getDocumentName;
I have checked the value returned by the stored procedure explixitly which looks like this "/home/s0199941/Project/node_in_dtd3.xml".
But the exception of parameter type conflict is thrown.
Can any one suggest something?
Regards