1
I did all the configuration to connect on Oracle, it connects, but I want to make a query within a function, but it is giving the following error message:
Queryexception in Connection.php line 729: oci_bind_by_name(): ORA-01036: illegal variable name/number (SQL: SELECT funcao(':login') FROM DUAL)
The appointment I’m trying to make is like this:
public function login()
{
$login = Request::input('login');
$var = DB::connection('oracle1')
->select("SELECT funcao(':login') FROM DUAL",
array( "login" => $login));
return 'Resultado: '.$var;
}
Having a question mark (?)
DB::connection('oracle1')
->select("SELECT funcao('?') FROM DUAL",
array( "login" => $login));
The message gives a little change:
oci_bind_by_name(): ORA-01036: illegal variable name/number (SQL: SELECT funcao('CARLOS.BRITO') FROM DUAL)
Tried to query without simple Apas in placeholder (
login
or?
)?– rray
Same message.
– adventistaam
DB::connection('oracle1')->select("SELECT funcao(?) FROM DUAL", array($login));
orDB::connection('oracle1')->select("SELECT funcao(:login) FROM DUAL", array(":login" => $login));
makes the same mistake?– rray
Yes, it only changed that one came with the login informed and the other with the parameter only, but I found out! In the array, I only informed the variable and it worked out so:
...select("SELECT funcao(?) FROM DUAL", array( $login )
– adventistaam
@adventistaam if you can put your comment as answer to your own question, then tick how answer it is good to do this so your question has an answer. all right!
– novic