i have a variable that receive the string like this:
'BA','RJ','SC'
and i need to send to db in this format as a string, but i’m getting the error:
PLS-00103: Encountered the symbol “BA” when expecting one of the following: ) , * & | = – +
i print the $sql to see how the values are going to:
BEGIN TWD_WEB_CRM.PESQUISA_CLIENTES(1,''BA','RJ','SC'','132','',:status,:refc); END;
so, this is how i’m passing with php to the procedure:
$sql = "BEGIN TWD_WEB_CRM.PESQUISA_CLIENTES(".$codemp.",'".$estados."','".$diac."','".$dian."',:status,:refc); END;";
the variable $estados receive: 'BA','RJ','SC'
so, my question is:
how can i pass this kind of string with ' and , to my procedure using php ?
i try with \ but didin’t work.
what i’m missing ?
any question, by my guest.
Thanks.
Edit
BEGIN TWD_WEB_CRM.PESQUISA_CLIENTES
(
1,
''BA','RJ','SC'', // this supposed to be 1 field with strings...
'132',
'',
:status,
:refc
);
END;
In Oracle, escape single quotes by doubling them. This will treat the full comma-separated string as one string literal with escaped quotes.
This assumes I understand correctly and you are passing these values as a string literal.
Ultimately, your query should look like:\