Error executing Oracle command

1

Well, good afternoon,

I'm having trouble calling a function in Oracle ... The function is this:

function mataSessao(){
    $connect = oci_connect('xxxx','xxxx','xxxxx','xxxxx');
    $IDSESSAO = $_POST['idsessao'];
    $IDSERIAL = $_POST['idserial'];
    $matasessao = "ALTER SYSTEM KILL SESSION :IDSESSAO, :IDSERIAL IMMEDIATE";
    $prepare = oci_parse($connect,$matasessao);
    oci_bind_by_name($prepare, ':IDSESSAO', $IDSESSAO);
    oci_bind_by_name($prepare, ':IDSERIAL', $IDSERIAL);
    $resultado = oci_execute($prepare);
    }   
    if (isset($_POST['kill'])) {
    mataSessao();
}

She's coming back

Warning: oci_bind_by_name (): in C: \ Program Files \ EasyPHP-DevServer-14.1VC9 \ data \ localweb \ script \ index.php on line 61

Warning: oci_bind_by_name (): in C: \ Program Files \ EasyPHP-DevServer-14.1VC9 \ data \ localweb \ script \ index.php on line 62

Warning: oci_execute (): in C: \ Program Files \ EasyPHP-DevServer-14.1VC9 \ data \ localweb \ script \ index.php on line 63

Thank you in advance, guys.

    
asked by anonymous 08.05.2017 / 19:50

1 answer

1

Try the following:

function mataSessao(){
    $connect = oci_connect('xxxx','xxxx','xxxxx','xxxxx');
    $IDSESSAO = $_POST['idsessao'];
    $IDSERIAL = $_POST['idserial'];
    $matasessao = "ALTER SYSTEM KILL SESSION ':IDSESSAO, :IDSERIAL' IMMEDIATE";
    $prepare = oci_parse($connect,$matasessao);
    oci_bind_by_name($prepare, ':IDSESSAO', $IDSESSAO);
    oci_bind_by_name($prepare, ':IDSERIAL', $IDSERIAL);
    $resultado = oci_execute($prepare);
    }   
    if (isset($_POST['kill'])) {
    mataSessao();
}

The kill session command receives a string with the SID and serial comma-separated in this order. The following Oracle documentation with command syntax: link

    
01.06.2017 / 18:23