Forum Stats

  • 3,837,795 Users
  • 2,262,300 Discussions
  • 7,900,394 Comments

Discussions

exec timesten procedure from PHP

NewOracle
NewOracle Member Posts: 14
edited Dec 3, 2013 5:15PM in PHP

Hi every body,

     Any body already exec timesten procedure from PHP can share with me how can to do that ?

Thanks so much.

Answers

  • Christopher Jones-Oracle
    Christopher Jones-Oracle Member Posts: 1,652 Employee

    Do you mean a PL/SQL procedure?  Try the same as for Oracle DB.  See The Underground PHP and Oracle Manual

    For example:

    <?php
    
    // TimesTen PL/SQL Procedure Calls
    
    error_reporting(E_ALL);  // In PHP 5.3 use E_ALL|E_STRICT"
    ini_set('display_errors', 'On');
      
    $c = oci_connect("appuser", "oracle", "sampledb_1122");
    var_dump($c);
    
    $sql = <<<'EOF'
    create or replace procedure cjproc(p_o out number) as
    begin
      p_o := 3;
    end;
    EOF;
    
    $s = oci_parse($c, $sql);
    oci_execute($s);
    
    $sql = <<<'EOF'
    begin cjproc(:x); end;
    EOF;
    $s = oci_parse($c, $sql);
    oci_bind_by_name($s, ":x", $x, 10, OCI_B_INT);
    oci_execute($s);
    var_dump($x);
    
    // This one needs admin privs
    $c2 = oci_connect("adm", "oracle", "sampledb_1122");
    $s = oci_parse($c2, "call ttRamPolicySet('inUse', 5)");
    oci_execute($s);
    
    ?>
    
This discussion has been closed.