John
John

Reputation: 29

How i can execute function?

SQL code work in Oracle SQL Developer, but not work in PHP PDO example:

    $sql = <<<SQL
      var sss varchar2(1000);
      begin
        :sss := AFACE_WWW_PNAL_SAVE(
          54687,
          10.66,
          'Description'
        );
      end;
SQL;
    $pdo->prepare($sql);
    $pdo->query($sql); -- Exception

Error: SQLSTATE[HY000]: General error: 900 OCIStmtExecute: ORA-00900: invalid SQL statement

How i can get result in "sss" variable?

Upvotes: 0

Views: 120

Answers (1)

sticky bit
sticky bit

Reputation: 37487

I don't know if PL/SQL blocks are even allowed there, but if they are you may miss a DECLARE at the beginning.

But you don't need PL/SQL to get a value from a function. You can query dual.

SELECT aface_www_pnal_save(54687, 10.66, 'Description') sss
       FROM dual;

Upvotes: 5

Related Questions