Is it possible to call sql function via prepared Statement in java?
-
Through pgAdmin, I created a function for my database, can I create a request on the server using preparedStatement to call this function, that is, pass it the following line as an argument:
private static final String SQL_FUNC_REQUEST = "Select addNode(?, xmlelement(name action, xmlattributes('? as billId, ? as name), \n" + "\t\t\t\t\t\t\t xmlelement(name status, ?)));"; PreparedStatement preparedStatement = connection.prepareStatement(SQL_FUNC_REQUEST)
My function has the following signature:
create or replace function addNode(xmlId integer, newNode xml) returns void as ...
That is, he will also see this function after it has been created, do I understand correctly?Java Anonymous, Apr 25, 2019 -
Use the CallableStatement interface to call functions.Adrian Ochoa
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!