Difficulty loading oracle data with js function (jquery and ajax)

1

This is my scenario: I have two pages (A and B). In B I load a variable with data coming from Oracle. In B I also set up my table which will be displayed in A with this data. On page A I have my js (jquery and ajax) function, which takes this table already loaded and mounted on B and unloads on one or something else. Oracle is returning me an error, but I'm sure that the way it's done is wrong, so the error. Here I load the Oracle variable:

set rsPesquisa = rsCursorOracle( CStr(Session("ace_usuario")),_
                                 CStr(Session("ace_senha")),_
                                 CStr(Session("ace_ip")),_
                                 CStr(Session("ace_sistema")),_
                                 CStr(Session("ace_modulo")),_
                                 "prs_rcs_gestao.get_prestador_tipo", _
                                 vetPL, _
                                 false )  

Now comes the part that is making me sleep, in fact, one of them. Where do I set the table. I just did an example with only one. Note: In the code a part was filled that filled a component called EbaGrid, that is the reason for this table, to replace EbaGrid, since it does not run in Chrome.

if ucase(origem) = "CONSULTA" then
        Do While Not rsPesquisa.eof

            if IsNull(rsPesquisa("cod_prestador_ts")) then
                ind_selecionado = "N"
            else
                ind_selecionado = "S"
            end if

            if ind_selecionado = "S" then 
                ind_internacao      = lerCampo(rsPesquisa("ind_internacao"))
                ind_emergencia      = lerCampo(rsPesquisa("ind_emergencia"))
                ind_day_hospital    = lerCampo(rsPesquisa("ind_day_hospital"))

                sRetorno = "<tr>"
                sRetorno = sRetorno & "<td>"&ind_internacao&"</td>" 
                sRetorno = sRetorno & "<td>"&ind_emergencia&"</td>" 

                sRetorno = sRetorno & "</tr>"
            end if 
            rsPesquisa.movenext
        loop   
            Response.write sRetorno
    else
        Do While Not rsPesquisa.eof

            if IsNull(rsPesquisa("cod_prestador_ts")) then
                ind_selecionado = "N"
            else
                ind_selecionado = "S"
            end if

            ind_internacao      = lerCampo(rsPesquisa("ind_internacao"))
            ind_emergencia      = lerCampo(rsPesquisa("ind_emergencia"))
            ind_day_hospital    = lerCampo(rsPesquisa("ind_day_hospital"))          

            sRetorno = "<tr>"
            sRetorno = sRetorno & "<td>"&ind_internacao&"</td>" 
            sRetorno = sRetorno & "<td>"&ind_emergencia&"</td>" 

            sRetorno = sRetorno & "</tr>"

            rsPesquisa.movenext
        loop   

    end if 

    set oPesquisa      = nothing    
    set rsPesquisa     = nothing

These code are on page B. On page B, you have these variables being loaded, which I loaded on page A and tried to pass as parameters. Even though I do not do this, the same error continues:

cod_prestador_ts = Request("cod_prestador_ts")
ind_vinculacao   = Request("ind_vinculacao")
origem           = Request("origem")

Now the code for page A.

    function CarregaTabela() {
       var sUrl     = $('#sUrl').val();
       //var str = "";
       var cod_ts   = '<%= Request.QueryString("cod_prestador_ts")%>';
       var ori      = '<%= Request.QueryString("Origem")%>';
       var ind_vinc = '<%= Request.QueryString("ind_vinculacao")%>';

   alert(cod_ts);

    $.ajax({
        url: sUrl,
        datatype: 'json',
        contentType: 'application/json; charset=utf-8',
        type: 'POST',
        data: JSON.stringify({ cod_prestador_ts: cod_ts, origem: ori, ind_vinculacao: ind_vinc }),
        success: function (data) {

            alert(2);
            alert(data);

            $('#cbxAcao').html(data);

        },
        error: function (error) {

            alert(3);
        }
    })
}

This is Oracle's error:

  

ORA-20001: Linkage must be informed. ORA-06512: in   "TS.PRS_RCS_GESTAO", line 118 ORA-06512: in line 1

    
asked by anonymous 23.09.2015 / 21:50

1 answer

0

What happens is that my URL was being set up wrong.

1) I do not need path complete, because the file to be called is in the same folder as the caller.

2) I was setting url wrongly. I should pass the url and more the parameters, because as it is by querystring that will be passed to oracle , that's where I went wrong. See how the function was correctly, now enter the ajax success, that is, I get the alert(2) .

function CarregaTabela() {
       var cod_ts   = '<%= Request.QueryString("cod_prestador_ts")%>';
       var ori      = '<%= Request.QueryString("Origem")%>';
       var ind_vinc = $("#ind_vincul").val();
       var cod_oper = '<%= Request.QueryString("cod_operadora")%>';
       var ind_aut  = '<%= Request.QueryString("ind_autorizacao")%>';

       alert(ind_vinc);

        $.ajax({
            url: 'prs0061b_crossbrowser.asp?cod_prestador_ts=' + cod_ts + '&ind_vinculacao=' + ind_vinc + '&origem=' + ori + '&ind_autorizacao=' + ind_aut + '&cod_operadora_principal=' + cod_oper + '',
            type: 'POST',
            success: function (data) {

                alert(2);

            },
            error: function (error) {

                alert(3);
            }
        })
    }
    
24.09.2015 / 19:58