The function ldap_test( ) returns boolean. It runs perfectly itself. However, when I put it in the following SQL query, I caught the error "ORA-06553: PLS-382: experssion is of wrong type". Here's the details: select ldap_test('mypassword') from dual ORA-06552: PL/SQL: Statement ignored ORA-06553: PLS-382: expression is of wrong type The reasons is that booleans are not allowed inside SQL expressions, they are only allowed within PL/SQL expressions. If you need to call a function returning a boolean value inside a SQL query, you'll need to create a wrapper function returning either a number or a character value. Or you change the function to return a number or a character value. I changed the return type of ldap_test( ) to integer and successfully executed the SQL query. select ldap_test_more('mypassword') from dual; LDAP_TEST_MORE('mypassword') ---------------------------- 1 |