Error executing Oracle command

Asked

Viewed 59 times

1

Everybody, good afternoon, everybody,

I’m having trouble calling a function in Oracle... This is the function:

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 is returning

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

Thanks in advance, guys.

  • There doesn’t seem to be an error ... there is more text in the message?

  • No, just that. But my command has no effect on the system. I call the function like this: if (isset($_POST['Kill'])) {mataSessao(); } and the system returns these warnings. For a moment I thought he was taking the null values, but I gave an echo and saw that it was normal.

  • Also remember to send one commit to say that the transaction has ended

  • I believe that in this command ALTER KILL may not accept reference parameter, you have already tried to send direct, to see what happens? ALTER SYSTEM KILL SESSION $idsessao, $idserial IMMEDIATE

  • - adventistaam, thus only Warning: oci_execute(): in C: Program Files Easyphp-Devserver-14.1VC9 data localweb script index.php on line 63

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 takes a string with SID and serial separated by comma in this order. The following is oracle documentation with command syntax: https://docs.oracle.com/cd/B28359_01/server.111/b28310/manproc008.htm#ADMIN11192

Browser other questions tagged

You are not signed in. Login or sign up in order to post.