[SOLVED]oci_execute() returns false and oci_error() is false

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vaughtg
Forum Commoner
Posts: 39
Joined: Thu Feb 17, 2011 9:43 am

[SOLVED]oci_execute() returns false and oci_error() is false

Post by vaughtg »

I've got the following code in my class:

Code: Select all

    public function updateVacancy($vacId, $jobID, $locID, $numVacancies,
        $sort_order=null, $status, $hrs_no=null, $empType, $pay, $hours,
        $qualClass, $stDate, $endDate){
      $updated = true;
      $conn = new DBConnection();
      if(0 == $vacId){
        $sas_vacancy_no = $conn->getNextId("sas_vacancy_number_seq");
        $query = "insert into vacancies (VACANCYID, JOBID, LOCID, SORT_ORDER, ".
            "DBUSER, STATUS, STATUSDATE, UM_HRS_VACANCY_NO, ".
            "EMPLOYMENT_TYPE, OPENINGS, WAGES, HOURS, QUALIFIED_CLASS, ".
            "START_DATE, END_DATE) ".
            "values (:sas_vacancy_no, :jobID, :locID, :sort_order, ".
            ":HRuser, 'ACTIVE', sysdate, :hrs_no, :empType, :openings, :wages, ".
            ":hours, :qualClass, :start, :end)";
        $stid = oci_parse($conn->getConnection(), $query);
        oci_bind_by_name($stid, ":sas_vacancy_no", $sas_vacancy_no);
        oci_bind_by_name($stid, ":jobID", $jobID);
        oci_bind_by_name($stid, ":locID", $locID);
        oci_bind_by_name($stid, ":sort_order", $sort_order);
        oci_bind_by_name($stid, ":HRuser", $_SESSION['HRuser']);
        oci_bind_by_name($stid, ":hrs_no", $hrs_no);
        oci_bind_by_name($stid, ":empType", $empType);
        oci_bind_by_name($stid, ":openings", $numVacancies);
        oci_bind_by_name($stid, ":wages", $pay);
        oci_bind_by_name($stid, ":hours", $hours);
        oci_bind_by_name($stid, ":qualClass", $qualClass);
        oci_bind_by_name($stid, ":start", $stDate);
        oci_bind_by_name($stid, ":end", $endDate);
        if(!oci_execute($stid)){  // <---------------------Here is where I hit the breakpoint
          $updated = false;
          $err = oci_error();
          $this->setOciErrorMsg($err);
        }
I stop the debugger at the line noted and check my values - they're all good. I even verified that the empty input data is a zero-length string, not just a null.

I've checked everything I can think of, and when I step it, I hit the $updated = false; line. Okay, so let's see what oci_error() returns, right? False, that what it returns.

So, if oci_execute() comes back false, and oci_error() comes back false, what's the deal? Anybody seen this before?
Last edited by vaughtg on Wed Jul 13, 2011 2:15 pm, edited 1 time in total.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: oci_execute() returns false and oci_error() is false

Post by Benjamin »

If oci_execute is returning false, which the manual states it does on failure one would presume that the query failed. Whether or not a query failure would throw an error as it does in the mysql functions is another story. I've never used the oci_ functions, so I can only give hypothetical advice here. What I would do is run the query manually in a terminal or web interface and see what happens. Also be sure you've got error reporting and display errors enabled or just check the error log.
vaughtg
Forum Commoner
Posts: 39
Joined: Thu Feb 17, 2011 9:43 am

[SOLVED] oci_execute() returns false and oci_error() is fals

Post by vaughtg »

Sorry that I've ignored this for so long. I honestly don't recall what the solution was on this, could have been my use of the library or server configuration or any of a host of other changes I've made in the past 2 months - but the ultimate problem was my ignorance. I'm marking this as solved simply because it is no longer an issue.
Post Reply