Discussions
Categories
- 196.8K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 544 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.8K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.5K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 439 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
Oracle12c 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";
?>
===========================================================
Best Answer
-
See "Quoting SQL Statement Text" on page 148 of http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
Also see https://blogs.oracle.com/opal/entry/php_53_nowdocs_make_sql_escapi
Answers
-
See "Quoting SQL Statement Text" on page 148 of http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html
Also see https://blogs.oracle.com/opal/entry/php_53_nowdocs_make_sql_escapi
-
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>
>