Forum Stats

  • 3,874,324 Users
  • 2,266,722 Discussions
  • 7,911,817 Comments

Discussions

View select queries produce no results

contemplator
contemplator Member Posts: 3
edited Apr 21, 2015 11:06AM in PHP

I followed the "Using PHP OCI8 and Oracle" instruction on Installing PHP and the Oracle 11g Instant Client for Linux and Windows. It works perfectly.

I selected my own table:

$stid = oci_parse($conn, 'select * from person');

and all my table rows appeared.

I then created a view from that table, and selected it:

$stid = oci_parse($conn, 'select * from vw_person');

The query executed without errors, but no rows have appeared.

The views displays a few rows when I query it in the SQL Command Line.

I tried: changing the spelling and adding "/" but just got ORA errors. Which means the connection is sound.

I changed it back, even tried selecting one column, but no errors appeared nor any rows.

help?

Answers

  • contemplator
    contemplator Member Posts: 3
    edited Apr 20, 2015 3:52AM

    It's funny that the day before, I get stumped by a problem the whole day... then the next day I find the answer to my problem.

    The view is actually working. but the last record is not appearing. This is the same for my tables. no last record.

    I get 3 rows in the table in the SQL Command Line.

    I get 2 rows in the view in the SQL Command Line.

    I get 2 rows in the table in the PHP Web page.

    I get 1 row in the view in the PHP Web page.

    I have only changed the select statement, the rest of the code is the same.

    help?

  • contemplator
    contemplator Member Posts: 3
    edited Apr 20, 2015 7:13AM

    OK, I have just figured it out.

    Oracle 11g XE allows for one session. Connecting to Oracle through PHP counts as a session.

    Disconnecting the console fixed the problem.

  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,656 Employee
    edited Apr 21, 2015 11:06AM

    You can have more than one session at a time to XE.  At a guess, you hadn't committed in the first session and disconnecting performed the commit for you.  This let the other session see the data.

This discussion has been closed.