PostgreSQL CallableStatement:偏移量6处的函数或过程转义语法格式错误

PostgreSQL CallableStatement:偏移量6处的函数或过程转义语法格式错误,postgresql,jdbc,callable-statement,Postgresql,Jdbc,Callable Statement,Java应用程序使用CallableStatement调用Postgres存储函数时出错。错误如下: org.postgresql.util.PSQLException: Malformed function or procedure escape syntax at offset 6. at org.postgresql.jdbc2.AbstractJdbc2Statement.modifyJdbcCall(AbstractJdbc2Statement.java:2390) a

Java应用程序使用CallableStatement调用Postgres存储函数时出错。错误如下:

org.postgresql.util.PSQLException: Malformed function or procedure escape syntax at offset 6.
    at org.postgresql.jdbc2.AbstractJdbc2Statement.modifyJdbcCall(AbstractJdbc2Statement.java:2390)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.<init>(AbstractJdbc2Statement.java:149)
    at org.postgresql.jdbc3.AbstractJdbc3Statement.<init>(AbstractJdbc3Statement.java:40)
    at org.postgresql.jdbc3g.AbstractJdbc3gStatement.<init>(AbstractJdbc3gStatement.java:26)
    at org.postgresql.jdbc3g.Jdbc3gStatement.<init>(Jdbc3gStatement.java:28)
    at org.postgresql.jdbc3g.Jdbc3gPreparedStatement.<init>(Jdbc3gPreparedStatement.java:21)
    at org.postgresql.jdbc3g.Jdbc3gCallableStatement.<init>(Jdbc3gCallableStatement.java:17)
    at org.postgresql.jdbc3g.Jdbc3gConnection.prepareCall(Jdbc3gConnection.java:45)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.prepareCall(AbstractJdbc3Connection.java:316)
    at org.postgresql.jdbc2.AbstractJdbc2Connection.prepareCall(AbstractJdbc2Connection.java:203)
    at com.mchange.v2.c3p0.impl.NewProxyConnection.prepareCall(NewProxyConnection.java:632)
    at zm.co.freight.model.user.UserRoleModel.getUserRoleDocumentPermission(UserRoleModel.java:212)
进行调用的Java方法:

public ArrayList<UserRoleDocumentPermissionDao> getUserRoleDocumentPermission (int userRoleId){
        ArrayList<UserRoleDocumentPermissionDao> result = new ArrayList<UserRoleDocumentPermissionDao>();
        try{
            cstmt = myConnection.prepareCall("{ ? = \"user_role_document_permission_select_all_per_user_role\"(?)}");
            cstmt.registerOutParameter(1, Types.OTHER);
            cstmt.setInt(2, userRoleId);
            cstmt.execute();
            rs = (ResultSet) cstmt.getObject(1);
            ResultSetMetaData rsmd = rs.getMetaData();
            int columnCount = rsmd.getColumnCount();
            UserRoleDocumentPermissionDao udao;
            while (rs.next()){
                udao = new UserRoleDocumentPermissionDao();
                for (int i = 1; i <= columnCount; i++){
                    if (i == 1){                                // document name
                        udao.setDocumentName(rs.getString(i));
                    } else if (i == 2){                         // view
                        udao.setViewing(rs.getBoolean(i));
                    } else if (i == 3){                         // process
                        udao.setProcessing(rs.getBoolean(i));
                    } else if (i == 4){                         // edit
                        udao.setEditing(rs.getBoolean(i));
                    } else if (i == 5){                         // update
                        udao.setUpdating(rs.getBoolean(i));
                    } else if (i == 6){                         // userRoleId
                        udao.setUserRoleId(rs.getInt(i));
                    } else if (i == 7){                         // documentId
                        udao.setDocumentId(rs.getLong(i));
                    }
                }
                result.add(udao);
            }
        } catch (SQLException e){
            System.out.println("SQL Exception: ");
            e.printStackTrace();
        } finally {
            closeConnection();
        }

        return result;
    }
道:

public class UserRoleDocumentPermissionDao {

    private String documentName;
    private boolean viewing;
    private boolean processing;
    private boolean editing;
    private boolean updating;
    private int userRoleId;
    private Long documentId;

    public UserRoleDocumentPermissionDao(){}

    public UserRoleDocumentPermissionDao(String docName, boolean view, 
            boolean process, boolean edit, boolean update, int userRoleIdin, Long docId){
        this.documentName = docName;
        this.viewing = view;
        this.processing = process;
        this.editing = edit;
        this.updating = update;
        this.userRoleId = userRoleIdin;
        this.documentId = docId;
    }
/////// getters and setters
我不知道为什么会这样。我已经能够成功地从返回refcursor的Postgres存储函数中获得结果,并且我似乎无法找出该函数/函数调用与此函数/函数调用之间的任何区别


任何想法都将不胜感激

您忘记了
呼叫
关键字:

cstmt = myConnection.prepareCall("{ ? = call user_role_document_permission_select_all_per_user_role(?)}");

您忘记了
呼叫
关键字:

cstmt = myConnection.prepareCall("{ ? = call user_role_document_permission_select_all_per_user_role(?)}");
cstmt = myConnection.prepareCall("{ ? = call user_role_document_permission_select_all_per_user_role(?)}");