For administration needs, I need to create and replace stored procedures from Spring Repository. Has anyone already done this?
I tried to use following code(unfinished):
@Component
public class JdbcRepository {
@Autowired
private JdbcTemplate jdbc;
public void checkConn(){
jdbc.execute("create or replace package Z$CLIENT_INTERFACE_API as \n" +
" function CL_ORG_SEARCH_CREATE(p_request in clob) return clob;\n" +
"end Z$CLIENT_INTERFACE_API;\n" +
"/\n" +
"create or replace package body Z$CLIENT_INTERFACE_API as\n" +
" function CL_ORG_SEARCH_CREATE(p_request in clob) return clob\n" +
" is\n" +
" content_xml VARCHAR2(4000);\n" +
" p Dbms_Xmlparser.Parser;\n" +
" v_Doc Dbms_Xmldom.Domdocument;\n" +
" v_Root_Element Dbms_Xmldom.Domelement;\n" +
" v_Child_Nodes Dbms_Xmldom.Domnodelist;\n" +
" v_Child_Node Dbms_Xmldom.Domnode;\n" +
" v_Message_Id VARCHAR2(36);\n" +
" v_First_Char VARCHAR2(1);\n" +
" begin\n" +
" content_xml:= CAST(p_request as VARCHAR2);\n" +
" p := Dbms_Xmlparser.Newparser;\n" +
" dbms_xmlparser.setvalidationmode(p,False);\n" +
" dbms_xmlparser.parsebuffer(p,content_xml);\n" +
" v_Doc := dbms_xmlparser.getdocument(p);\n" +
" v_Root_Element := Dbms_Xmldom.getdocumentelement(v_Doc);\n" +
" return 'aaaaaaaaaaaaaaaaaaaaaaaaaa1';\n" +
" end;\n" +
"end Z$CLIENT_INTERFACE_API;\n" +
"/");
}
}
But whan I execute it, i take broken package in db. In same time, whan I run this from SQLDeveloper - all works perfect.
You are separating statements by both semicolon ;
and slash /
.
Try using only one of those, but not both. If that doesn't work either, try executing each statement separately with execute( )