Ajax , Call Procedure (oracle) , xml

Joined
Jul 9, 2023
Messages
25
Reaction score
0
hello
The oracle procedure must be called using Ajax.

Code:
var argData =
     {
         …..
     };
     $.ajax({ method: “POST”,
               url : ……/api/abc.xml,
             })
             .done( function( data )
             {
                 var value = JSON.parse(data);
             });



abc.xml uses the structure below.

Code:
<select id="getUserList" resultMap="UserVO">
    <![CDATA[
    select * from user where id > @id
    ]]>
</select>

I need to modify the above code structure to call the oracle procedure.
How should I call the procedure?

Can I just change the xml code below?


Code:
<select id="getUserList" resultMap="UserVO">

    <![CDATA[

    EXECUTE sp_procedure @id

    ]]>

</select>
 
Last edited:
Joined
Jul 9, 2023
Messages
25
Reaction score
0
ajax({ method: "POST",
url: ...xml
dara: para,
async:false,
dataType: :"JSON"
}).done(function (data) {
 
Joined
Jul 4, 2023
Messages
366
Reaction score
41
Did you tried in that way:

for

abc.xml (PL/SQL syntax)
XML:
<select id="callProcedure" statementType="CALLABLE">
  <![CDATA[
    {call sp_procedure(#{id})}
  ]]>
</select>

JavaScript:
var argData = {
    id: 123 // Replace with the actual value for 'id' parameter
};

$.ajax({
    method: "POST",
    url: ".../api/abc.xml", // Replace with the actual URL
    data: JSON.stringify(argData), // Send the parameter as JSON data
    contentType: "application/json", // Set the content type to JSON
})
.done(function (data) {
    // Handle the response data if needed
})
.fail(function (error) {
    // Handle any errors
});
 
Joined
Jul 9, 2023
Messages
25
Reaction score
0
Please Help Me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top