Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8196409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:28:00+00:00 2026-06-07T05:28:00+00:00

I am trying to get Oracle procedures to execute from my PHP program. I

  • 0

I am trying to get Oracle procedures to execute from my PHP program. I created a simple test procedure:

CREATE OR REPLACE PROCEDURE "JKJ3"."GetUserLogin"
{
    userlogin_in in varchar2,
    userid_out out numeric,
    pass_out out varchar2
}
IS 
BEGIN
    SELECT user_id, password
    INTO userid_out, pass_out
    FROM "JKJ3"."USERS"
    WHERE login = userlogin_in;
END;

I tested the procedure using Aqua Data Studio:

DECLARE
    userid_out number;
    password_out number;
BEGIN
    "JKJ3"."GetUserLogin"('UserName', userid_out, password_out);
    dbms_enable(10000);
    dbms_put_line(userid_out);
    dbms_put_line(password_out);
END;

This works fine, returns the userid and the password value. So far so good!

I tried executing the procedure from PHP but I cant get the procedure to work to save my life!
PHP Code:

PutEnv("ORACLE_HOME=/afs/cad/solaris/oraclient10.2");   
$this->conn=oci_connect($this->ucid, $this->dbpassword, $this->db);

// Check if connection was sucessful.
if ( !$this->conn ) {
    echo "Unable to connect: " . var_dump( OCIError() );
    die("Unable to connect: " . var_dump( OCIError() ));
}

$query = 'BEGIN "JKJ3"."GetUserLogin"(:login_in, :userid_out, :password_out); END;';

// Execute stored procedure to add new user and return the new users ID        
$command = oci_parse($this->conn, $query) or die('Cannot parse query');

$userid;
$password_out;

// bind the input variables and out put variables.
oci_bind_by_name($command, ':login_in', $login, 30) or die('cannot bind login');        
oci_bind_by_name($command, ':userid_out', $userid) or die('cannot bind userid');
oci_bind_by_name($command, ':password_out', $password_out, 300) or die('cannot bind password');              

oci_execute($command);
echo 'userid = ' . $userid . ' password = ' . $password_out;
oci_close($this->conn); 

When I execute this I get a userid and password of null.

edit
I have the same results with other procedures, heck I even went as far as to create a procedure that takes and assigns a static value to a return variable and I still get nothing back (including no errors).
http://www.oracle.com/technetwork/articles/fuecks-sps-095636.html (sayHello example).
Once again the procedure works from Aqua Data Studio but not from PHP. No exception is thrown, no variable returned.

Does Oracle have something like the SQL SERVER Profiler that allows you to view queries being executed against Oracle? (I dont have admin rights for the server though).

Doesnt seem like it could be permission based since it works from ADS.

I can run queries against the database without a problem so I am confident my connection is working.

Am I missing something obvious?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:28:01+00:00Added an answer on June 7, 2026 at 5:28 am

    I’m not familiar with PHP, but according to the manual page for oci_bind_by_name:

    You must specify maxlength when using an OUT bind so that PHP
    allocates enough memory to hold the returned value.

    Also, there’s at least one minor syntax error in your PL/SQL block. You need to always use double-quotes when referencing GetUserLogin. (Although I doubt that’s your main problem. If it were, you should get an error message.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a simple Oracle Stored Procedure: CREATE OR REPLACE PROCEDURE
Hi I am trying to get information on an Oracle package directly from PHP
I am trying to get the data from a Oracle View created on XML
I created SSIS will do task like get data from oracle to sql server.i
I' trying to get some data from Oracle via ODBC to mySQL database. And
I've got a oracle 10g PL/SQL program that I'm trying to get to run,
I am trying to get unique values from a table in oracle via sql.
Hello I am a php developer, trying to get going with Oracle. So I
Hello I am trying to pass in varrays from PHP to Oracle. I am
I'm trying to update a table via a stored procedure from asp.net. I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.