Reputation: 23
I have an oracle connection string above the following select statement.
Here's the select statement:
$stid = oci_parse($conn1, 'SELECT s.SID, USERNAME AS "User", PROGRAM, MODULE,
ACTION, LOGON_TIME "Logon", l.*
FROM V$SESSION s, V$ENQUEUE_LOCK l
WHERE l.SID = s.SID
AND l.TYPE = 'CF'
AND l.ID1 = 0
AND l.ID2 = 2');
oci_execute ($stid);
However, it's giving me a t_string error on line 69. Which is this line:
AND l.TYPE = 'CF'
Is the single quotes the issue?
Upvotes: 0
Views: 997
Reputation: 975
Yes, the single quotes are the issue.
Either escape the CF quotes like this \'CF\'
or use " instead.
Upvotes: 0
Reputation: 3078
You have to escape the single quotes:
$stid = oci_parse($conn1, 'SELECT s.SID, USERNAME AS "User", PROGRAM, MODULE,
ACTION, LOGON_TIME "Logon", l.*
FROM V$SESSION s, V$ENQUEUE_LOCK l
WHERE l.SID = s.SID
AND l.TYPE = \'CF\'
AND l.ID1 = 0
AND l.ID2 = 2')
Right now, it's being parsed as:
'SELECT s.SID, USERNAME AS "User", PROGRAM, MODULE,
ACTION, LOGON_TIME "Logon", l.*
FROM V$SESSION s, V$ENQUEUE_LOCK l
WHERE l.SID = s.SID
AND l.TYPE = '
And then your value, and then another string, which is invalid syntax.
Upvotes: 3