Forum Stats

  • 3,826,046 Users
  • 2,260,590 Discussions
  • 7,896,779 Comments

Discussions

Oracle12c PHP

artsunixlabs
artsunixlabs Member Posts: 219 Bronze Badge
edited Mar 3, 2015 11:10AM in PHP

How can I properly describe the dollar sign in PHP ->> v$parameter

$sysparm = ("select * from v'$'parameter"); <-- First attempt

PHP Warning:  oci_execute(): ORA-00933: SQL command not properly ended in /var/apache2/2.2/cgi-bin/oracle-master-sysparms.php on line 15

PHP Stack trace:

PHP   1. {main}() /var/apache2/2.2/cgi-bin/oracle-master-sysparms.php:0

PHP   2. oci_execute() /var/apache2/2.2/cgi-bin/oracle-master-sysparms.php:15

PHP Fatal error:  Could not execute statement: ORA-00933: SQL command not properly ended in /var/apache2/2.2/cgi-bin/oracle-master-sysparms.php on line 18

PHP Stack trace:

PHP   1. {main}() /var/apache2/2.2/cgi-bin/oracle-master-sysparms.php:0

PHP   2. trigger_error() /var/apache2/2.2/cgi-bin/oracle-master-sysparms.php:18

[email protected]:/var/apache2/2.2/cgi-bin$

==============================================================

                                                           CODE

==============================================================

<?php

$sysparm = ("select * from v'$'parameter");

$conn = oci_connect('system', 'welcome1', 'solaris-master:1521/x86artsdb');

if (!$conn) {

    $m = oci_error();

    trigger_error('Could not connect to database: '. $m['message'], E_USER_ERROR);

}

$s = oci_parse($conn, $sysparm);

if (!$s) {

    $m = oci_error($conn);

    trigger_error('Could not parse statement: '. $m['message'], E_USER_ERROR);

}

$r = oci_execute($s);

if (!$r) {

    $m = oci_error($s);

    trigger_error('Could not execute statement: '. $m['message'], E_USER_ERROR);

}

$r = oci_fetch_all($s, $res);

if (!$r) {

    $m = oci_error($s);

    trigger_error('Could not fetch rows: '. $m['message'], E_USER_ERROR);

}

echo "<table border='3'>\n";

foreach ($res as $row) {

    echo "$r";

    echo "<tr>\n";

    foreach ($row as $item) {

        echo "  <td>".($item!==null?htmlentities($item,

                       ENT_QUOTES):" ")."</td>\n";

    }

    echo "</tr>\n";

}

echo "</table>\n";

?>

===========================================================

Answers

  • artsunixlabs
    artsunixlabs Member Posts: 219 Bronze Badge
    edited Mar 3, 2015 11:10AM

    SYSERR:  ORA-00933: SQL command not properly ended


    ANALYSTLOGS:

    Fix: v\$ - BackSlash (\)  on front of ($) - Keeping in mind that v$parameter is an Oracle12c system value parameter and it does not represent my personal  variable. - Art.S 03/03/2015

    [email protected]:/var/apache2/2.2/cgi-bin$ cat -n  oracle-master-sysparms.php

         1    <?php

         2    

         3    $sysparm = ("select * from v\$parameter");

         4   

         5    $conn = oci_connect('system', 'thankyou', 'solaris-master:1521/x86artsdb');

         6    if (!$conn) {

         7        $m = oci_error();

         8        trigger_error('Could not connect to database: '. $m['message'], E_USER_ERROR);

         9    }

        10    $s = oci_parse($conn, $sysparm);

        11    if (!$s) {

        12        $m = oci_error($conn);

        13        trigger_error('Could not parse statement: '. $m['message'], E_USER_ERROR);

        14    }

        15    $r = oci_execute($s);

        16    if (!$r) {

        17        $m = oci_error($s);

        18        trigger_error('Could not execute statement: '. $m['message'], E_USER_ERROR);

        19    }

        20    $r = oci_fetch_all($s, $res);

        21    if (!$r) {

        22        $m = oci_error($s);

        23        trigger_error('Could not fetch rows: '. $m['message'], E_USER_ERROR);

        24    }

        25    echo "<table border='3'>\n";

        26    foreach ($res as $row) {

        27        echo "$r";

        28        echo "<tr>\n";

        29        foreach ($row as $item) {

        30            echo "  <td>".($item!==null?htmlentities($item,

        31                           ENT_QUOTES):" ")."</td>\n";

        32        }

        33        echo "</tr>\n";

        34    }

        35    echo "</table>\n";

        36    

        37    ?>

        38   

    [email protected]:/var/apache2/2.2/cgi-bin$

    EXECUTION:

    [email protected]:/var/apache2/2.2/cgi-bin$ php oracle-master-sysparms.php

    <table border='3'>

    381<tr>

      <td>41</td>

      <td>42</td

    381<tr>

      <td>lock_name_space</td>

      <td>processes</td>

      <td>sessions</td>

      <td>timed_statistics</td>

      <td>timed_os_statistics</td>

      <td>resource_limit</td>

      <td>license_max_sessions</td>

      <td>license_sessions_warning</td>

      <td>cpu_count</td>

      <td>instance_groups</td>

      <td>event</td>

    >

This discussion has been closed.