Page 1 of 1

Trouble binding parms with LIKE w/Oracle

Posted: Tue Jun 11, 2002 1:56 pm
by StOops
Hey guys and gals,

Having a bit of a rough time binding a parm with a LIKE statement

If I write

Code: Select all

SELECT user_id, addr1
FROM USER
WHERE UPPER(USERNAME) LIKE '%$user%'
all is well and fine.


However,

Code: Select all

SELECT user_id, addr1
FROM USER
WHERE UPPER(USERNAME) LIKE '%:uname%'

OCIBindByName($sth, ":uname", $myUser, -1);
gets me
OCIBindByName: ORA-01036: illegal variable name/number in script name.

Thinking maybe it was the % symbol it was choiking on I moved the % to the var
$myUser = "%blah%";

Still same error.

So, ok, it is the single quote. Move that into the var and...I get no results (already verified it should get results). I'm guessing the single quote must be in the sql when it gets parsed.

Any ideas suggestions?? TIA

Posted: Tue Jun 11, 2002 2:53 pm
by StOops
Never mind, got it. You don't need the single quotes - teach me to copy and paste from SQLPlus :D