Database Knowledge Base

oci_bind_by_name and placeholder name limit

Today I was working on a web-application using ALPHA Framework, and accidentally I discovered a problem using the oci_bind_by_name method.

The oci_bind_by_name role is to create a relationship between a php variable and an oracle placeholder (eg. :OracleVariableName)  to be used in the context of the prepared statement.

The limit is regarding the placeholder name length. Indeed it must be at maximum 30 characters long plus the colon (in total 31 chars). Otherwise oracle will output the following error:

 ORA-00972 - identifier is too long

Because the names for tables, clusters, views, indexes, synonyms, tablespaces, usernames and placeholders must be 30 characters or less, you must shorten the name to no more than 30 characters and the problem is solved.