I’ve got a problem in an Oracle function execution. I’ve a table loginfo(username,password,type) and I’ve a function like this:
CREATE OR REPLACE FUNCTION login(name in varchar2,pass in varchar2 )
RETURN integer
IS
v_type integer;
BEGIN
Select loginfo.type
INTO v_type from loginfo
where loginfo.username=name
and loginfo.password=pass;
RETURN (v_type);
END;
I’ve two types of loginfo; type 1 and 2. If I call this function from php with a parameter that should return type 1 it does. When I call this function with a parameter that should return type 2 it returns the error OCI_NO_DATA in the PHP page. However, when I call function from Oracle it returns 2.
It should return type 2 when my parameters are username = '8801716560946' and password = '123456'.
OCI_NO_DATAimplies that there are no rows that match the parameters you’ve passed in in the table. I’ll wager that you’re passing different parameters when you call the function from PHP. Perhaps you’re passing in strings with some additional spaces in one case and not the other, for example.