Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PHP error ociexecute ORA-06550 PLS-00201 identifier 'G' must be declared OR

552017Nov 6 2008 — edited Nov 6 2008
Hello, this is my first post and I am hoping it is deserving of everyone's experience.

I am in a internet programming class that teaches PHP and MySql. I use Oracle a lot and wanted to try to teach myself how to use the OCI functions to create a connection based on what I learned from MySQL. A little bit more is involved and now I am stuck.

I am trying to make a simple login page. The login page has a form with username and password and the authenticate page has PHP code that calls an Oracle function I wrote. The function works just fine in sqlplus and in SQL Developer but I get an error when using it in PHP. I also granted public permission on the function and that did not fix it.

I am running this off the university's servers so my limitations on configuring installs is limited.

The full error is: ociexecute error:ORA-06550: line 1, column 26: PLS-00201: identifier 'guest' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored




Here is the Oracle function code...

CREATE OR REPLACE FUNCTION fn_auth(uname IN USER_ACCESS.USERNAME%TYPE, pword IN USER_ACCESS.PASSWORD%TYPE) RETURN USER_ACCESS.USER_ID%TYPE IS

id USER_ACCESS.USER_ID%TYPE; --variable to store userid
BEGIN --begin execution

--begin query
SELECT user_id
INTO id
FROM USER_ACCESS
WHERE USERNAME = uname AND PASSWORD = pword;

--check if the query result is empty
IF id is null THEN
RETURN 0;
ELSE
RETURN id;
END IF;
END fn_auth; -- end of fn



Here is the PHP authentication page

<?php
include 'conn.inc.php';

$uname = $_POST['uname'];
$pword = $_POST['pword'];
echo "$uname";
echo "$pword";

//get the conn from the include file
$conn = getconnection(); //from include file
if(!$conn) { echo "error"; }
else {
//execute the function, if it is dead then show error
if (!$stmt = OCIParse($conn, "begin :result := fn_auth($uname, $pword); end;")) {
$error = OCIError($conn);
printf("ociparse error: %s", $error["message"]);
}
//else it was good so begin bind
else {
OCIBindByName($stmt, ":result", $userid, -1);
//run execution unless error then show errors***********************error is here
if (!OCIExecute($stmt, OCI_DEFAULT)) {
$error = OCIError($stmt);
printf("<br/> ociexecute error:%s", $error["message"]);
}
else {
OCIResult($stmt, $userid);
echo "UserID is: " . $userid;
ocifetchstatement($stmt, &$rows);
print_r($rows);
}
}
OCILogOff($conn);
}
?>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 4 2008
Added on Nov 6 2008
2 comments
3,984 views